paperlined.org
sysadmin > boot > usb-resident > many_partitions
document updated 13 years ago, on Apr 16, 2011
###############################################################################
####[ MANY-PARTITIONS MULTI-BOOTER ]###########################################
###############################################################################

        #==================================================================#
        # partitions on this USB stick                                     #
        # ----------------------------                                     #
        #                                                                  #
        # GPT#1         grub2 [50mb]                                       #
        # GPT#2         bios_grub [1mb]                                    #
        #                               installed via grub-install --root= #
        # GPT#3         slax                                               #
        #                               extracted from SLAX.iso            #
        # GPT#4         slaxchanges                                        #
        #                               mkdir /slaxchanged/, that's it     #
        # GPT#5         knoppix                                            #
        #                               extracted from KNOPPIX.iso         #
        #                                                                  #
        #       (whenever an .iso is mentioned, it's extracted using 7zip) #
        #==================================================================#

        # TODO:
        #  - come up with a 'parted' script that creates the partitions
        #    automatically
        #     - in particular, increase "repeatability", the ability
        #       to easily recreate the drive after it fails
        #  - add more boot options:
        #       - Hiren's
        #       - UBCD
        #       - Backtrack
        #       - bootloaders with autodiscovery
        #           - PLoP
        #           - Super GRUB2 Disk
        #           - Super GRUB Disk
        #           - gPXE


set timeout=10
set default=0

insmod gptsync

menuentry "SLAX" {
        echo Loading Slax ...
        search --file --no-floppy --set=root /slax/base/001-core.lzm

        # Unfortunately, gptsync's first argument MUST be of the form "hd0" NOT "hd0,1".
        # Therefore, we can't use $root.  So we have to hard-code it.
        #
        # Probably the only way to not hard-code this is to use lua.mod's string manipulation to extract the proper drive from $root.

        # MBR#1 => GPT#3    (slax)
        # MBR#2 => GPT#4    (slaxchanges)
        gptsync hd0 3 4

        linux /boot/vmlinuz ramdisk_size=6666 root=/dev/ram0 rw autoexec="xconf;telinit~4" changes=/slaxchanges/
        initrd /boot/initrd.gz
}


menuentry "Knoppix" {
        echo Loading Knoppix ...
        search --file --no-floppy --set=root /KNOPPIX/knoppix-cheatcodes.txt

        # Knoppix supports GPT, so we don't need to use gptsync to remap MBR

        linux /boot/isolinux/linux ramdisk_size=100000 lang=en vt.default_utf8=0 apm=power-off video=vga16fb:off nomce loglevel=1 tz=localtime
        initrd /boot/isolinux/minirt.gz 
}


# located in GPT#1
menuentry "Memory test (memtest86+)" {
        linux16 /memtest86+.bin
}