125 - Create a dual-partition USB boot drive using YUMI
YUMI allows you to make a multiboot USB drive. There are Windows and linux versions of YUMI.
It works by installing syslinux onto your USB drive partition as the boot manager. You can pick from a variety of different ISOs and YUMI will extract the files from the ISO and place them on your USB drive.
However, YUMI will only boot to one partition.
Here, I outline a way to create a two-partition Removable USB drive using YUMI and syslinux (with the help from grub4dos)
In this example I will use 4 ISOs
Partition 1
linuxmint-201403-cinnamon-dvd-64bit.iso
solydx64_201407.iso
ubuntu-14.04-desktop-amd64.iso
Partition 2
systemrescuecd-x86-4.1.0.iso.
Method
1. Wipe and partition and format a USB drive - create two Primary FAT32 partitions.
If you are a linux user, you can use gparted. If you are a Windows user, you can use a free tool such as Easeus Home Partition Master
2. Download and run YUMI
Select the first partition in YUMI and choose your ISO.
You must select the type of distro first. If you want persistence and the option is offered, you can select that option and adjust the size using the slider.
Once you have added all three ISOs, quit YUMI.
You can test it now if you wish to make sure it boots and works. Note that some distros - e.g. Linux Mint will not boot from the USb drive if using a Virtual Machine.
3. If you are running Windows and have a Removable USB drive, Windows won't be able to access the 2nd partition, so we need to swap over the partitions
Run RMPrepUSB - select the USB drive in the Drive selection box and type CTRL+O (Drive - Set Windows accessible partition) - enter 2 when prompted and hit OK
You should now see that Windows can only see the 2nd partition.
4. Now run YUMI again and select the systemrescuecd-x86-4.1.0.iso (in this example) and complete the installation process.
If using linux, be sure to select the 2nd partition on the USB drive!
5. If you ran the Windows Step 3 above, now change back to the 1st partition by using RMPrepUSB - Ctrl+O again and enter 2
Ensure you can see the first partition again in Windows Explorer.
6. We now need to install grub4dos to the MBR:
Windows - Run RMPrepUSB - click the Install grub4dos button - Yes (MBR) - if prompted copy over the grldr file.
Linux - download grub4dos (use the latest version of 0.4.5c NOT 0.4.6a which is an Alpha version which may have bugs!)
Run bootlace --time-out=0 /dev/sdu (where sdu is your USB drive - e.g. sdc do NOT specify a partition such as sdc1, you must specify the drive)
copy the grldr file to the root of the first partition
7. We now need to make a grub4dos menu (\menu.lst) that will allow us to boot to either syslinux partition - here is a simple example:
\menu.lst
title Boot to Partition 1\n Run syslinux from partition 1
root (hd0,0)
chainloader (hd0,0)+1
boot
title Boot to Partition 2\n Run syslinux from partition 2
root (hd0,1)
chainloader (hd0,1)+1
boot
That's it!
Theory
The USB drive has one Master Boot Record (MBR) and two Partition Boot Records (PBRs)
MBR - contains grub4dos boot loader which loads the \grldr file which then looks for a menu.lst file
PBR1 - The first partition contains a boot loader which was written by YUMI which loads the \multiboot\ldlinux.sys file which then looks for a \multiboot\syslinux.cfg file (on the first partition only)
PBR2 - The 2nd partition contains a boot loader written by YUMI which loads the \multiboot\ldlinux.sys file which then looks for a \multiboot\syslinux.cfg file (on the second partition only)
You can see from the folder structure how YUMI has organised the folders: here is an example for the solydx distro
\multiboot\syslinux.cfg - main menu which loads \multiboot\menu\linux.cfg for linux menu
\multiboot\menu\linux.cfg - linux menu which loads \multiboot\solydx64_201407\isolinux\isolinux.cfg
\multiboot\solydx64_201407\isolinux\isolinux.cfg - contains menu entries for solyd
e.g.
#start solydx64_201407
LABEL solydx64_201407
MENU LABEL solydx64_201407
MENU INDENT 1
CONFIG /multiboot/solydx64_201407/isolinux/isolinux.cfg
APPEND /multiboot/solydx64_201407/isolinux
#end solydx64_201407
\multiboot\solydx64_201407\live - contains the squashfs files used for the 2nd boot stage of linux
Improving the menu
The first menu allows us to boot from either partition, but it would be nice to be able to boot directly to any of these payloads.
For example, the System Restore CD menu is rather awkward because we have to select the 32-bit boot option because we have the x86 32-bit version of the ISO. It would be nice if we could just boot directly to the System Restore distro...
First, we need to find the .cfg file. Examine the files on the 2nd partition (use RMPrepUSB - Ctrl+O if you need to swap partitions)...
The \multiboot\syslinux.cfg file leads us to /multiboot/menu/system.cfg
The \multiboot\menu\system.cfg file leads us to /multiboot/systemrescuecd-x86-4.1.0/isolinux/isolinux.cfg
This file contains menu entries such as (for the 32-bit menu entry):
MENU BEGIN
MENU TITLE B) Standard 32bit kernel (rescue32) with more choice...
LABEL rescue32_1
MENU LABEL 1. SystemRescueCd with default options
LINUX rescue32
INITRD initram.igz
APPEND subdir=multiboot/systemrescuecd-x86-4.1.0
TEXT HELP
Boot standard 32bit kernel with default options (should always work)
ENDTEXT
We can translate this into a grub4dos menu like this:
title System Rescue 32-bit\nBoot standard 32-bit kernel with default options (should always work)
root (hd0,1)
kernel /multiboot/systemrescuecd-x86-4.1.0/isolinux/rescue32 subdir=multiboot/systemrescuecd-x86-4.1.0
initrd /multiboot/systemrescuecd-x86-4.1.0/isolinux/initram.igz
boot
Notice how we need to put the full path in. An alternative would be to set the root directory - e.g. :
title System Rescue 32-bit\nBoot standard 32-bit kernel with default options (should always work)
root (hd0,1)
root ()/multiboot/systemrescuecd-x86-4.1.0/isolinux
kernel /rescue32 subdir=multiboot/systemrescuecd-x86-4.1.0
initrd /initram.igz
boot
We can repeat this process for the other payloads if we wish and do away with all the syslinux menus completely.
Here is an example \menu.lst file
title Run a linux distro \n Run any YUMI linux from Partition 1
chainloader (hd0,0)+1
title \n
root ()
title System Rescue\n
root ()
title =============\n
root ()
title System Rescue 32-bit Standard\nBoot standard 32-bit kernel with default options (should always work)
root (hd0,1)
root ()/multiboot/systemrescuecd-x86-4.1.0/isolinux
kernel /rescue32 subdir=multiboot/systemrescuecd-x86-4.1.0
initrd /initram.igz
boot
title \n
root ()
title System Rescue 32-bit (Alternative)\nBoot alternative 32-bit kernel with default options (should always work)
root (hd0,1)
root ()/multiboot/systemrescuecd-x86-4.1.0/isolinux
kernel /altker32 subdir=multiboot/systemrescuecd-x86-4.1.0
initrd /initram.igz
boot
title System Rescue Alternative 32-bit kernel with console in high resolution (1024x768)\nBoot alternative 32-bit kernel with framebuffer console in high resolution\nKMS graphic drivers (Kernel-Mode-Settings) will be disabled.
root (hd0,1)
kernel /multiboot/systemrescuecd-x86-4.1.0/isolinux/altker32 subdir=multiboot/systemrescuecd-x86-4.1.0 nomodeset vga=791
initrd /multiboot/systemrescuecd-x86-4.1.0/isolinux/initram.igz
boot
title System Rescue Alternative 32-bit kernel with a standard VGA console (no KMS)\nBoot alternative 32-bit kernel and use standard low-resolution VGA\nconsole. KMS graphic drivers (Kernel-Mode-Settings) will be disabled.\nTry this if you can't get a working console or new a low-resolution mode
root (hd0,1)
kernel /multiboot/systemrescuecd-x86-4.1.0/isolinux/altker32 subdir=multiboot/systemrescuecd-x86-4.1.0 nomodeset
initrd /multiboot/systemrescuecd-x86-4.1.0/isolinux/initram.igz
boot
title System Rescue - console in 800x600\nBoot alternative 32-bit kernel and use standard graphic driver in 800x600\nKMS graphic drivers (Kernel-Mode-Settings) will be used if appropriate.\nUse that to get a 800x600 resolution and have a KMS compatible card.
root (hd0,1)
kernel /multiboot/systemrescuecd-x86-4.1.0/isolinux/altker32 subdir=multiboot/systemrescuecd-x86-4.1.0 docache
initrd /multiboot/systemrescuecd-x86-4.1.0/isolinux/initram.igz
boot
You can change the menu text colours and add a background bitmap - see here for a tutorial on grub4dos.
e.g. Try adding this to the top of the menu
#Normal text black with cyan background, Highlighted menu=yellow text with cyan background, Help text=red with light=blue background, Heading is yellow text with white background
color black/cyan yellow/cyan red/light-blue yellow/green
default 0
timeout 3
# clear grub4dos header and put a heading above the menu box at position Y=08 X=84 of text colour 3 (cyan) and bright (1), background color is 0 and blink is 0
write (md)0x220+1 !BAT\necho -n -P:0000 $[0122] MY MENU \n\0
initscript (md)0x220+1
after 3 seconds it will run the YUMI partition 1 menu (menu item 0) if no key is pressed.
Using grub4dos for the whole menu
The menu below does not rely on syslinux or any of the YUMI boot files. You just need the \multiboot folder from any USB drive made with YUMI.
The grub4dos menu entries can be formulated by inspecting the isolinux\isolinux.cfg files
#Normal text black with cyan background, Highlighted menu=yellow text with cyan background, Help text=red with light=blue background, Heading is yellow text with dark green background
color black/cyan yellow/cyan red/light-blue yellow/green
# set to 800 x 600
graphicsmode -1 800 600
# set VM to path of USB drive if using a VM to test booting (uncomment next line by removing #) - needed for Mint
#set VM=live-media=/dev/sda1
#set default boot entry to the 4th entry (0-based numbering)
default 3
#set a timeout of 30 seconds before the default entry is run
timeout 30
# clear grub4dos header and put a heading above the menu box at position 00 $[0122] = bright-green text on dark green background
write (md)0x220+1 !BAT\necho -n -P:0000 $[0122] MY MENU \n\0
initscript (md)0x220+1
title \n
root ()
title Ubuntu\n
root ()
title ======\n
root ()
title Try Ubuntu without installing\n
kernel /multiboot/ubuntu-14.04-desktop-amd64/casper/vmlinuz.efi file=/cdrom/multiboot/ubuntu-14.04-desktop-amd64/preseed/ubuntu.seed boot=casper cdrom-detect/try-usb=true persistent persistent-path=/multiboot/ubuntu-14.04-desktop-amd64 noprompt floppy.allowed_drive_mask=0 ignore_uuid live-media-path=/multiboot/ubuntu-14.04-desktop-amd64/casper/ quiet splash --
initrd /multiboot/ubuntu-14.04-desktop-amd64/casper/initrd.lz
boot
title Install Ubuntu\n
kernel /multiboot/ubuntu-14.04-desktop-amd64/casper/vmlinuz.efi only-ubiquity file=/cdrom/multiboot/ubuntu-14.04-desktop-amd64/preseed/ubuntu.seed boot=casper cdrom-detect/try-usb=true persistent persistent-path=/multiboot/ubuntu-14.04-desktop-amd64 noprompt floppy.allowed_drive_mask=0 ignore_uuid live-media-path=/multiboot/ubuntu-14.04-desktop-amd64/casper/ quiet splash --
initrd /multiboot/ubuntu-14.04-desktop-amd64/casper/initrd.lz
title \n
root ()
title SolydX\n
root ()
title ======\n
root ()
title Start SolydX\n
kernel /multiboot/solydx64_201407/live/vmlinuz boot=live config ignore_uuid live-media-path=/multiboot/solydx64_201407/live/ quiet splash --
initrd=/multiboot/solydx64_201407/live/initrd.img
boot
title Start SolydX without Plymouth\n
kernel /multiboot/solydx64_201407/live/vmlinuz boot=live config ignore_uuid live-media-path=/multiboot/solydx64_201407/live/ quiet --
initrd=/multiboot/solydx64_201407/live/initrd.img
boot
title Start SolydX (compatibility mode)\n
kernel /multiboot/solydx64_201407/live/vmlinuz boot=live config xforcevesa ignore_uuid live-media-path=/multiboot/solydx64_201407/live ramdisk_size=1048576 root=/dev/ram rw noapic noapci nosplash irqpoll --
initrd=/multiboot/solydx64_201407/live/initrd.img
boot
title \n
root ()
title Linux Mint\n
root ()
title ==========\n
root ()
title Start Linux Mint\n
kernel /multiboot/linuxmint-201403-cinnamon-dvd-64bit/live/vmlinuz boot=live config %VM% live-media-path=/multiboot/linuxmint-201403-cinnamon-dvd-64bit/live quiet splash --
initrd /multiboot/linuxmint-201403-cinnamon-dvd-64bit/live/initrd.img
boot
title Start Linux Mint (compatibility mode)\n
kernel /multiboot/linuxmint-201403-cinnamon-dvd-64bit/live/vmlinuz boot=live config %VM% xforcevesa live-media-path=/multiboot/linuxmint-201403-cinnamon-dvd-64bit/live ramdisk_size=1048576 root=/dev/ram rw noapic noapci nosplash irqpoll --
initrd /multiboot/linuxmint-201403-cinnamon-dvd-64bit/live/initrd.img
boot
title \n
root ()
title System Rescue\n
root ()
title =============\n
root ()
title System Rescue 32-bit Standard\n Boot standard 32-bit kernel with default options (should always work)
root (hd0,1)
root ()/multiboot/systemrescuecd-x86-4.1.0/isolinux
kernel /rescue32 subdir=multiboot/systemrescuecd-x86-4.1.0
initrd /initram.igz
boot
title System Rescue 32-bit (Alternative)\n Boot alternative 32-bit kernel with default options (should always work)
root (hd0,1)
root ()/multiboot/systemrescuecd-x86-4.1.0/isolinux
kernel /altker32 subdir=multiboot/systemrescuecd-x86-4.1.0
initrd /initram.igz
boot
title System Rescue Alternative 32-bit kernel with console in high resolution (1024x768)\n Boot alternative 32-bit kernel with framebuffer console in high resolution\n KMS graphic drivers (Kernel-Mode-Settings) will be disabled.
root (hd0,1)
kernel /multiboot/systemrescuecd-x86-4.1.0/isolinux/altker32 subdir=multiboot/systemrescuecd-x86-4.1.0 nomodeset vga=791
initrd /multiboot/systemrescuecd-x86-4.1.0/isolinux/initram.igz
boot
title System Rescue Alternative 32-bit kernel with a standard VGA console (no KMS)\n Boot alternative 32-bit kernel and use standard low-resolution VGA\n console. KMS graphic drivers (Kernel-Mode-Settings) will be disabled.\n Try this if you can't get a working console or new a low-resolution mode
root (hd0,1)
kernel /multiboot/systemrescuecd-x86-4.1.0/isolinux/altker32 subdir=multiboot/systemrescuecd-x86-4.1.0 nomodeset
initrd /multiboot/systemrescuecd-x86-4.1.0/isolinux/initram.igz
boot
title System Rescue - console in 800x600\n Boot alternative 32-bit kernel and use standard graphic driver in 800x600\n KMS graphic drivers (Kernel-Mode-Settings) will be used if appropriate.\n Use that to get a 800x600 resolution and have a KMS compatible card.
root (hd0,1)
kernel /multiboot/systemrescuecd-x86-4.1.0/isolinux/altker32 subdir=multiboot/systemrescuecd-x86-4.1.0 docache
initrd /multiboot/systemrescuecd-x86-4.1.0/isolinux/initram.igz
boot
title \n
root ()
title Reboot\n Reboot the system
reboot