How to boot several CD iso files in a DVD
------Edited 22/8/07 I used the same idea to boot the 7 iso off a USB pen drive and reported it in Post #5-------------------
I wrote this thread because someone asked if it is possible to do such thing in another forum. I think it can be done, tried it out and documented result in JustLinux.
Steps at a glance
(1) Open a directory, say /iso.
(2) Mount each iso file on a loop back device and copy its content to /iso directory
(3) Copy Grub's stage2_eltorito into /iso directory
(4) Write a Grub menu using the isolinux.cfg from each iso file
(5) Use bash command mkisofs to create a large iso file from /iso directory
(6) Burn the large iso file into a DVD using K3B
Warning
Not every iso is suitable to co-exist with others in a DVD. This is because they may use the same directory names.
A little bit of theory
Among about 95% of Linux iso meant to be booted from a CD or DVD will have the de facto boot loader called isolinux, written by Peter Anvin. It has a configuration file called isolinux.cfg. The isolinux syntax is very similar to Grub and so one can substitute isolinux with Grub.
Isolinux can also multi-boots. I am just more comfortable with grub and know it can deliver what I want. Grub is preferred because we can communicate with Grub during boot time and correct any mistake as we go along. That is very useful with a read-only DVD. Isolinux does not offer this flexibility.
Grub has only one file for booting a CD or DVD. This file is called stage2_eltorito available in every Linux that has Grub. It is stored in /boot/grub or /grub directory. The Grub Manual has steps showing how to create a CD or DVD booted by stage2_eltorito.
Step 1
This is just a big folder for storing several iso files. The iso files have to be expanded first into the normal format first. I use an existing directory in /abit ,rounded up 7 iso files and created the following subdirectories
Code:
mkdir /abit/iso
mkdir /abit/iso/DSL-boot
mkdir /abit/iso/slax-boot
mkdir /abit/iso/mepis-boot
mkdir /abit/iso/grafpy-boot
mkdir /abit/iso/ubuntu-boot
mkdir /abit/iso/pmagic-boot
mkdir /abit/iso/systemcd-boot
for 7 distros of Damn Small Linux, Slax, Mepis, Grafpuppy, Ubunu, Parted Magic and SystemrescueCD. Their version numbers are stated in the menu.lst below.
I use “-boot” for the folder names because some distros may have their own folders using the distro own names, for example slax and pmagic.
Step 2
I wrote a script called mountiso to execute the two lines of commands
Code:
saikee@saikee-desktop:~$ cat /abit/saikee/Desktop/mountiso
umount /mnt/cdrom
mount -t iso9660 -o ro,loop=/dev/loop0 $1 /mnt/cdrom
saikee@saikee-desktop:~$
This allows me to mount any iso file by bash command, say for iso slax-6.0.0-rc5.iso
Code:
/bin/bash mountiso slax-6.0.0-rc5.iso
The Slax iso when expanded shows two directories of /boot and /slax inside
Code:
root@saikee-desktop:/abit/saikee/Desktop# ls /mnt/cdrom
boot slax
root@saikee-desktop:/abit/saikee/Desktop#
I can then copy the expanded iso file in /mnt/cdrom into the folder I created in Step-1
Code:
cp -R /mnt/cdrom/* /abit/iso/slax-boot/
I have to repeat Step-2 for each iso file.
Step-3
The folder /abit/iso will be eventually a DVD iso and so to make it bootable by Grub we must have
(a) a directory called /boot/grub
(b) statge2_eltorito inside /boot/grub
I was using an installed Ubuntu 7.04 to do the above work and so Ubuntu's /boot/grub has all the information I need. Therefore all I need to do is to copy the content of Ubuntu's /boot/grub directory into /abit/iso after creating the directories there first
Code:
mkdir /abit/iso/boot
mkdir /abit/iso/boot/grub
cp /boot/grub/* /abit/iso/boot/grub/
at this stage all the Grub files will be available as shown below
Code:
root@saikee-desktop:/home/saikee# ls /abit/iso/boot/grub
default fat_stage1_5 menu.lst~ stage1 xfs_stage1_5
device.map jfs_stage1_5 minix_stage1_5 stage2
e2fs_stage1_5 menu.lst reiserfs_stage1_5 stage2_eltorito
root@saikee-desktop:/home/saikee#
Step-4
This is by far the most difficult thing to explain. I shall only do it by example. Slax in the above is the perfect system for this type of illustration. The above information shows it has two directories of “/slax” and “/boot” so the first thing I have to do is to move the /slax directory from /abit/iso/slax-boot to /abit/iso, leaving only the /boot there for reference only. This is because when the DVD is booted the installer has been written to search only the root directory whereas the /boot directory is the one I can control by telling Grub where to find it. I can't put /boot in the root directory because many distros have /boot too.
I now show how to get the isolinux.cfg by repeating just the "ls" command going into deeper level each time.
Code:
root@saikee-desktop:/home/saikee# ls /abit/iso/slax-boot/
boot
root@saikee-desktop:/home/saikee# ls /abit/iso/slax-boot/boot
bootinst.bat bootlilo.sh dos isolinux syslinux vmlinuz
bootinst.sh chain.c32 initrd.gz mt86p vesamenu.c32
root@saikee-desktop:/home/saikee# ls /abit/iso/slax-boot/boot/isolinux
isolinux.bin isolinux.boot isolinux.cfg
root@saikee-desktop:/home/saikee# cat /abit/iso/slax-boot/boot/isolinux/isolinux.cfg
PROMPT 0
TIMEOUT 200
DEFAULT /boot/vesamenu.c32
LABEL xconf
MENU LABEL Slax Graphics mode (KDE)
KERNEL /boot/vmlinuz
APPEND vga=769 initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw autoexec=xconf;kdm
LABEL pchanges
MENU LABEL Slax Graphics mode with Persistent Changes
KERNEL /boot/vmlinuz
APPEND vga=769 initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw changes=/slax/slaxsave.dat autoexec=xconf;kdm
LABEL copy2ram
MENU LABEL Slax Graphics mode, Copy To RAM
KERNEL /boot/vmlinuz
APPEND vga=769 initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw copy2ram autoexec=xconf;kdm
LABEL startx
MENU LABEL Slax Graphics VESA mode (1024x768)
KERNEL /boot/vmlinuz
APPEND vga=769 initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw autoexec=kdm
LABEL slax
MENU LABEL Slax Text mode
KERNEL /boot/vmlinuz
APPEND vga=normal initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw
LABEL memtest86
MENU LABEL Run Memtest utility
KERNEL /boot/mt86p
root@saikee-desktop:/home/saikee#
The part of the isolinux.cfg that is of interest to me has only two lines I have highlighted in red
I now show the end result of the Grub menu, which must be stored as /abit/iso/boot/grub/menu.lst, and the red is the conversion.
Code:
root@saikee-desktop:/home/saikee# cat /abit/iso/boot/grub/menu.lst
title DSL 4.0
kernel /DSL-boot/boot/isolinux/linux24 ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 nomce noapic quiet BOOT_IMAGE=knoppix
initrd /DSL-boot/boot/isolinux/minirt24.gz
title Slax 6.0.0 rc5
kernel /slax-boot/boot/vmlinuz vga=769 ramdisk_size=6666 root=/dev/ram0 rw autoexec=xconf;kdm
initrd /slax-boot/boot/initrd.gz
title GrafPup 2.0
kernel /grafpup-boot/vmlinuz root=/dev/ram0 vga=0x312 loglevel=1 PMEDIA=idecd
initrd /grafpup-boot/initrd.gz
title Mepis 6.9.5
kernel /mepis-boot/boot/vmlinuz init=/etc/init vga=normal quiet drvr=vesa
initrd /mepis-boot/boot/initrd.gz
title SystemrescueCD 0.3.7 label fb1024
kernel /systemcd-boot/isolinux/rescuecd root=/dev/ram0 init=/linuxrc vga=791 looptype=squashfs loop=/sysrcd.dat dokeymap cdroot splash=silent splash=silent
initrd /systemcd-boot/isolinux/rescuecd.igz
title ubuntu 6.10 desktop safe ^graphics mode
kernel /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper xforcevesa ramdisk_size=1048576 root=/dev/ram rw quiet splash --
initrd /casper/initrd.gz
title Parted Magic 1.8
kernel /pmagic-boot/isolinux/bzImage noapic root=/dev/ram0 init=/linuxrc ramdisk_size=100000 skip
initrd /pmagic-boot/isolinux/initrd.gz
root@saikee-desktop:/home/saikee#
You will see I have only changed “KERNEL” with “kernel” and correctly located the where about of the kernel “vmlinuz” to be found in directory /slax-boot/boot. Remember after you have brun the DVD iso the /abit/iso front end will disappear.
The isolinux specifies the ram disk file as a parameter of the KERNEL statement with “initrd=/boot/initrd.gz” forming part of the command structure. In Grub I have separated it into a proper “initrd” statement. That is all I needed to change an iso booting with isolinux to booting with Grub. I do not touch other parameters at all.
To summarize the step of converting an iso booting from isolinux to Grub the steps are
- (i) copy the isolinux's KERNEL statement into Grub's menu.lst
- (ii) changed “KERNEL” to “kernel”.
- (iii) Adjust the directory name so that Grub can find the kernel
- (iv) remove the “initrd=xxxxx” parameter in the KERNEL statement of ioslinux.cfg and use the same as a separate “initrd” statement in Grub's menu.lst. Do not forget to remove the “=” sign and amend the partition reference.
I could have just done two iso to make the thread shorter but decided to put 7 iso files in because there are 6 examples showing how isolinux can be converted to Grub. One of the 7 has Grub already and I have shown how we could modify it too to multi-boot. The isolinux information is left at the rear of the thread in case any reader may find more information useful.
Step-5
This has to be the easiest thing in life for creating your own bootable DVD. Just follow the steps outlined in the Chapter 3.4 of Grub Manual.
I wrote a script call makeiso just to do just that
Code:
root@saikee-desktop:/home/saikee# cat /abit/makeiso
root@saikee-desktop:/abit# mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o grub.iso iso
I issue the makeiso command in directory /abit. The end product of the about command is a large iso file call grub.iso
Setp-6
To burn the grub.iso I just called up K3B and clicked the file name. The DVD, with 1.8 Gb from the 7 distros, was ready in 6 minutes. I used a re-writeable DVD.
Conclusion : I now have a DVD that boots 7 distros successfully.
The above information is also useful/sufficient for any user wanting to create his/her customized bootable CD/DVD
---------------------------------------------------------- The following information are included just for the reference purpose only --------------------------------------------------
For completeness I enclose the relevant parts of the isolinux.cfg from the other distros below. The menu.lst I wrote is already given at the above.
DSL's isolinux.cfg is in /boot/isolinux directory. Its “KNOPPIX” directory should be available in the / directory
Code:
LABEL dsl
KERNEL linux24
APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=minirt24.gz nomce noapic quiet BOOT_IMAGE=knoppix
Grafpuppy isolinux.cfg is in / directory. Its “image” directory plus all files ending with sfs should be available in the / directory
Code:
label grafpup
kernel vmlinuz
append root=/dev/ram0 initrd=initrd.gz splash vga=0x312 loglevel=1 PMEDIA=idecd
Mepis uses Grub and its menu.lst is in /boot/grub directory. Its “mepis” directory should be available in the / directory.
Code:
title Vesa (if display problem or if vmware)
kernel /boot/vmlinuz init=/etc/init vga=normal quiet drvr=vesa
initrd /boot/initrd.gz
SystemrescueCD has isolinux.cfg in /isolinux directory. Its “bootdisk” directory and sysrcd.dat should be available in the / directory.
Code:
label fb1024
kernel rescuecd
append root=/dev/ram0 initrd=rescuecd.igz init=/linuxrc vga=791 looptype=squashfs loop=/sysrcd.dat dokeymap cdroot splash=silent
Parted Magic isolinux.cfg is in /isolinux directory. Its “pmagic” file should be available in the / directory.
Code:
MENU LABEL ^1. Boot Parted Magic using the default settings
TEXT HELP
* version: 1.8, (C) 2007, Patrick Verner
* http://www.partedmagic.com
* Disclaimer: Author not responsible for any mishap caused by this software.
ENDTEXT
KERNEL bzImage
APPEND noapic initrd=initrd.gz root=/dev/ram0 init=/linuxrc ramdisk_size=100000 skip
Ubuntu is a difficult one as it has so many directories needed to be available in the / directory. I just copied everything. The isolinux.cfg is in /isolinux directory and I used only this portion
Code:
menu label ^Start or install Ubuntu
kernel /casper/vmlinuz
append file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash --
Lastly the complete content of my /abit/iso (before turning into the iso), looks like this
Code:
root@saikee-desktop:/abit/saikee/Desktop# ls /abit/iso
bin DSL-boot KNOPPIX pool sysrcd.dat vesamenu.c32
boot graf_200.sfs mepis preseed sysrcd.md5 zdrv_200.sfs
bootdisk grafpup-boot mepis-boot programs systemcd-boot
casper img pics slax ubuntu
disctree install pmagic slax-boot ubuntu-boot
dists isolinux pmagic-boot splashpm.png usbstick.htm
root@saikee-desktop:/abit/saikee/Desktop#