Merge remote branch 'ch/issue926'
authorMichael Prokop <mika@grml.org>
Wed, 1 Dec 2010 21:39:21 +0000 (22:39 +0100)
committerMichael Prokop <mika@grml.org>
Wed, 1 Dec 2010 21:39:21 +0000 (22:39 +0100)
Signed-off-by: Michael Prokop <mika@grml.org>
31 files changed:
debian/overrides.grml-live
docs/grml-live.txt
etc/grml/fai/config/package_config/GRML_FULL
etc/grml/grml-live.conf
grml-live
scripts/bootgrub.mksh
scripts/bootilnx.mksh [new file with mode: 0644]
templates/GRML/grml-cheatcodes.txt
templates/boot/grub/biosdisk.mod
templates/boot/grub/boot.img [deleted file]
templates/boot/grub/cdboot.img [deleted file]
templates/boot/grub/core.img
templates/boot/grub/diskboot.img [deleted file]
templates/boot/grub/efiemu32.o
templates/boot/grub/efiemu64.o
templates/boot/grub/eltorito.img [deleted file]
templates/boot/grub/grub.cfg
templates/boot/grub/kernel.img [deleted file]
templates/boot/grub/lnxboot.img [deleted file]
templates/boot/grub/mdraid.mod
templates/boot/grub/moddep.lst
templates/boot/grub/multiboot.mod
templates/boot/grub/multiboot2.mod
templates/boot/grub/normal.mod
templates/boot/grub/partmap.lst [deleted file]
templates/boot/grub/pxeboot.img [deleted file]
templates/boot/grub/raid.mod
templates/boot/grub/raid5rec.mod
templates/boot/grub/raid6rec.mod
templates/boot/grub/zfs.mod
templates/boot/isolinux/hidden.cfg

index a7c3765..8a86196 100644 (file)
@@ -344,6 +344,7 @@ grml-live: executable-not-elf-or-script ./usr/share/grml-live/templates/windows/
 grml-live: executable-not-elf-or-script ./usr/share/grml-live/templates/windows/autostart/autorun.pif
 grml-live: extra-license-file usr/share/grml-live/templates/GRML/LICENSE.txt
 grml-live: script-not-executable ./usr/share/grml-live/scripts/bootgrub.mksh
+grml-live: script-not-executable ./usr/share/grml-live/scripts/bootilnx.mksh
 grml-live: unknown-section grml
 grml-live: unstripped-binary-or-object ./usr/share/grml-live/templates/boot/grub/915resolution.mod
 grml-live: unstripped-binary-or-object ./usr/share/grml-live/templates/boot/grub/acpi.mod
index 25752b8..3d94ea1 100644 (file)
@@ -1031,6 +1031,21 @@ Configure approx:
 Don't forget to restart approx (/etc/init.d/approx restart). That's it.
 All downloaded files will be cached in /var/cache/approx now.
 
+[[revert_manifold]]
+How do I revert the manifold feature from an ISO?
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The so called manifold feature Grml ISOs use by default allows to use the same
+ISO for CD boot and USB boot. If you notice any problems when booting just
+revert the manifold feature running:
+
+  % dd if=/dev/zero of=grml.iso bs=512 count=1 conv=notrunc
+
+To switch from manifold to isohybrid mode (an alternative approach provided by
+syslinux) then just execute:
+
+  % isohybrid grml.iso
+
 [[question]]
 I've a question which isn't answered by this document
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
index 4bed3e4..ff28aa0 100644 (file)
@@ -776,7 +776,6 @@ knockd
 knocker
 konwert
 kpartx
-kqemu-common
 krb5-config
 krb5-user
 ksh
index 3dbb7e0..6563eec 100644 (file)
 # *without* having to run grml2usb (like: 'dd if=grml.iso of=/dev/sdX')
 # - working both with the same ISO
 # HYBRID_METHOD='disable'   # do not create a hybrid ISO
-# HYBRID_METHOD='isohybrid' # use isohybrid instead of the default (being manifold)
+# HYBRID_METHOD='isohybrid' # use isohybrid from SYSLINUX
+# HYBRID_METHOD='grub2'     # use manifold with GRUB 2
+# HYBRID_METHOD='manifold'  # use manifold with ISOLINUX (default)
 
 # Binary that should be used for creating the squashfs file.
 # Defaults to the executable matching the kernel version, falls back to mksquashfs.
index 498a535..6fe6ef4 100755 (executable)
--- a/grml-live
+++ b/grml-live
@@ -1088,19 +1088,28 @@ else
          fi
       # by default use our manifold boot method:
       else
+         # isoinfo is part of both mkisofs and genisoimage so we're good
+         bootoff=$(isoinfo -l -i "${ISO_OUTPUT}/${ISO_NAME}" | \
+           sed -n '/^.*\[ *\([0-9]*\)[] ].* ISOLINUX.BIN;1 *$/s//\1/p')
          if ! [ -r boot/grub/core.img ] ; then
            ewarn "boot/grub/core.img not found, not creating manifold boot ISO file"
+         elif [ "${bootoff:-0}" -lt 1 ] ; then
+           ewarn "isolinux.bin not found on the ISO file, disabling manifold boot"
          else
            log "Creating hybrid ISO file with manifold method"
            einfo "Creating hybrid ISO file with manifold method"
-           (
+           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
-           ) | dd of="${ISO_OUTPUT}/${ISO_NAME}" conv=notrunc 2>/dev/null
+           else
+              # read only one but 2048-byte sized (scale: << 2) sector
+              echo $bootoff $bootoff | \
+                 mksh /usr/share/grml-live/scripts/bootilnx.mksh -A -M 4:0x96 -g $cyls:16:32 -S 2
+           fi | dd of="${ISO_OUTPUT}/${ISO_NAME}" conv=notrunc 2>/dev/null
            eend $?
          fi
       fi
index 3d813d8..57ed0f2 100644 (file)
@@ -1,9 +1,9 @@
 #!/usr/bin/env mksh
 # $Id$
-# $miros: src/sys/arch/i386/stand/bootxx/mkbxinst.sh,v 1.25 2009/07/24 16:27:56 tg Exp $
-# $miros: src/sys/arch/i386/stand/bootxx/bootxx.S,v 1.25 2009/06/29 20:50:59 tg Exp $ +t:GRUB +s:MBR
+# $miros: src/sys/arch/i386/stand/bootxx/mkbxinst.sh,v 1.28 2010/11/12 21:20:35 tg Exp $
+# $miros: src/sys/arch/i386/stand/bootxx/bootxx.S,v 1.26 2010/12/01 19:56:58 tg Exp $ +t:GRUB +s:MBR
 #-
-# Copyright (c) 2007, 2008, 2009
+# Copyright (c) 2007, 2008, 2009, 2010
 #      Thorsten Glaser <tg@mirbsd.org>
 #
 # Provided that these terms and disclaimer and all copyright notices
@@ -26,7 +26,7 @@
 # and writes bootxx to standard output, which can subsequentially be
 # stored as partition boot record (or floppy boot sector) on disc.
 
-set -A thecode 0x66 0x31 0xC9 0x8E 0xD1 0xBC 0xFC 0x7B 0x66 0x51 0x66 0x9D 0x8E 0xC1 0xBE 0x00 0x7C 0x8E 0xD9 0xBB 0x00 0x08 0x53 0x53 0x8E 0xC3 0xBF 0x00 0xFE 0xB5 0x02 0xF3 0xA4 0x1F 0x68 0x6B 0xFE 0xCB 0x30 0x41 0x41 0x41 0x20 0x4C 0x6F 0x61 0x64 0x69 0x6E 0x67 0x20 0x00 0x20 0x65 0x72 0x72 0x6F 0x72 0x0D 0x0A 0x00 0x96 0x02 0x00 0x12 0x00 0x00 0x80 0x65 0xFF 0xB4 0x0E 0xBB 0x07 0x00 0xCD 0x10 0xAC 0x08 0xC0 0x75 0xF4 0xC3 0xE8 0xF7 0xFF 0xB8 0x41 0xFF 0x87 0x06 0x44 0xFE 0x3D 0x41 0xFF 0x75 0x19 0x31 0xC0 0xCD 0x16 0xEA 0xF0 0xFF 0x00 0xF0 0xFB 0x88 0x16 0x43 0xFE 0xBE 0x26 0xFE 0x80 0xFA 0x80 0x72 0xDB 0xE8 0xD2 0xFF 0x31 0xDB 0xBE 0x68 0xFF 0x0F 0xB6 0x2E 0x3D 0xFE 0xAC 0x0F 0xB6 0xC8 0xC0 0xE9 0x05 0x83 0xE0 0x1F 0x40 0x41 0x50 0xBF 0x10 0xFE 0xB8 0x10 0x00 0xAB 0xB0 0x01 0xAB 0x89 0xD8 0xAB 0x8C 0xC8 0xAB 0xF3 0xA4 0x31 0xC0 0xAB 0xAB 0xAB 0xAB 0x5F 0x55 0x56 0xBE 0x10 0xFE 0xFF 0x16 0x44 0xFE 0xBD 0x04 0x00 0x8A 0x16 0x43 0xFE 0x60 0xF9 0xCD 0x13 0x9C 0xB8 0x2E 0x0E 0xBB 0x07 0x00 0xCD 0x10 0x9D 0xFB 0x61 0x73 0x1C 0x4D 0x60 0x9C 0x31 0xC0 0xCD 0x13 0x9D 0xBE 0x34 0xFE 0x0F 0x84 0x77 0xFF 0xB8 0x30 0x0E 0x01 0xE8 0xBB 0x07 0x00 0xCD 0x10 0x61 0xEB 0xD2 0xB4 0x02 0x00 0xE7 0x89 0x5C 0x04 0x00 0xFC 0x72 0x14 0x66 0x83 0x44 0x08 0x01 0x66 0x83 0x54 0x0C 0x00 0x4F 0x75 0xAC 0x5E 0x5D 0x4D 0x0F 0x85 0x7D 0xFF 0xBE 0x3A 0xFE 0xE8 0x3F 0xFF 0x66 0x31 0xD2 0x52 0x66 0x4A 0x8A 0x16 0x43 0xFE 0xB8 0x00 0x82 0x50 0xFA 0xCB 0x60 0x06 0xB4 0x08 0x8A 0x16 0x43 0xFE 0xF9 0xCD 0x13 0xFB 0x07 0xBE 0x34 0xFE 0x0F 0x82 0x21 0xFF 0x80 0xE1 0x3F 0x88 0x0E 0x40 0xFE 0x0F 0xB6 0xC6 0x40 0xA3 0x3E 0xFE 0x61 0x8B 0x0E 0x40 0xFE 0xE3 0xD7 0x8B 0x44 0x08 0x8B 0x54 0x0A 0xF7 0xF1 0x42 0x31 0xC9 0x87 0xD1 0xF7 0x36 0x3E 0xFE 0xC0 0xE4 0x06 0x86 0xC4 0x09 0xC1 0x88 0xD6 0xB8 0x01 0x02 0xC3 0xB4 0x42 0xC3
+set -A thecode 0x66 0x31 0xC9 0x8E 0xD1 0xBC 0xFC 0x7B 0x66 0x51 0x66 0x9D 0x8E 0xC1 0xBE 0x00 0x7C 0x8E 0xD9 0xBB 0x00 0x08 0x53 0x53 0x8E 0xC3 0xBF 0x00 0xFE 0xB5 0x02 0xF3 0xA4 0x1F 0x68 0x6B 0xFE 0xCB 0x30 0x41 0x41 0x44 0x20 0x4C 0x6F 0x61 0x64 0x69 0x6E 0x67 0x20 0x00 0x20 0x65 0x72 0x72 0x6F 0x72 0x0D 0x0A 0x00 0x96 0x02 0x00 0x12 0x00 0x00 0x80 0x65 0xFF 0xB4 0x0E 0xBB 0x07 0x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x07 0xBE 0x34 0xFE 0x0F 0x82 0x21 0xFF 0x80 0xE1 0x3F 0x88 0x0E 0x40 0xFE 0x0F 0xB6 0xC6 0x40 0xA3 0x3E 0xFE 0x61 0x8B 0x0E 0x40 0xFE 0xE3 0xD7 0x8B 0x44 0x08 0x8B 0x54 0x0A 0xF7 0xF1 0x42 0x31 0xC9 0x87 0xD1 0xF7 0x36 0x3E 0xFE 0xC0 0xE4 0x06 0x86 0xC4 0x09 0xC1 0x88 0xD6 0xB8 0x01 0x02 0xC3 0xB4 0x42 0xC3
 typeset -i ofs_bkcnt=61
 typeset -i ofs_geomh=62
 typeset -i ofs_geoms=64
@@ -81,10 +81,10 @@ function record_block {
        fi
 }
 
-typeset -i partp=0 numheads=0 numsecs=0 sscale=0 bsh=9 mbrpno=0 mbrptp=0
+typeset -i partp=0 numheads=0 numsecs=0 sscale=0 bsh=9 mbrpno=0 mbrptp=0 pofs=0
 set -A g_code 0 0 0
 
-while getopts ":0:1AB:g:h:M:p:S:s:" ch; do
+while getopts ":0:1AB:g:h:M:O:p:S:s:" ch; do
        case $ch {
        (0)     ;;
        (1)     ;;
@@ -92,7 +92,7 @@ while getopts ":0:1AB:g:h:M:p:S:s:" ch; do
                numsecs=99
                ;;
        (B)     if (( (bsh = OPTARG) < 9 || OPTARG > 15 )); then
-                       print -u2 error: invalid block size "2^'$OPTARG'"
+                       print -u2 Error: invalid block size "2^'$OPTARG'"
                        exit 1
                fi
                ;;
@@ -105,45 +105,53 @@ while getopts ":0:1AB:g:h:M:p:S:s:" ch; do
                set -A g_code -- $OPTARG
                IFS=$saveIFS ;;
        (h)     if (( (numheads = OPTARG) < 1 || OPTARG > 256 )); then
-                       print -u2 warning: invalid head count "'$OPTARG'"
+                       print -u2 Warning: invalid head count "'$OPTARG'"
                        numheads=0
                fi ;;
        (M)     if [[ $OPTARG != +([0-9])?(:?(0[Xx])+([0-9])) ]]; then
-                       print -u2 warning: invalid partition info "'$OPTARG'"
+                       print -u2 Warning: invalid partition info "'$OPTARG'"
                        mbrpno=0
                        mbrptp=0
-               fi
-               saveIFS=$IFS
-               IFS=:
-               set -A mbr_code -- $OPTARG
-               IFS=$saveIFS
-               (( mbrpno = mbr_code[0] ))
-               (( mbrptp = mbr_code[1] ))
-               if (( mbrpno < 1 || mbrpno > 4 )); then
-                       print -u2 warning: invalid partition number "'$OPTARG'"
-                       mbrpno=0
-               fi
-               if (( mbrptp < 1 || mbrptp > 255 )); then
-                       print -u2 warning: invalid partition type "'$OPTARG'"
-                       mbrptp=0
+               else
+                       saveIFS=$IFS
+                       IFS=:
+                       set -A mbr_code -- $OPTARG
+                       IFS=$saveIFS
+                       (( mbrpno = mbr_code[0] ))
+                       (( mbrptp = mbr_code[1] ))
+                       if (( mbrpno < 1 || mbrpno > 4 )); then
+                               print -u2 Warning: invalid partition \
+                                   number "'$OPTARG'"
+                               mbrpno=0
+                       fi
+                       if (( mbrptp < 1 || mbrptp > 255 )); then
+                               print -u2 Warning: invalid partition \
+                                   type "'$OPTARG'"
+                               mbrptp=0
+                       fi
+               fi ;;
+       (O)     if [[ $OPTARG != +([0-9]) ]]; then
+                       print -u2 Warning: invalid partition offset "'$OPTARG'"
+               else
+                       pofs=$OPTARG
                fi ;;
        (p)     if (( (partp = OPTARG) < 1 || OPTARG > 255 )); then
-                       print -u2 warning: invalid partition type "'$OPTARG'"
+                       print -u2 Warning: invalid partition type "'$OPTARG'"
                        partp=0
                fi ;;
        (S)     if (( (sscale = OPTARG) < 0 || OPTARG > 24 )); then
-                       print -u2 error: invalid input scale "'$OPTARG'"
+                       print -u2 Error: invalid input scale "'$OPTARG'"
                        exit 1
                fi ;;
        (s)     if (( (numsecs = OPTARG) < 1 || OPTARG > 63 )); then
-                       print -u2 warning: invalid sector count "'$OPTARG'"
+                       print -u2 Warning: invalid sector count "'$OPTARG'"
                        numsecs=0
                fi ;;
        (*)     print -u2 'Syntax:
        bxinst [-1A] [-B blocksize] [-g C:H:S] [-h heads] [-M pno(1..4)[:typ]]
-           [-p partitiontype] [-S scale] [-s sectors] <sectorlist | \\
+           [-O partitionofs] [-p type] [-S scale] [-s secs] <sectorlist | \\
            dd of=image conv=notrunc
-Default values: blocksize=9 heads=16 sectors=63 partitiontype=0x27 scale=0
+Default values: blocksize=9 heads=16 sectors=63 part.ofs=0 type=0x27 scale=0
     partno=4 if -g (create MBR partition) is given; -A = auto boot geometry'
                exit 1 ;;
        }
@@ -169,7 +177,7 @@ if (( psz )); then
            "$psz * $((1 << bsh))" | bc) bytes\) in ${g_code[0]} cylinders, \
            ${g_code[1]} heads, ${g_code[2]} sectors per track
        if (( numsecs == 0 || (numsecs != 99 && numheads == 0) )); then
-               print -u2 warning: using these values for C/H/S boot
+               print -u2 Warning: using these values for C/H/S boot
                numheads=${g_code[1]}
                numsecs=${g_code[2]}
        fi
@@ -177,7 +185,7 @@ if (( psz )); then
 fi
 if (( mbrpno )); then
        bkend=0x1BE
-       (( psz )) || print -u2 warning: no geometry given, will not \
+       (( psz )) || print -u2 Warning: no geometry given, will not \
            create an MBR partition table entry
 fi
 
@@ -186,12 +194,12 @@ if (( numsecs == 99 )); then
        numsecs=0
 else
        if (( !numheads )); then
-               print -u2 warning: using default value of 16 heads
+               print -u2 Warning: using default value of 16 heads
                numheads=16
        fi
 
        if (( !numsecs )); then
-               print -u2 warning: using default value of 63 sectors
+               print -u2 Warning: using default value of 63 sectors
                numsecs=63
        fi
 fi
@@ -207,7 +215,7 @@ print -u2 "using $wrec blocks, $((curptr-begptr)) bytes ($((bkend-curptr)) free)
 
 # fill the block table
 if (( curptr-- > bkend )); then
-       print -u2 error: too many blocks
+       print -u2 Error: too many blocks
        exit 1
 fi
 while (( ++curptr < bkend )); do
@@ -232,23 +240,33 @@ print -u2 "using sectors of 2^$bsh = $((1 << bsh)) bytes"
 # create an MBR partition if desired
 if (( psz )); then
        (( mbrpno = 0x1BE + ((mbrpno - 1) * 16) ))
+       set -A o_code   # g_code equivalent for partition offset
+       (( o_code[2] = pofs % g_code[2] + 1 ))
+       (( o_code[1] = pofs / g_code[2] ))
+       (( o_code[0] = o_code[1] / g_code[1] + 1 ))
+       (( o_code[1] = o_code[1] % g_code[1] + 1 ))
+       # boot flag; C/H/S offset
        thecode[mbrpno++]=0x80
-       thecode[mbrpno++]=0
-       thecode[mbrpno++]=1
-       thecode[mbrpno++]=0
+       (( thecode[mbrpno++] = o_code[1] - 1 ))
+       (( cylno = o_code[0] > 1024 ? 1023 : o_code[0] - 1 ))
+       (( thecode[mbrpno++] = o_code[2] | ((cylno & 0x0300) >> 2) ))
+       (( thecode[mbrpno++] = cylno & 0x00FF ))
+       # partition type; C/H/S end
        (( thecode[mbrpno++] = (mbrptp ? mbrptp : partp ? partp : 0x27) ))
        (( thecode[mbrpno++] = g_code[1] - 1 ))
        (( cylno = g_code[0] > 1024 ? 1023 : g_code[0] - 1 ))
        (( thecode[mbrpno++] = g_code[2] | ((cylno & 0x0300) >> 2) ))
        (( thecode[mbrpno++] = cylno & 0x00FF ))
-       thecode[mbrpno++]=0
-       thecode[mbrpno++]=0
-       thecode[mbrpno++]=0
-       thecode[mbrpno++]=0
-       (( thecode[mbrpno++] = psz & 0xFF ))
-       (( thecode[mbrpno++] = (psz >> 8) & 0xFF ))
-       (( thecode[mbrpno++] = (psz >> 16) & 0xFF ))
-       (( thecode[mbrpno++] = (psz >> 24) & 0xFF ))
+       # partition offset, size (LBA)
+       (( thecode[mbrpno++] = pofs & 0xFF ))
+       (( thecode[mbrpno++] = (pofs >> 8) & 0xFF ))
+       (( thecode[mbrpno++] = (pofs >> 16) & 0xFF ))
+       (( thecode[mbrpno++] = (pofs >> 24) & 0xFF ))
+       (( pssz = psz - pofs ))
+       (( thecode[mbrpno++] = pssz & 0xFF ))
+       (( thecode[mbrpno++] = (pssz >> 8) & 0xFF ))
+       (( thecode[mbrpno++] = (pssz >> 16) & 0xFF ))
+       (( thecode[mbrpno++] = (pssz >> 24) & 0xFF ))
 fi
 
 # create the output string
diff --git a/scripts/bootilnx.mksh b/scripts/bootilnx.mksh
new file mode 100644 (file)
index 0000000..ed45137
--- /dev/null
@@ -0,0 +1,281 @@
+#!/usr/bin/env mksh
+# $Id$
+# $miros: src/sys/arch/i386/stand/bootxx/mkbxinst.sh,v 1.28 2010/11/12 21:20:35 tg Exp $
+# $miros: src/sys/arch/i386/stand/bootxx/bootxx.S,v 1.26 2010/12/01 19:56:58 tg Exp $ +t:ILNX +s:MBR
+#-
+# Copyright (c) 2007, 2008, 2009, 2010
+#      Thorsten Glaser <tg@mirbsd.org>
+#
+# Provided that these terms and disclaimer and all copyright notices
+# are retained or reproduced in an accompanying document, permission
+# is granted to deal in this work without restriction, including un‐
+# limited rights to use, publicly perform, distribute, sell, modify,
+# merge, give away, or sublicence.
+#
+# This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
+# the utmost extent permitted by applicable law, neither express nor
+# implied; without malicious intent or gross negligence. In no event
+# may a licensor, author or contributor be held liable for indirect,
+# direct, other damage, loss, or other issues arising in any way out
+# of dealing in the work, even if advised of the possibility of such
+# damage or existence of a defect, except proven that it results out
+# of said person’s immediate fault when using the work as intended.
+#-
+# Self-installing 32-bit x86 boot blocks for ISOLINUX
+# Reads a list of extents (firstblock lastblock) from standard input
+# and writes bootxx to standard output, which can subsequentially be
+# stored as partition boot record (or floppy boot sector) on disc.
+
+set -A thecode 0x66 0x31 0xC9 0x8E 0xD1 0xBC 0xFC 0x7B 0x66 0x51 0x66 0x9D 0x06 0x57 0x8E 0xC1 0xBE 0x00 0x7C 0x8E 0xD9 0xBB 0xC0 0x07 0x53 0x53 0x8E 0xC3 0xBF 0x00 0xFE 0xB5 0x02 0xF3 0xA4 0x1F 0x68 0x7A 0xFE 0xCB 0x30 0x41 0x41 0x44 0x20 0x4C 0x6F 0x61 0x64 0x69 0x6E 0x67 0x20 0x00 0x62 0x61 0x64 0x20 0x6D 0x61 0x67 0x69 0x63 0x20 0x65 0x72 0x72 0x6F 0x72 0x0D 0x0A 0x00 0x54 0x02 0x00 0x12 0x00 0x00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50 0xA1 0x49 0xFE 0x50 0xA1 0x4B 0xFE 0x50 0x31 0xDB 0xA1 0x4F 0xFE 0x3D 0x83 0xFF 0x74 0x01 0x43 0x53 0x51 0x66 0xA1 0x40 0x00 0xBE 0x36 0xFE 0x66 0x3D 0xFB 0xC0 0x78 0x70 0x0F 0x85 0x0E 0xFF 0xBE 0x45 0xFE 0xE8 0x02 0xFF 0xB8 0x44 0x7C 0x50 0xFA 0xCB 0x60 0x06 0xB4 0x08 0x8A 0x16 0x4E 0xFE 0xF9 0xCD 0x13 0xFB 0x07 0xBE 0x3F 0xFE 0x0F 0x82 0xEE 0xFE 0x80 0xE1 0x3F 0x88 0x0E 0x4B 0xFE 0x0F 0xB6 0xC6 0x40 0xA3 0x49 0xFE 0x61 0x8B 0x0E 0x4B 0xFE 0xE3 0xD7 0x8B 0x44 0x08 0x8B 0x54 0x0A 0xF7 0xF1 0x42 0x31 0xC9 0x87 0xD1 0xF7 0x36 0x49 0xFE 0xC0 0xE4 0x06 0x86 0xC4 0x09 0xC1 0x88 0xD6 0xB8 0x01 0x02 0xC3 0xB4 0x42 0xC3
+typeset -i ofs_bkcnt=72
+typeset -i ofs_geomh=73
+typeset -i ofs_geoms=75
+typeset -i ofs_partp=77
+typeset -i ofs_secsz=255
+typeset -i begptr=426
+typeset -Uui8 thecode
+
+typeset -Uui16 curptr=begptr
+typeset -i wnum=0 wofs=0 wrec=0 bkend=0x1FE
+
+function do_record {
+       typeset -Ui blk=$1 cnt=$2 n
+       typeset -Uui16 x=blk y
+
+       (( blk && cnt )) || return
+
+       print -u2 "$wrec @0x${curptr#16#}: $cnt @$blk (0x${x#16#})"
+
+       while (( cnt )); do
+               let wrec++
+               (( n = blk < 0x00000100 ? 0 :
+                   blk < 0x00010000 ? 1 :
+                   blk < 0x01000000 ? 2 : 3 ))
+               (( x = cnt < 33 ? cnt : 32 ))
+               (( y = blk ))
+               print -u2 " - 0x${curptr#16#}: $((x)) (0x${x#16#}) @ $blk" \
+                   "(0x${y#16#})"
+               (( thecode[curptr++] = (n++ << 5) | (x - 1) ))
+               (( blk += x ))
+               (( cnt -= x ))
+               while (( n-- )); do
+                       (( thecode[curptr++] = y & 0xFF ))
+                       (( y >>= 8 ))
+               done
+       done
+}
+
+function record_block {
+       typeset -Ui blk=$1
+
+       if (( !blk || (wofs && blk != (wofs + wnum)) )); then
+               # flush the blocks from the cache
+               (( wnum )) && do_record $wofs $wnum
+               wofs=0
+               wnum=0
+       fi
+       if (( blk )); then
+               # record some new block into the cache
+               (( wofs )) || let wofs=blk
+               (( wnum += 1 << sscale ))
+       fi
+}
+
+typeset -i partp=0 numheads=0 numsecs=0 sscale=0 bsh=9 mbrpno=0 mbrptp=0 pofs=0
+set -A g_code 0 0 0
+
+while getopts ":0:1AB:g:h:M:O:p:S:s:" ch; do
+       case $ch {
+       (0)     ;;
+       (1)     ;;
+       (A)     numheads=0
+               numsecs=99
+               ;;
+       (B)     if (( (bsh = OPTARG) < 9 || OPTARG > 15 )); then
+                       print -u2 Error: invalid block size "2^'$OPTARG'"
+                       exit 1
+               fi
+               ;;
+       (g)     if [[ $OPTARG != +([0-9]):+([0-9]):+([0-9]) ]]; then
+                       print -u2 Error: invalid geometry code "'$OPTARG'"
+                       exit 1
+               fi
+               saveIFS=$IFS
+               IFS=:
+               set -A g_code -- $OPTARG
+               IFS=$saveIFS ;;
+       (h)     if (( (numheads = OPTARG) < 1 || OPTARG > 256 )); then
+                       print -u2 Warning: invalid head count "'$OPTARG'"
+                       numheads=0
+               fi ;;
+       (M)     if [[ $OPTARG != +([0-9])?(:?(0[Xx])+([0-9])) ]]; then
+                       print -u2 Warning: invalid partition info "'$OPTARG'"
+                       mbrpno=0
+                       mbrptp=0
+               else
+                       saveIFS=$IFS
+                       IFS=:
+                       set -A mbr_code -- $OPTARG
+                       IFS=$saveIFS
+                       (( mbrpno = mbr_code[0] ))
+                       (( mbrptp = mbr_code[1] ))
+                       if (( mbrpno < 1 || mbrpno > 4 )); then
+                               print -u2 Warning: invalid partition \
+                                   number "'$OPTARG'"
+                               mbrpno=0
+                       fi
+                       if (( mbrptp < 1 || mbrptp > 255 )); then
+                               print -u2 Warning: invalid partition \
+                                   type "'$OPTARG'"
+                               mbrptp=0
+                       fi
+               fi ;;
+       (O)     if [[ $OPTARG != +([0-9]) ]]; then
+                       print -u2 Warning: invalid partition offset "'$OPTARG'"
+               else
+                       pofs=$OPTARG
+               fi ;;
+       (p)     if (( (partp = OPTARG) < 1 || OPTARG > 255 )); then
+                       print -u2 Warning: invalid partition type "'$OPTARG'"
+                       partp=0
+               fi ;;
+       (S)     if (( (sscale = OPTARG) < 0 || OPTARG > 24 )); then
+                       print -u2 Error: invalid input scale "'$OPTARG'"
+                       exit 1
+               fi ;;
+       (s)     if (( (numsecs = OPTARG) < 1 || OPTARG > 63 )); then
+                       print -u2 Warning: invalid sector count "'$OPTARG'"
+                       numsecs=0
+               fi ;;
+       (*)     print -u2 'Syntax:
+       bxinst [-1A] [-B blocksize] [-g C:H:S] [-h heads] [-M pno(1..4)[:typ]]
+           [-O partitionofs] [-p type] [-S scale] [-s secs] <sectorlist | \\
+           dd of=image conv=notrunc
+Default values: blocksize=9 heads=16 sectors=63 part.ofs=0 type=0x27 scale=0
+    partno=4 if -g (create MBR partition) is given; -A = auto boot geometry'
+               exit 1 ;;
+       }
+done
+shift $((OPTIND - 1))
+
+typeset -Ui psz=0      # must be unsigned
+if (( g_code[0] )); then
+       # bounds check partition table values, calculate total sectors
+       if (( g_code[0] < 1 || g_code[1] < 1 || g_code[1] > 256 ||
+           g_code[2] < 1 || g_code[2] > 63 )); then
+               print -u2 Invalid geometry, values out of bounds.
+       elif [[ $(print "(${g_code[0]} * ${g_code[1]} * ${g_code[2]})" \
+           "> 4294967295" | bc) = 1 ]]; then
+               print -u2 Invalid geometry, more than 2 TiB of data.
+       else
+               # we know it's <= 2^32-1
+               (( psz = g_code[0] * g_code[1] * g_code[2] ))
+       fi
+fi
+if (( psz )); then
+       print -u2 geometry is $psz sectors \($(print \
+           "$psz * $((1 << bsh))" | bc) bytes\) in ${g_code[0]} cylinders, \
+           ${g_code[1]} heads, ${g_code[2]} sectors per track
+       if (( numsecs == 0 || (numsecs != 99 && numheads == 0) )); then
+               print -u2 Warning: using these values for C/H/S boot
+               numheads=${g_code[1]}
+               numsecs=${g_code[2]}
+       fi
+       (( mbrpno )) || mbrpno=4        # default partition number
+fi
+if (( mbrpno )); then
+       bkend=0x1BE
+       (( psz )) || print -u2 Warning: no geometry given, will not \
+           create an MBR partition table entry
+fi
+
+if (( numsecs == 99 )); then
+       numheads=0
+       numsecs=0
+else
+       if (( !numheads )); then
+               print -u2 Warning: using default value of 16 heads
+               numheads=16
+       fi
+
+       if (( !numsecs )); then
+               print -u2 Warning: using default value of 63 sectors
+               numsecs=63
+       fi
+fi
+
+# read in the extents
+while read firstblock lastblock junk; do
+       while (( firstblock <= lastblock )); do
+               record_block $((firstblock++ << sscale))
+       done
+done
+record_block 0 # just flush
+print -u2 "using $wrec blocks, $((curptr-begptr)) bytes ($((bkend-curptr)) free)"
+
+# fill the block table
+if (( curptr-- > bkend )); then
+       print -u2 Error: too many blocks
+       exit 1
+fi
+while (( ++curptr < bkend )); do
+       (( thecode[curptr] = (curptr & 0xFCF) == 0x1C2 ? 0 : RANDOM & 0xFF ))
+       # ensure the “active” flag is never set to 0x00 or 0x80
+       if (( ((curptr + 2) & 0xFCF) == 0x01C0 )); then
+               (( thecode[curptr] & 0x7F )) || let --curptr
+       fi
+done
+thecode[510]=0x55
+thecode[511]=0xAA
+
+# fill in other data
+(( thecode[ofs_bkcnt] = wrec ))
+(( thecode[ofs_geomh] = numheads & 0xFF ))
+(( thecode[ofs_geomh + 1] = numheads >> 8 ))
+(( thecode[ofs_geoms] = numsecs ))
+(( thecode[ofs_partp] = partp ))
+print -u2 "using sectors of 2^$bsh = $((1 << bsh)) bytes"
+(( thecode[ofs_secsz] = (1 << (bsh - 8)) ))
+
+# create an MBR partition if desired
+if (( psz )); then
+       (( mbrpno = 0x1BE + ((mbrpno - 1) * 16) ))
+       set -A o_code   # g_code equivalent for partition offset
+       (( o_code[2] = pofs % g_code[2] + 1 ))
+       (( o_code[1] = pofs / g_code[2] ))
+       (( o_code[0] = o_code[1] / g_code[1] + 1 ))
+       (( o_code[1] = o_code[1] % g_code[1] + 1 ))
+       # boot flag; C/H/S offset
+       thecode[mbrpno++]=0x80
+       (( thecode[mbrpno++] = o_code[1] - 1 ))
+       (( cylno = o_code[0] > 1024 ? 1023 : o_code[0] - 1 ))
+       (( thecode[mbrpno++] = o_code[2] | ((cylno & 0x0300) >> 2) ))
+       (( thecode[mbrpno++] = cylno & 0x00FF ))
+       # partition type; C/H/S end
+       (( thecode[mbrpno++] = (mbrptp ? mbrptp : partp ? partp : 0x27) ))
+       (( thecode[mbrpno++] = g_code[1] - 1 ))
+       (( cylno = g_code[0] > 1024 ? 1023 : g_code[0] - 1 ))
+       (( thecode[mbrpno++] = g_code[2] | ((cylno & 0x0300) >> 2) ))
+       (( thecode[mbrpno++] = cylno & 0x00FF ))
+       # partition offset, size (LBA)
+       (( thecode[mbrpno++] = pofs & 0xFF ))
+       (( thecode[mbrpno++] = (pofs >> 8) & 0xFF ))
+       (( thecode[mbrpno++] = (pofs >> 16) & 0xFF ))
+       (( thecode[mbrpno++] = (pofs >> 24) & 0xFF ))
+       (( pssz = psz - pofs ))
+       (( thecode[mbrpno++] = pssz & 0xFF ))
+       (( thecode[mbrpno++] = (pssz >> 8) & 0xFF ))
+       (( thecode[mbrpno++] = (pssz >> 16) & 0xFF ))
+       (( thecode[mbrpno++] = (pssz >> 24) & 0xFF ))
+fi
+
+# create the output string
+ostr=
+curptr=0
+while (( curptr < 512 )); do
+       ostr=$ostr\\0${thecode[curptr++]#8#}
+done
+
+# over and out
+print -n "$ostr"
+exit 0
index 034d3e0..1b8b4d4 100644 (file)
@@ -25,8 +25,6 @@ grub                                Boot Grub bootloader (special all-in-one-ima
 dos                                 Boot FreeDOS
 bsd                                 Boot MirOS BSD
 hdt                                 Boot Hardware Detection Tool (from syslinux project)
-qemu                                Boot with special options for use in Qemu
-vmware                              Boot with special options for use in VMware
 
 Further documentation regarding the init process can be found at:
 * http://git.grml.org/?p=live-initramfs-grml.git;a=blob_plain;f=manpages/live-initramfs.en.7.txt;hb=HEAD
index 15467dd..d21f9b7 100644 (file)
Binary files a/templates/boot/grub/biosdisk.mod and b/templates/boot/grub/biosdisk.mod differ
diff --git a/templates/boot/grub/boot.img b/templates/boot/grub/boot.img
deleted file mode 100644 (file)
index 2d82978..0000000
Binary files a/templates/boot/grub/boot.img and /dev/null differ
diff --git a/templates/boot/grub/cdboot.img b/templates/boot/grub/cdboot.img
deleted file mode 100644 (file)
index 2579201..0000000
Binary files a/templates/boot/grub/cdboot.img and /dev/null differ
index 1563b67..cd96ad2 100644 (file)
Binary files a/templates/boot/grub/core.img and b/templates/boot/grub/core.img differ
diff --git a/templates/boot/grub/diskboot.img b/templates/boot/grub/diskboot.img
deleted file mode 100644 (file)
index 95a815c..0000000
Binary files a/templates/boot/grub/diskboot.img and /dev/null differ
index 32f2c06..c6ba049 100644 (file)
Binary files a/templates/boot/grub/efiemu32.o and b/templates/boot/grub/efiemu32.o differ
index 327689c..fe54d36 100644 (file)
Binary files a/templates/boot/grub/efiemu64.o and b/templates/boot/grub/efiemu64.o differ
diff --git a/templates/boot/grub/eltorito.img b/templates/boot/grub/eltorito.img
deleted file mode 100644 (file)
index 1207fc2..0000000
Binary files a/templates/boot/grub/eltorito.img and /dev/null differ
index d040156..da9c6b4 100644 (file)
@@ -20,10 +20,6 @@ else
   set menu_color_highlight=black/yellow
 fi
 
-# make sure we can access partitions
-insmod part_msdos
-insmod part_gpt
-
 if [ ${iso_path} ] ; then
     set loopback="findiso=${iso_path}"
 fi
@@ -42,14 +38,14 @@ menuentry "GPXE - boot via network/PXE" {
     linux16 /boot/addons/gpxe.lkrn
 }
 
-menuentry "Grub - all in one image" {
-    linux   /boot/addons/memdisk
-    initrd  /boot/addons/allinone.img
+menuentry "GRUB - all in one image" {
+    linux16  /boot/addons/memdisk
+    initrd16 /boot/addons/allinone.img
 }
 
 menuentry "FreeDOS" {
-    linux   /boot/addons/memdisk
-    initrd  /boot/addons/balder10.imz
+    linux16  /boot/addons/memdisk
+    initrd16 /boot/addons/balder10.imz
 }
 
 if [ ${iso_path} ] ; then
diff --git a/templates/boot/grub/kernel.img b/templates/boot/grub/kernel.img
deleted file mode 100644 (file)
index 1361a88..0000000
Binary files a/templates/boot/grub/kernel.img and /dev/null differ
diff --git a/templates/boot/grub/lnxboot.img b/templates/boot/grub/lnxboot.img
deleted file mode 100644 (file)
index b7d2a21..0000000
Binary files a/templates/boot/grub/lnxboot.img and /dev/null differ
index 94bbe5f..6ec8748 100644 (file)
Binary files a/templates/boot/grub/mdraid.mod and b/templates/boot/grub/mdraid.mod differ
index 81424f8..7b81c6f 100644 (file)
@@ -7,16 +7,16 @@ cmostest:
 gcry_rijndael: crypto
 echo: extcmd
 cpio:
-gcry_sha512: crypto
 gcry_cast5: crypto
+gcry_sha512: crypto
 boot:
 part_sun:
 gzio:
 ls: extcmd normal
 gfxterm: video extcmd bitmap_scale bitmap font
 video:
-gcry_tiger: crypto
 gcry_serpent: crypto
+gcry_tiger: crypto
 aout:
 gcry_blowfish: crypto
 extcmd:
index da88381..299d4b3 100644 (file)
Binary files a/templates/boot/grub/multiboot.mod and b/templates/boot/grub/multiboot.mod differ
index 26ed9f1..c2a6be5 100644 (file)
Binary files a/templates/boot/grub/multiboot2.mod and b/templates/boot/grub/multiboot2.mod differ
index 20a9e93..6d7feeb 100644 (file)
Binary files a/templates/boot/grub/normal.mod and b/templates/boot/grub/normal.mod differ
diff --git a/templates/boot/grub/partmap.lst b/templates/boot/grub/partmap.lst
deleted file mode 100644 (file)
index c9f1339..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-part_acorn
-part_amiga
-part_apple
-part_gpt
-part_msdos
-part_sun
diff --git a/templates/boot/grub/pxeboot.img b/templates/boot/grub/pxeboot.img
deleted file mode 100644 (file)
index 42b3f35..0000000
Binary files a/templates/boot/grub/pxeboot.img and /dev/null differ
index 0c72cbe..8ca6f0f 100644 (file)
Binary files a/templates/boot/grub/raid.mod and b/templates/boot/grub/raid.mod differ
index 71ba9b1..641283a 100644 (file)
Binary files a/templates/boot/grub/raid5rec.mod and b/templates/boot/grub/raid5rec.mod differ
index c0e395f..ecda42b 100644 (file)
Binary files a/templates/boot/grub/raid6rec.mod and b/templates/boot/grub/raid6rec.mod differ
index b5dc817..b40cd88 100644 (file)
Binary files a/templates/boot/grub/zfs.mod and b/templates/boot/grub/zfs.mod differ
index 26a35c4..e00b45d 100644 (file)
@@ -23,16 +23,6 @@ menu hide
 kernel /boot/%SHORT_NAME%/linux26
 append init=/sbin/bootchartd apm=power-off vga=791 quiet initrd=/boot/%SHORT_NAME%/initrd.gz boot=live bootid=%BOOTID% nomce 
 
-label vmware
-menu hide
-kernel /boot/%SHORT_NAME%/linux26
-append apm=power-off nousb nousb2 nofirewire vga=791 quiet initrd=/boot/%SHORT_NAME%/initrd.gz boot=live bootid=%BOOTID% nomce 
-
-label qemu
-menu hide
-kernel /boot/%SHORT_NAME%/linux26
-append apm=power-off nousb nousb2 nofirewire vga=791 quiet initrd=/boot/%SHORT_NAME%/initrd.gz boot=live bootid=%BOOTID% nomce qemu 
-
 label grmlx
 menu hide
 kernel /boot/%SHORT_NAME%/linux26