X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=minbase-strap.sh;h=82cc91a4ab8ec1b218296dd1ee043486f8337612;hb=3b35d478a2bf7730eb333ba04b55c8372eff30b8;hp=16340d9ea4ffdf3d967b5a3d9879a10ea28d1f72;hpb=e75a7ffa6c10188c831c1d29a5f0cf31ae975d40;p=rrq%2Frescue-boot.git diff --git a/minbase-strap.sh b/minbase-strap.sh index 16340d9..82cc91a 100755 --- a/minbase-strap.sh +++ b/minbase-strap.sh @@ -118,6 +118,10 @@ case "$X" in FS) copyFStree lib/modules zstdcat $INITRD | ( cd $TMP/prep && cpio -i ) + VERSION=( $TMP/prep/lib/modules/* ) + for V in ${VERSION[@]} ; do + depmod -a -b $TMP/prep ${V#$TMP/prep/lib/modules/} + done ;; my) copyFStree lib/modules lib/udev @@ -127,76 +131,40 @@ case "$X" in esac ## (re)install /init +mv $TMP/prep/init{,.FS} echo "** Please select /init template" select INIT in none $(echo init*.template) ; do [ -n "$INIT" ] && break ; done if [ "$INIT" != none ] ; then - mv $TMP/prep/init{,.FS} cp $INIT $TMP/prep/init chmod a+x $TMP/prep/init - cp message.txt $TMP/prep/message.txt fi +# Populate $TMP with /initrd.gz. /vmlinuz and /menu.cfg ( cd "$TMP/prep" && find -printf '%P\n' | cpio -o -H newc ) | \ gzip > $TMP/initrd.gz cp $LINUX $TMP/vmlinuz -rm -rf $TMP/prep +rm -r $TMP/prep -#============================================================ -# Add syslinux boot equipment for bios boot under $TMP/syslinux -# (also includes the syslinux image mastering further below) -echo "Please select boot console options" - -CONOPTS=( none ttyS0,115200 ) -select CON in "${CONOPTS[@]}" ; do [ -n "$CON" ] && break ; done -case "$CON" in none) CON= ;; *) CON="console=$CON" ;; esac - -mkdir -p $TMP/syslinux -cp -t $TMP/syslinux /usr/lib/syslinux/modules/bios/* -cat < $TMP/syslinux/syslinux.cfg +# Common syslinux menu +CON="console=ttyS0,115200" +cat < $TMP/menu.cfg default menu.c32 -label linux +label rescue (serial) kernel /vmlinuz - append initrd=/initrd.gz init=/init console=ttyS0,115200 -label rescue + append initrd=/initrd.gz init=/init $CON rescue +label rescue2 (vt1) kernel /vmlinuz - append initrd=/initrd.gz init=/init console=ttyS0,115200 rescue -EOF - -#============================================================ -[ -e "$IMG" ] && read -p "** Will overwrite $IMG (or ^C here and now)" x -rm -f "$IMG" - -# First partition sectors (round up to a Mb number -DUM1=$(( ( $(du -sB1 $TMP | sed 's/\s.*//') / 1048576 + 2 ) )) -DUM2=$(( $(stat -c %s FS.sqfs) / 1048576 + 2 )) - -# Estimate the required disk image size in Mib -DUM=$(( DUM1 + DUM2 + 1 )) - -# Create the image, with the partition marked as EFI parition and -# bootable; acutal format is FAT{12,16,32} -dd if=/dev/zero of="$IMG" bs=${DUM}M count=0 seek=1 status=none -cat </dev/null -umount $TMPIMG -rm $TMPIMG -mcopy -i "$IMG@@1048576" -s $TMP/* ::/ -[ -z "$SUDO_USER" ] || chown $SUDO_USER: "$IMG" -dd if=FS.sqfs of=$IMG seek=${PART[2]} conv=notrunc status=none +. ./minbase-strap-bios.sh +. ./minbase-strap-uefi.sh +. ./minbase-strap-mkimg.sh -#============================================================ -# Final syslinux bios boot image mastering -dd if=/usr/lib/SYSLINUX/mbr.bin of="$IMG" bs=440 conv=notrunc status=none -syslinux -i -d syslinux -t 1048576 "$IMG" +for E in $ENDING ; do $E ; done