support BOOT_METHOD=grub2 (El Torito boot – Manifold boot already did)
authorThorsten Glaser <tg@mirbsd.org>
Mon, 6 Dec 2010 21:10:37 +0000 (21:10 +0000)
committerMichael Prokop <mika@grml.org>
Mon, 13 Dec 2010 11:25:52 +0000 (12:25 +0100)
Closes: issue889
Signed-off-by: Thorsten Glaser <tg@mirbsd.org>
etc/grml/grml-live.conf
grml-live

index 6563eec..30b508c 100644 (file)
 # 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:
index 9598323..0055cc6 100755 (executable)
--- 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 | \