From 7741716c921420a1c8d8d63e9eadf0c80a3b3b51 Mon Sep 17 00:00:00 2001 From: Thorsten Glaser Date: Mon, 6 Dec 2010 21:10:37 +0000 Subject: [PATCH] =?utf8?q?support=20BOOT=5FMETHOD=3Dgrub2=20(El=20Torito?= =?utf8?q?=20boot=20=E2=80=93=20Manifold=20boot=20already=20did)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Closes: issue889 Signed-off-by: Thorsten Glaser --- etc/grml/grml-live.conf | 2 +- grml-live | 28 +++++++++++++++++++--------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/etc/grml/grml-live.conf b/etc/grml/grml-live.conf index 6563eec..30b508c 100644 --- a/etc/grml/grml-live.conf +++ b/etc/grml/grml-live.conf @@ -109,7 +109,7 @@ # SQUASHFS_OPTIONS="-nolzma" # Which bootloader do you want to use? Default: isolinux -# Supported values: isolinux, grub +# Supported values: isolinux, grub, grub2 # BOOT_METHOD='isolinux' # Directory of configuration files for grml-live's FAI: diff --git a/grml-live b/grml-live index 9598323..0055cc6 100755 --- a/grml-live +++ b/grml-live @@ -1019,9 +1019,11 @@ find .. -type f -not -name md5sums -not -name isolinux.bin -exec md5sum {} \; > [ -n "$ISO_NAME" ] || ISO_NAME="${GRML_NAME}_${VERSION}.iso" if [ "$BOOT_METHOD" = "isolinux" ] ; then - BOOT_FILE="boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat" + BOOT_ARGS="-no-emul-boot -boot-load-size 4 -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat" elif [ "$BOOT_METHOD" = "grub" ] ; then - BOOT_FILE="boot/grub/stage2" + BOOT_ARGS="-no-emul-boot -boot-load-size 4 -boot-info-table -b boot/grub/stage2" +elif [ "$BOOT_METHOD" = "grub2" ] ; then + BOOT_ARGS="-no-emul-boot -boot-load-size 4 -b boot/grub/toriboot.bin" fi if [ -f "${ISO_OUTPUT}/${ISO_NAME}" -a -z "$UPDATE" -a -z "$BUILD_ONLY" -a -z "$BUILD_DIRTY" -a "$FORCE_ISO_REBUILD" = "false" ] ; then @@ -1051,11 +1053,23 @@ else CURRENT_DIR=$(pwd) if cd "$BUILD_OUTPUT" ; then - log "$MKISOFS -V '${GRML_NAME} ${VERSION}' -publisher 'grml-live | grml.org' -l -r -J -no-emul-boot -boot-load-size 4 -boot-info-table -b $BOOT_FILE -o ${ISO_OUTPUT}/${ISO_NAME} ." + if [ "$BOOT_METHOD" = "grub2" ]; then + # make a 2048-byte bootsector for El Torito + dd if=/dev/zero of=boot/grub/toriboot.bin bs=512 count=4 2>/dev/null + # those are in 2048-byte sectors, so 1 16 matches 4 63 below + echo 1 16 | mksh /usr/share/grml-live/scripts/bootgrub.mksh -B 11 | \ + dd of=boot/grub/toriboot.bin conv=notrunc 2>/dev/null + fi + log "$MKISOFS -V '${GRML_NAME} ${VERSION}' -publisher 'grml-live | grml.org' -l -r -J $BOOT_ARGS -o ${ISO_OUTPUT}/${ISO_NAME} ." "$MKISOFS" -V "${GRML_NAME} ${VERSION}" -publisher 'grml-live | grml.org' \ - -l -r -J -no-emul-boot -boot-load-size 4 -boot-info-table \ - -b $BOOT_FILE -no-pad \ + -l -r -J $BOOT_ARGS -no-pad \ -o "${ISO_OUTPUT}/${ISO_NAME}" . ; RC=$? + # both of these need core.img there, so it’s easier to write it here + if [ "$BOOT_METHOD" = "grub2" ] || [ "$HYBRID_METHOD" = "grub2" ]; then + # must be <= 30720 bytes + dd if=boot/grub/core.img of="${ISO_OUTPUT}/${ISO_NAME}" \ + conv=notrunc bs=512 seek=4 2>/dev/null + fi # pad the output ISO to multiples of 256 KiB for partition table support siz=$($getfilesize "${ISO_OUTPUT}/${ISO_NAME}") @@ -1101,10 +1115,6 @@ else if [ "$HYBRID_METHOD" = "grub2" ] ; then # 512 bytes: MBR, partition table, load GRUB 2 echo 4 63 | mksh /usr/share/grml-live/scripts/bootgrub.mksh -A -M 4:0x96 -g $cyls:16:32 - # pad to a whole of 2048 bytes (one CD sector) - dd if=/dev/zero bs=512 count=3 2>/dev/null - # append GRUB 2 (must be <=30720 bytes) - cat boot/grub/core.img else # read only one but 2048-byte sized (scale: << 2) sector echo $bootoff $bootoff | \ -- 2.1.4