Making a Multi Booting CD DVD USB


Introduction

Everybody likes to use, test and hack with the mini distros, but no one likes to burn a CD for each one because they only takes a small fraction of the CD space resulting in low resource utilization and increases junk. What if we could keep all the distros in one single CD or even keep all the distros in one USB drive and boot the distros directly from there through an interactive menu system ? Yes that’s what we are going to do! We are going to pack 7 mini distros into one CD/DVD or USB ready-to-boot, and can carry them around in our pocket, booting any distro, anywhere, anytime, any place.

In this guide we will show you how to pack 7 distros into one CD, DVD or USB and make it bootable. This guide is written primarily for a CD or DVD, but we have also shown how this can be done with a USB flash drive. We will pack all the below GNU+Linux distros into a CD and USB drive, and make a multi booting multi OS CD/DVD/USB:

  1. PuppyLinux read review >>
  2. GeexBox read review >>
  3. Slitaz
  4. Goblinx (mini)
  5. Austrumi
  6. CDlinux (standard) read review >>
  7. Damn Small Linux (DSL)

So don’t wait, get the job done. Keep on reading.

Index


Instructions for this Guide

The whole process is divided into 7 Phases. Each Phase is again divided into some numbered sections. Follow Phase – I to Phase – IV , then to make a liveCD follow Phase – V or to make liveUSB follow Phase – VI, then continue serially.

When working, use either CUI or mix CUI and GUI (konqueror, or nautilus) as needed to make the process easy. Like copy-paste files change directories with GUI rapidly, mount images make iso with CUI

At all time keep two terminals open, one as normal user, and another with super user privilege, in both of the terminals always remain fixed inside a working directory, the “work_dir”. We will either point directories/files relative to “work_dir” or in absolute path. If some source packages are needed to be compiled, launch a new terminal in the source directory, carry on the compilation and terminate it.
When you see the ‘#‘ symbol beside a command, switch to the root console and execute, and when you see ‘$‘ run it in normal user terminal.
If there is not enough permission when trying to modifying/removing some file then ‘chmod’ it with proper permission first.

When describing the USB booting, we will call the USB partition ‘/dev/sdXy‘ . Where ‘X‘ is the disk alphabet (number) and ‘y‘ is the partition number. Replace ‘X‘ and ‘y‘ as per your drive’s values. In my case it was ‘/dev/sdb1‘ (X=b, y=1)

Warning: Always be extra careful when executing commands in super user mode. Double check which device are you operating on when setting boot flags, bootloaders. Else you might render your system un-bootable.

Phase – I: Prepare

  1. Make Directories

    Create the “work_dir” directory where we will dump all the resources. Create “mbcd” and “boot” directories in chains inside “work_dir”. The “mbcd” will be used to hold the compiled image files and the boot will the directory containing the boot files for the image. Then change directory to “word_dir” and be sure to be fixed in this location.

    	$ mkdir -p work_dir/mbcd/boot
    	$ cd work_dir
    	
  2. Getting The OSes

    Download the Oses and then copy them into “work_dir”

    		$ wget -c  " link_of_os "
    		$ cp /path_to_distros/* .
    		

    Where “/path_to_os/” is the absolute path to the downloaded distros “.” is current directory.
    Check the Links section for the official sites of the distros.

  3. Making mount points

    Create temporary directories in “/mnt/”, which we will use as mount points of the iso images. (You can mount one image, then unmount to reuse it, but for easy reference we will mount all the isos at once.), Make seven directories, tmp1 to tmp7 in “/mnt/”

    		# mkdir /mnt/tmp{1,2,3,4,5,6,7}
    		
  4. Mounting the Images

    We will now mount the ISO images in the mount point directories. Keep track which OS is mounted in which directory. You can name the directories accordingly, such that you can identify from the name. But for simplicity we will name them as “tmpX” s. Austrumi, Puppy Linux, Slitaz, CDlinux, DSL, GeeXboX, and GoblinX (Micro) will be mounter into “tmp1″, “tmp2″, “tmp3″, “tmp4″, “tmp5″, “tmp6″ and “tmp7″ respectively. We will set the owner and group of the mounted images to your normal user account and it’s group, by specifying the ‘uid‘ and ‘gid‘ options. Run as normal user ‘ id -u ‘ and ‘ id -g ‘ for the user and group id respectively and note them down. Replace <id> and <group>in the below commands with your user id and the group id respectively. Generally if you have only one user it the uid and gid both should be 500.

    		# mount austrumi*.iso /mnt/tmp1 -o loop,uid=<id>,gid=<group>
    		# mount puppy*.iso /mnt/tmp2 -o loop,uid=<id>,gid=<group>
    		# mount slitaz*.iso /mnt/tmp3 -o loop,uid=<id>,gid=<group>
    		# mount CDlinux*.iso /mnt/tmp4 -o loop,uid=<id>,gid=<group>
    		# mount dsl*.iso /mnt/tmp5 -o loop,uid=<id>,gid=<group>
    		# mount geexbox*.iso /mnt/tmp6 -o loop,uid=<id>,gid=<group>
    		# mount goblinx*.iso /mnt/tmp7 -o loop,uid=<id>,gid=<group>
    		

    Change the distro iso file names as per the downloaded file. In this guide The used OS versions are: Austrumi 1.7.2, PuppyLinux 4.0, Slitaz 1.0, CDlinux 0.9.1, DSL 4.2.2, GeexBox 1.2.2, GoblinX Micro 2.7

    Note: If you decide to mount the images as root as owner (without uid, gid options) then do the copy operations as root, as some of the files have forbidden access to all the users but the owner. After you have done all the copying you can ‘chown’ the copied files to normal user. or keep it as it is.

    Shortcut: You can skip the step 3 and 4 of this Phase, if you plan to use isomaster or file-roller and extract the needed files in the next phases with it.

Phase – II: Copying

Now we will copy the OS files from mount points to proper location in our image directory. First let us understand the requirements briefly while copying the files. Each OS has a kernel, and an initial ramdisk file where the kernel is decompressed and gets loaded into RAM. Then it loads the needed files mounts the OS file system and run programs to setup the OS. The kernel and the initial ramdisk files are loaded through the bootloader from the media. There is a filesystem for each OS where all the programs, scripts, configurations are installed. In the mini distros these are generally compressed, and/or encapsulated in a file system. Like CDlinux and PuppyLinux uses squashfs, etc. There may be more than one such filesystems for an OS, each containing needed files for a certain application software. For example, additional squashfs module can be downloaded for openoffice, or java runtime in puppylinux. Some distros finds the compressed filesystems in a certain location relative to the root of the bootable media, for some distros the locations of the files can be altered, but the changed location should informed by passing an appropriate boot parameter when booting, and some distros searches their files in all the attached disks of the system automatically. To know the requirements of a certain OS you should read the documentations in the official site, discuss in fourms, or the distro’s IRC channel. Or if you know some shell script, mount the initial ramdisk of the distro and read the loading script. After copying the OS files make sure the copied files are accessible to the distros, and the different OS files doesn’t create conflict. Some relocation will be done to avoid conflicts else we will try to keep the copying clean with minimum relocation.
Some files might have read-only permission to the owner, in such case ‘ chmod u+w ‘ should be done before modifying, deleting, overwriting it.

  1. Austrumi

    Copy “austrumi.fs” and “austrumi.tgz” from “/mnt/tmp1/boot/” into “mbcd/boot/”

    		$ cp /mnt/tmp1/boot/austrumi.* mbcd/boot/
    		

    Copy “bzImage” and “initrd.gz” from “/mnt/tmp1/isolinux” to “mbcd/boot/austrumi”.

    		$ mkdir mbcd/boot/austrumi
    		$ cp /mnt/tmp1/isolinux/initrd.gz \
    	             /mnt/tmp1/isolinux/bzImage  mbcd/boot/austrumi
    		

    Austrumi searches for it’s files in the boot directory, so you need to keep it in there. From version Austrumi 1.8.x the kernel and the initial ramdisk files are located in “austrumi/” directory in the image.

  2. Puppy Linux

    Puppy Linux does not need any specific location for the files to be kept, it finds it’s files form any attached media. We will place the puppy files in a directory. Copy “initrd.gz” and “vmlinuz” into “mbcd/boot/puppy” . Then copy “pup_400.sfs” and “zdrv_400.sfs” to “mbcd/Puppy”

    	$ mkdir mbcd/boot/puppy  mbcd/Puppy
    	$ cp /mnt/tmp2/initrd.gz \
    	/mnt/tmp2/vmlinuz  mbcd/boot/puppy
    	$ cp /mnt/tmp2/pup_400.sfs \
    	        /mnt/tmp2/zdrv_400.sfs  mbcd/Puppy
    	

    You can download and add additional puppy .sfs modules and keep them here.

  3. Slitaz

    Now draw the attention to “/mnt/tmp3″ , the slitaz mount point.
    Copy “bzImage”, “rootfs.gz” from “/mnt/tmp3/boot” to “mbcd/boot/slitaz” and copy “vmlinuz->version_no<-slitaz” to “mbcd/boot”.

    	$ mkdir mbcd/boot/slitaz
    	$ cp /mnt/tmp3/boot/bzImage \
    	     /mnt/tmp3/boot/rootfs.gz  mbcd/boot/slitaz
    	$ cp /mnt/tmp3/boot/vmlinuz-*-slitaz mbcd/boot
    	
  4. CDlinux

    Copy the “bzImage” and the “initrd” from /mnt/tmp4/CDlinux” into “mbcd/boot/cdlinux”

    		$ mkdir mbcd/boot/cdlinux
    		$ cp /mnt/tmp4/CDlinux/bzImage \
    	             /mnt/tmp4/CDlinux/initrd  mbcd/boot/cdlinux
    		

    Then make a directory “CDlinux” inside “mbcd” and copy the directories “extra” and “settings” into it.

    		$ mkdir mbcd/CDlinux
    		$ cp -r /mnt/tmp4/CDlinux/extra \
    		        /mnt/tmp4/CDlinux/settings  mbcd/CDlinux
    		

    Copy then “lang” directory into “CDlinux/” if they are needed. When writing the config file in Phase – IV you can pass your language as the kernel parameter. CDlinux allows you to place customized packages inside the “CDlinux/local” which gets automatically detected when booting, use it if needed.

  5. DSL

    Now time for DSL, mounted on “/mnt/tmp5″.
    Copy “linux24″ and “minirt24.gz” files from “/mnt/tmp5/boot/isolinux” to “mbcd/boot/dsl”.

    	$ mkdir mbcd/boot/dsl
    	$ cp /mnt/tmp5/boot/isolinux/linux24 \
    	        /mnt/tmp5/boot/isolinux/minirt24.gz  mbcd/boot/dsl
    	

    DSL searches the cloop file (knoppix compressed loopback file system) in “KNOPPIX/KNOPPIX” path by default. We will relocate it and keep it in directory “dsl/” instead of the default, because if you decide to keep multiple knoppix based os, which have same cloop file name and path, you need to keep the cloops in different directories with different names (name of distro). If the cloop path is altered the change must be informed by passing a boot parameter while booting (discussed later). Copy the KNOPPIX cloop file from “/mnt/tmp5/KNOPPIX/KNOPPIX” and place it into “mbcd/dsl”

    	$ mkdir mbcd/dsl
    	$ cp -r /mnt/tmp5/KNOPPIX/KNOPPIX  mbcd/dsl
    	
  6. GeeXboX

    Copy “vmlinuz”, “initrd.gz” and the “splash.png” file from “/mnt/tmp6/GEEXBOX/boot” into “mbcd/boot/geexbox”.

    	$ mkdir mbcd/boot/geexbox
    	$ cp /mnt/tmp6/GEEXBOX/boot/vmlinuz \
    	     /mnt/tmp6/GEEXBOX/boot/initrd.gz \
    	     /mnt/tmp6/GEEXBOX/boot/splash.png  mbcd/boot/geexbox
    	

    Then copy the whole “/mnt/tmp6/GEEXBOX” directory into the root of our image and remove the “boot” directory inside “mbcd/GEEXBOX” as we have moved all needed stuffs in “mbcd/boot”. (Chmod needed, dir has permission 444)

    	$ cp -r /mnt/tmp6/GEEXBOX mbcd/
    	$ chmod -R u+w mbcd/GEEXBOX
    	$ rm -rI mbcd/GEEXBOX/boot
    	
  7. GoblinX mini

    Copy “vmlinux” and “initrd.gz” of GoblinX from “/mnt/tmp7/boot” into “mbcd/boot/goblinx”.

    	$ mkdir mbcd/boot/goblinx
    	$ cp /mnt/tmp7/boot/vmlinuz \
    	        /mnt/tmp7/boot/initrd.gz  mbcd/boot/goblinx
    	

    Then copy the “/mnt/tmp7/goblinx” directory into “mbcd/”.

    	$ cp -r /mnt/tmp7/goblinx mbcd/
    	
  8. Note: GoblinX is now have become ImagineOS (site: http://www.imagineos.com.br/) . GoblinX mini (and others) could be still found in the internet. Try This link . This subsection is kept intact.

That ends the copying of files for the seven oses.

Phase – III: Making Boot Directory

Now we will install the boot files which are needed to make the ISO file or the USB bootable. We can use either the GRUB bootloader or the SYSLINUX bootloader. Installation of both GRUB and SYSLINUX are described. In Phase – V we will either use GRUB or SYSLINUX to make the CD ISO image bootable. (though both the bootloader files can recide in the image without conflicts).

  1. Installing GRUB

    We will now copy grub boot files with which we will make the ISO image bootable. Make a directory named “grub” under “mbcd/boot/”

    	$ mkdir mbcd/boot/grub
    	

    To boot from CD GRUB needs a special image for loading the stage two. You need the ‘stage2_eltorito’ file. If you have got GRUB installed in your system then execute any one of below commands and note the path.

    	$ locate stage2_eltorito
    	

    or

    	$ rpm -ql grub | grep stage2_eltorito
    	

    Else download the GRUB source, compile it and get the eltorito image.
    I am assuming you have the “stage2_eltorito” under “/eltorito_dir” which represents the absolute path of the location of the “stage2_eltorito” file in your system. Copy the file “stage2_eltorito” into “mbcd/boot/grub”

    	$ cp /eltorito_dir/stage2_eltorito  mbcd/boot/grub/
    	

    Note: The grub files needed to to be copied to boot from USB are described in Phase – VI section [2]

  2. Installing SYSLINUX

    To install the syslinux two files are needed, the “isolinux.bin” needed to make the image bootable, and the “vesamenu.c32″ needed to enable graphical menu system. If you do not want the graphical menu system then you can omit “vesamenu.c32″ .
    If you have syslinux installed previously then run one of the below and note down the paths:

    	$ locate vesamenu.c32 isolinux.bin
    	

    or

    	$ rpm -ql syslinux | grep vesamenu.c32 &&  rpm -ql syslinux | grep isolinux.bin
    	

    Else If you do not have syslinux, install it with yum:

    	# yum -y install syslinux
    	

    Or download the source from syslinux official site, extract and “make” it, but don’t install (if you want to avoid installation), ie. only execute ‘./configure && make’ . Get the needed files from the source directory.

    After you have located or installed the needed files for SYSLINUX, Make a directory inside the “mbcd/boot/isolinux”, and copy “isolinux.bin” and “vesamenu.c32″ from the location of your system into “mbcd/boot/isolinux”

    	$ mkdir mbcd/boot/isolinux
    	$ cp /path_to/vesamenu.c32 \
    	        /path_to/isolinux.bin  mbcd/boot/isolinux
    	

    Shortcut: To avoid downloading and compiling syslinux or grub, just copy the “isolinux.bin” and “vesamenu.c32″ for syslinux and “stage2_eltorito” file from any of the distro’s boot directory and continue to the next step.

Phase – IV: Making the Configuration File

    The previous phase sets the boot-loader files, now we need to tell the boot-loader which OS to boot. We also need a menu from where the user can select an OS to boot; we need a configuration file. Syntax differ in GRUB and SYSLINUX. To know about config file syntax use the man pages. Say ‘info syslinux‘ and ‘info grub‘ . Some Oses need different boot parameters to be passed for USB and CD versions. We will present the configuration files for the liveCD version in section 1 (GRUB) and 2 (ISOLINUX) below, after that in section 3 we will describe the modifications needed to the liveUSB version.

  1. GRUB Configuration File

    The GRUB configuration file will have three lines for each OS entry. The first line “label text” displays the ‘text’ in GRUB menu. The second line we specify the “kernel” of the OS to be loaded, and pass the needed boot parameters. In the third we point the initial ramdisk through “initrd” command associated with the kernel. You can add more than one entry for each distro each using a OS specific boot parameter, or write the parameters in a text file and display it when some key is pressed or use other ways to display text parameters. Check the manual pages. Everyone would like to add a cool boot screen to the “Multi Boot CD”. Make an image with GIMP or download one, say ‘splash.jpg’. To make it ready for GRUB keep it inside “work_dir” then execute:

    		$ convert -colors 14 -depth 8 -resize 640x480! splash.jpg  splash.xpm.gz
    		

    The above command transforms the image into 640×480 size, 14 colors xpm, compress it in a gzip file “splash.xpm.gz”, which grub can display. Move this into “mbcd/boot/grub” . The ‘convert’ program is a component of ImageMagick. If you don’t have it, install it first from your distro’s repository or from source.

    		$ cp splash.xpm.gz  mbcd/boot/grub
    		

    Use the above command to copy the boot image into the “mbcd/boot/grub” directory

    Shortcut: Download ready-made GRUB loadable format image from internet.

    In the configuration file add the below line to load it.

    		splashimage=/boot/grub/splash.xpm.gz
    		

    Now we present the boot configuration file for GRUB.

    		splashimage=/boot/grub/splash.xpm.gz
    
    		title Austrumi
    		#uncomment the below line for liveCD
    		kernel /boot/austrumi/bzImage dolivecd
    		#uncomment the below line for liveUSB
    		#	kernel /boot/austrumi/bzImage dousb
    		initrd /boot/austrumi/initrd.gz
    
    		title Puppy
    		#uncomment the below line for liveCD
    		kernel /boot/puppy/vmlinuz pmedia=cd
    		#uncomment the below line for liveUSB
    		#	kernel /boot/puppy/vmlinuz pmedia=usbflash
    		initrd /boot/puppy/initrd.gz
    
    		title CDlinux
    		kernel /boot/cdlinux/bzImage quiet
    		initrd /boot/cdlinux/initrd
    
    		title Slitaz
    		kernel /boot/slitaz/bzImage rw root/dev/null vga=normal
    		initrd /boot/slitaz/rootfs.gz
    
    		title DSL
    		#uncomment the below line for liveCD
    		kernel /boot/dsl/linux24 ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 knoppix_dir=dsl nomce noapic quiet BOOT_IMAGE=knoppix
    		#uncomment the below line for liveUSB
    		#	kernel /boot/dsl/linux24 ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 knoppix_dir=dsl nomce noapic fromhd quiet BOOT_IMAGE=knoppix
    		initrd /boot/dsl/minirt24.gz
    
    		title GeeXboX
    		#uncomment the below line for liveCD
    		kernel /boot/geexbox/vmlinuz root=/dev/ram0 rw rdinit=linuxrc boot=cdrom lang=en remote=atiusb receiver=atiusb keymap=qwerty splash=silent vga=789 video=vesafb:ywrap,mtrr hdtv quiet
    		#uncomment the below line for liveUSB and replace the UUID value with your device UUID
    		#	kernel /boot/geexbox/vmlinuz root=/dev/ram0 rw rdinit=linuxrc boot=UUID=0196-F5B5 lang=en remote=atiusb receiver=atiusb keymap=qwerty splash=silent vga=789 video=vesafb:ywrap,mtrr hdtv quiet
    		initrd /boot/geexbox/initrd.gz
    
    		title GoblinX
    		kernel /boot/goblinx/vmlinuz vga=791 ramdisk_size=6666 root=/dev/ram0 rw load=Muser locale=english splash=silent changes=/goblinx/ run.f
    		initrd /boot/goblinx/initrd.gz
    		

    Go through it and check how the paths are changed. Just make sure that each absolute path within the CD (considering mbcd directory is the root) are valid and points to the correct kernel and ramdisk file.
    Get the above file typed in and save it with the name “grub.conf” inside “mbcd/boot/grub”, so that “mbcd/boot/grub/grub.conf” is accessible. (The lines starting with ‘#’ are comments and needed for a live USB. This is discussed later)

  2. ISOLINUX Configuration File

    Similarly, just change some syntax of the above GRUB file we can make the “isolinux.cfg” and save it inside “mbcd/boot/isolinux”. The “isolinux.cfg” file for SYSLINUX is shown below. (The lines starting with ‘#’ are comments and needed for a live USB. This is discussed later)

    	F1 list.msg
    	DEFAULT vesamenu.c32
    	PROMPT 0
    	DISPLAY list.msg
    	MENU BACKGROUND splash.jpg
    
    	LABEL austrumi
    	MENU LABEL Austrumi Linux
    	#uncomment the below line for liveCD
    	KERNEL /boot/austrumi/bzImage dolivecd
    	#uncomment the below line for liveUSB
    	#	KERNEL /boot/austrumi/bzImage dousb
    	APPEND initrd=/boot/austrumi/initrd.gz
    
    	LABEL puppy
    	MENU LABEL Puppy Linux
    	#uncomment the below line for liveCD
    	KERNEL /boot/puppy/vmlinuz pmedia=cd
    	#uncomment the below line for liveUSB
    	#	KERNEL /boot/puppy/vmlinuz pmedia=usbflash
    	APPEND initrd=/boot/puppy/initrd.gz
    
    	LABEL cdlinux
    	MENU LABEL CDlinux
    	KERNEL /boot/cdlinux/bzImage quiet
    	APPEND initrd=/boot/cdlinux/initrd
    
    	LABEL slitaz
    	MENU LABEL Slitaz
    	KERNEL /boot/slitaz/bzImage rw root/dev/null vga=normal
    	APPEND initrd=/boot/slitaz/rootfs.gz
    
    	LABEL dsl
    	MENU LABEL Damn Small Linux
    	#uncomment the below line for liveCD
    	KERNEL /boot/dsl/linux24 ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 knoppix_dir=dsl nomce noapic quiet BOOT_IMAGE=knoppix
    	#uncomment the below line for liveUSB
    	#	KERNEL /boot/dsl/linux24 ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 knoppix_dir=dsl nomce noapic fromhd quiet BOOT_IMAGE=knoppix
    	APPEND initrd=/boot/dsl/minirt24.gz
    
    	LABEL geexbox
    	MENU LABEL GeeXBoX
    	#uncomment the below line for liveCD
    	KERNEL /boot/geexbox/vmlinuz root=/dev/ram0 rw rdinit=linuxrc boot=cdrom lang=en remote=atiusb receiver=atiusb keymap=qwerty splash=silent vga=789 video=vesafb:ywrap,mtrr hdtv quiet
    	#uncomment the below line for liveUSB and replace the UUID value with your device UUID
    	#	KERNEL /boot/geexbox/vmlinuz root=/dev/ram0 rw rdinit=linuxrc boot=UUID=0196-F5B5 lang=en remote=atiusb receiver=atiusb keymap=qwerty splash=silent vga=789 video=vesafb:ywrap,mtrr hdtv quiet
    	APPEND initrd=/boot/geexbox/initrd.gz
    
    	LABEL goblinx
    	MENU LABEL GoblinX Linux
    	KERNEL /boot/goblinx/vmlinuz vga=791 ramdisk_size=6666 root=/dev/ram0 rw load=Muser locale=english splash=silent changes=/goblinx/ run.f
    	APPEND initrd=/boot/goblinx/initrd.gz
    	

    Now copy the .jpg image with 640×480 size, say ‘splash.jpg’, into “mbcd/boot/isolinux” directory. SYSLINUX can load .jpg images directly without any modification (with “vesamenu.c32″ module).

    	$ cp splash.jpg  mbcd/boot/isolinux
    	

    If you decided to not include “vesamenu.c32″ module then you can always have text menu. Without “vesamenu.c32″, the ‘MENU’ keywords won’t be recognized and no graphical menu will be displayed. It will show an error and fallback to text mode showing prompt “boot:” asking for an OS label. Just enter the label of the OS (beside the “LABEL” field) which you want to boot and press enter. To avoid memorizing the LABEL names, write a plain text file containing the OS name list and their corresponding label names and save it inside “mbcd/boot/isolinux” as “list.msg”. It is printed on screen at boot time by “DISPLAY list.msg”. The line “F1 list.msg” displays the “list.msg” file whenever you press F1.
    An example of “list.msg” is below

    	To boot the Operating System
    	type in the corresponding keyword in the prompt
    	and press enter
    	@~~~~~~~~~~~~~~~~~~~~~~~+~~~~~~~~~~+
    	| Operating System Name | Keyword  |
    	+-----------------------+----------+
    	| Austrumi Linux        | austrumi |
    	| Puppy Linux           | puppy    |
    	| CDlinux               | cdlinux  |
    	| Slitaz                | slitaz   |
    	| Damn Small Linux      | dsl      |
    	| GeeXboX               | geexbox  |
    	| GoblinX               | goblinx  |
    	+-----------------------+----------+
    	
  3. Configuration Changes for liveUSB

    In Phase – VI we will describe how to make a bootable liveUSB with SYSLINUX and GRUB. If you are making a multiboot liveUSB only then make the following changes to the configuration file (GRUB or SYSLINUX).

    For Austrumi: replace ‘dolivecd’ with ‘dousb’
    For Puppy replace ‘pmedia=cd’ with ‘pmedia=usbflash’.
    For DSL append ‘fromhd’ boot parameter in the kernel line.
    For GeexBox you need to specify the UUID of your USB device. To get the UUID of your USB partition execute the following:

    		# blkid /dev/sdXy
    		

    and note down the value of the ‘UUID’ field. In my case the command was ‘blkid /dev/sdb1′ and the UUID was ‘0196-F5B5′. Now pass the UUID by appending the below to the kernel line
    ‘boot=UUID=<your_uuid>’.

    For ease, the configuration files contains the changed liveUSB lines (commented). Just comment the line for liveCD and un-comment the line for liveUSB to achieve the change.

Phase – V: Making the ISO Image and Burning

Recheck the “mbcd/” for errors, check if all the path to the configuration files are valid check if all the files are copied, remove unnecessary files. (like backup files ending with tilde “~”).
We will use mkisofs to make the iso image.

  • Run the below command if you are making a GRUB bootable image.

    $ mkisofs \
    	  -iso-level 3 \
    	  -R \
    	  -J \
    	  --input-charset=utf8 \
    	  -b boot/grub/stage2_eltorito \
    	  -c boot/boot.catalog \
    	  -no-emul-boot \
    	  -boot-load-size 4 \
    	  -boot-info-table \
    	  -o mbcd.iso mbcd
    
  • If you want to make the ISO image to boot with ISOLINUX then you need point to the “isolinux.bin” boot image.

    $ mkisofs \
    	  -iso-level 3 \
    	  -R \
    	  -J \
    	  --input-charset=utf8 \
    	  -b boot/isolinux/isolinux.bin \
    	  -c boot/boot.catalog \
    	  -no-emul-boot \
    	  -boot-load-size 4 \
    	  -boot-info-table \
    	  -o mbcd.iso mbcd
    

Now burn it into a CD-R with your favorite burner. Burning into a CD-RW will enable you to re-burn updated images. Burn the CD as multi-session disk. To do this in k3b, click Tools->Burn CD Image select the image to burn, click the ‘Advanced’ tab and check the ‘Start multisession CD’ box. Thus the distros which support saving sessions in the CDs can use the remaining space to save the sessions too. If you have added more distros and stuffs that goes beyond a CD capacity, then burn it in a DVD-R or DVD-RW.

Tip: Test the iso file in virtual machine before you burn.

Phase – VI: Making the Swiss Knife

Now we will convert your USB flash drive in a GNU+Linux powered home made Swiss knife with 7 flavors.
We will describe how to make your USB drive bootable with both SYSLINUX and GRUB. Though this process is not destructive, still backup all of your data is always recommended (See “Notes on USB Booting”). First copy all the contents of “work_dir/mbcd/” into the USB drive partition.

$ cp -r mbcd/*  /media/disk/

Then install GRUB or SYSLINUX bootloader and set the boot flag, as described below.

  1. Installing SYSLINUX

    In the USB drive rename the directory “isolinux/” to “syslinux/”, rename “isolinux.cfg” to “syslinux.cfg” and “isolinux.bin” to “syslinux.bin” in the drive. Assuming your USB drive is mounted in “/media/disk” execute:

    	$ mv /media/disk/boot/isolinux  /media/disk/boot/syslinux
    	$ mv /media/disk/boot/syslinux/isolinux.cfg  /media/disk/boot/syslinux/syslinux.cfg
    	$ mv /media/disk/boot/syslinux/isolinux.bin  /media/disk/boot/syslinux/syslinux.bin
    	

    Now install SYSLINUX in the USB drive’s partition where you have the boot directory:

    	# syslinux -sd boot/syslinux  /dev/sdXy
    	

    If the USB drive partition is /dev/sdb1 (which have the boot directory). Then the above command would be:

    	# syslinux -sd boot/syslinux/  /dev/sdb1
    	

    This will alter the MBR by installing the boot code and installs ‘ldlinux.sys’ in the partition.

  2. Installing GRUB

    The shell script ‘grub-install ‘ will be used to do this job. The below command installs GRUB in both MBR and te partition.

    	# grub-install --root-directory=/media/disk /dev/sdX
    	

    The directory “/media/disk” should point to the mount point of your USB partition. This will install the boot code in MBR and install the stage1.5 and stage2 into the partition and set the configuration file.

    If it tells that “dev/sdX does not have any corresponding BIOS drive.” then the usb drive is not yet mapped by grub in the device.map file. To map it either use the --recheck flag with the above command or create a file inside boot/grub of your usb drive and then re-execute gurb-install . Read this post Installing GRUB Bootloader to get a better description.

  3. Set the boot flag

    Unmount the USB partition, and make the USB partition bootable by setting the boot flag with ‘parted‘ or ‘fdisk‘ or any partition manager

    • To use the ‘parted‘ tool follow the below directions:
      	# umount /dev/sdXy
      	# parted /dev/sdX set y boot on
      	

      For example if your USB drive partition be /dev/sdb1 (containing the boot dir). Then the above commands would be:

      	# umount /dev/sdb1
      	# parted /dev/sdb set 1 boot on
      	
    • The process of setting the bootflag with ‘fdisk‘ is as below:

      	# fdisk /dev/sdXy
      	

      Enter ‘p‘ in the ‘fdisk‘ prompt. If you see “*” beside the disk partition under the boot column then the partition is already bootable, simply enter ‘q‘ to quit. Else to make it bootable: Enter ‘a‘ then, when asked, enter the partition number and press enter (if your drive’s partition is /dev/sdb1 then enter ‘1‘ as the partition number). Enter ‘p‘ again to check and then ‘w‘ to write the changes.

  4. Modify Configuration File

    After you have installed either GRUB or SYSLINUX make the changes in the configuration file as described in Phase – IV section [3].

Phase – VII: Cleanup

    Now we will cleanup the mess we created. Notice that the working directory has grown to a huge size, because you have three copies of each OS in it (the original ISO, the extracted files, files inside the mbcd.iso) . We will dispose the “work_dir” excluding the “mbcd.iso” (obviously). Move the “mbcd.iso” one depth up the directory tree, get out of “word_dir” (for the first time) and remove it. Then unmount all the mounted iso images, remove the mountpoint directories.
    	$ mv mbcd.iso ..
    	$ cd ..
    	# rm -rI work_dir
    	# umount /mnt/tmp?
    	# rmdir /mnt/tmp?
    	

    To add, modify or change mbcd image you don’t need to mount all those distros again, just extract “mbcd.iso”, make edits, and repack it to an ISO, or use ISOmaster.

    Congratulations you have just rainbow colored your USB drive and CD !

Adding More Than One Knoppix Based Distro

All knoppix based live distros has a compressed file system, the cloop file in the same location and same name “KNOPPIX/KNOPPIX”. So no more than 1 knoppix based distro can reside in a media. To keep more than one knoppix based distro in a media, the cloop files of the different distros should be kept in different directories or with different name. After you change the cloop file’s path you need to pass it with the boot parameters shown below.

knoppix_dir=
<path to dir containing the cloop file with leading "/">
knoppix_name=<name of the cloop file>

For example we have kept the dsl cloop file in “dsl/” directory, so we have passed ‘knoppix_dir=dsl/’. If the name of the cloop file is changed then you also need to append “knoppix_name=newname” as the kernel parameter. An example for GRUB is shown below. Only changing directories are recommended.

kernel /boot/dsl/linux24 knoppix_dir=dsl/ knoppix_name=newname

Some Notes

To boot from a USB drive you need to plug it in and make sure that your mother board will boot first from that drive. Consult your mother board manual to change boot order. If still it does not boot then check if your motherboard supports booting from USB. Similarly to boot from a CD you need to make your system to boot from the CD drive first.

About Eltorito: El Torito is a specification that says how a CD-ROM should be structured so it can be booted directly. It works by making the CD drive appear to be a normal floppy drive. Thus a bootable floppy image is put in any location inside the CD-ROM file hierarchy and a pointer to that location is placed in the CD ISO header, which is used by the BIOS to load the image from the location in the CD and then works as if it was booted from a floppy drive. When we burn the image we point the location of the bootable floppy image that is the ‘stage2_eltorito’ with the ‘-b’ flag, and then the location pointer of the image is then stored in the header.

About MBR: The Master Boot Record or the boot sector consists of 512bytes and it resides at the beginning of the disk the first sector. The first 446 bytes is reserved for the boot code. The boot code needs to be installed in order to make the BIOS boot from this drive. The next 64bytes contains the partition table. Each partition is described with 16 bytes, so the disk can contains 4 primary partitions. The last to bytes contains the signature.

The ‘syslinux’ command installs the boot code into the drive, but for one case in a compaq system it failed to boot from the USB drive. Installing the boot code manually resolved this problem as described below.

SYSLINUX supplies a sample MBR, the ‘mbr.bin’ file, which can be used to overwrite the MBR boot code. To do this first locate ‘mbr.bin’ in your system and execute:

# dd if=/path/to/mbr.bin of=/dev/sdX

To clear the boot code section of MBR execute the below command:

# dd if=/dev/zero of=/dev/sdX bs=440 count=1

Above only the first 440 bytes of the boot code portion is cleared. This is because the last 6 bytes are used for some other purposes in some systems (4 bytes disk signature + 2bytes unused), so it is safer to clear only the first 440 bytes instead of 446 bytes

It is recommended to backup your boot sector along with your files before making the USB bootable. To backup the boot sector (MBR) execute and preserve the created ‘usb_mbr_bak’ file

# dd if=/dev/sdX of=usb_mbr_bak bs=512 count=1

to restore the MBR execute below command:

# dd if=usb_mbr_bak of=/dev/sdX

Last Words

A multi booting media is always popular, especially when it has a collection of great mini distros. Now when we have booted a CD/DVD and a USB drive why not we do the same with an internal HDD. This can be done exactly as we did for the USB drive. Keep the OS files in the root of a drive and make sure all the locations are correct in the config file, then make the HDD bootable with GRUB or SYSLINUX, and load the configfile for menu, and if GRUB or syslinux is already installed then it is already done you just need to call the configuration file with configfile command from grub shell. Nothing more i will say about this and i will leave this to you to work out and make a multibooting single partition HDD.

Note: Please play safe, because sometimes you only come to know about the loss when you restart the system the next morning and stand shocked in front of your system.

Downloads

I am linking to the archive file containing all the used configuration files and image files used in this process.

Click Here To Download The Configuration and Image Files Used In The Above Process

Screenshot

Multi Boot Live CD Splash Screen

Multi Boot Live CD Splash Screen

Links and References

Official Websites
Related
References
  • GRUB man pages
  • SYSLINUX man pages

Update Information

31.01.2010 : GRUB installation on USB from GRUB shell added. Please feedback
13.04.2011 : Minor restructure and typo fix.


First Publish Information : This article was first published on Linux For You (LFY), August 2009 Issue, under Creative Commons Licence. Link: http://www.linuxforu.com/how-to/create-multiboot-discs/

Click Here To Read The Printed Edition in LinuxForU.com

Author: Arjun Pakrashi

Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.

About phoxis

Homo-sapiens
This entry was posted in GNU+Linux+FOSS, Tutorials and tagged , , . Bookmark the permalink.

11 Responses to Making a Multi Booting CD DVD USB

  1. Adam says:

    Amazing article! good work!

  2. zack says:

    Is there a way to add bootable cds that don’t use isolinux or grub? (bartpe, dban, windows install disc, etc.)

  3. phoxis says:

    @zack Have a look at the below links and see if the direct mapping helps. Although this is not guaranteed to work in all the BIOSes

    http://diddy.boot-land.net/grub4dos/files/map.htm

    http://grub4dos.sourceforge.net/wiki/index.php/Grub4dos_tutorial#Direct_mapping

    I have never tried booting from an ISO image with GRUB4DOS , i think you should have a try.

  4. hrishi says:

    good work pal

    can do it with
    linux mint 8
    ophcrack-vista-livecd-2.1
    ophcrack-xp-livecd-2.1
    slax-6.1.0
    ubuntustudio-9.04
    pclinuxos-minime-kde3-2009.1.iso

    must have answer for another kolkatian

    • phoxis says:

      This guide was made to compile all the mini distros. I cannot tell anything about XP or any windows stuff, but the slax, mint or others can be done easily, what you have to do is just see how the files are located in the original LiveCD , or else as i have told in the article, check the docs, kernel parameters, forums, and if possible see the loading script, and you will come to know what are the exact needs of that distro and what you have to do is to configure your multiboot media in that format. Once you understand one format it is almost the same for others. And for the password crackers, CDlinux has got the Offline NT Password and Registry editor, the chntpw program, you can reset passwords with that too. Let me know if you are able to compile the above stuffs.

  5. Nice post..Keep them coming :) Thanks for sharing.

  6. Nix says:

    Hi,

    thank you for this nice How-to.
    I thought about combining multiple small live cds in one usb live system with a nice menu etc for quite some now, especially since i have a new Subnetbook with no optical drive. Because i use tools like gparted, clonezilla, Super Grub disc etc. quite frequently, all of them around 100-150Mb and even less, i hoped to achieve this following your nice guide.
    Unfortunately i had no luck, neither the grub nor the syslinux way.
    Grub simply refuses to install to the mbr “/dev/sdb does not have any corresponding BIOS drive.”
    And although i created a decent syslinux.cfg with the correct path information and used the adviced steps in Phase VI i can’t make it work. I can see and use my created menu, but all boot attempts get stuck when it comes to probing for the hdd’s long after the kernel images have been loaded. All individual live usb images are working.
    I am also kinda stuck now…
    Do you have an idea what might be causing this?

    Thank you and good bye

    • phoxis says:

      Are you trying to boot the LiveCD ISO images itself ? Then they will not work like this. Or else if you have extracted the kernels and the initrds in the proper location, then are the other files in the correct position so that the LiveCD’s scripts could find then in place. Chek Phase – II . When creating syslinux.cfg you entered correct paths, but did you include proper kernel parameters which they need? They could be found in the configuration files of the LiveCDs, check them for which image’s kernel need which parameter. If you change the location of the other files of a certain LiveCD relative to the root of the USB, then you might need to pass the new changed location as a kernel parameter in order to make the scripts find them.
      I would suggest you to first download some mini distro ISOs, and try putting them in your USB drive on by one. Extract one mini disttro put it in the proper places as the guide describes, and check if it works. Then try another. This will make sure things are going fine at your end.
      For the grub matter, it does not have the bios drive mapped to your usb device. You can do it manually.
      First make a file “myusb” (without quotes) inside the root of your USB drive. I assume the path of this file is /mnt/disk/myusb , change as needed.
      Copy GRUB files in your usb

      cp /boot/grub/*stage* /media/disk/boot/grub

      Go into superuser, and then execute:

      grub

      now find this file and locate the bios drive

      find /myusb

      you will get an output in the format (hd?,?) where the ‘?’ s are numbers, replace then as per your output. Now set this as root and setup GRUB in MBR

      root (hd?, ?)
      setup (hd?)

      this should install GRUB.
      I have updated the post with these information.

      Please let me know if this helps, and what exactly the problem you are facing. Thanks for the great feedback.

  7. Pingback: Booting GNU/Linux from USB - Page 2

  8. Pingback: Creare un DVD, un CD o USB Multiboot « maurizio siagri

  9. Pingback: MultiCd per creare CD e DVD Multiboot in Linux | maurizio siagri

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s