These are just some preliminary notes - still working on it . See also DAS BOOT - about creating bootable media.
Bootable CD's on Linux can be either Linux Operating systems installed on a CD (a so-called "Live CD"), quite similar to running an operating system (Linux, MS-DOS) of a floppie disk, and installation CD's. Although it is possible to use floppy disk emulation or hard disk emulation to achieve this, most Linux CD's use syslinux or isolinux to accomplish this. syslinux/isolinux is a special, small linux system that can boot of just about any media. This is used as a 'boot loader' to boot a normal Linux system (Live CD), or to boot a special "installer kernel" to run an operating system setup procedure.
A syslinux system consists of a kernel (isolinux.bin) and a configuration file (isolinux.cfg) where you manage boot options. Besides that, you need a minimal system that consists of the linux kernel you want to boot, an initrd (contains files that are required by the system before it has access to the actual filesystem), and a root filesystem (additional system files + the "payload" of your system, e.g. a software repository in case of an installation disk. To create your own bootable Linux media, you can build something from scratch around isolinux, or start from an existing CD and modify it. The latter is often easier, if you can start of an existing boot CD that is quite close to what you want to achieve.
To illustrate this, we will take a Debian net install CD, and customize it so that it installs a minimal system with a lightweight window manager and a package manager (like this). The idea is that we setup a GUI system with nothing but a package manager, allowing the user to install additional software afterwards. We'll also try to do the same with an Ubuntu installer disk.
You can not modify files on a CD or iso-image directly, so you'll need to copy them to your hard disk, modify them, and create a new iso image or CD afterwards. Here are the first steps :
mount -o loop -t iso9660 ../debian-40r0-i386-netinst.iso /mnt/iso
cd ~/bootdisktest/ ; mkdir newiso ; cd newiso cp -pr /mnt/iso/install.386 install.386 cp -pr /mnt/iso/isolinux isolinux ## payload cp -pr /mnt/iso/.disk .disk cp -pr /mnt/iso/pool pool cp -pr /mnt/iso/dists dists ln -s . debian # make files writable (files from an iso are read-only) chmod -R o+w ~/bootdisktest/newiso
You now have a working directory with the contents of the original iso, and we can start to work on them
You can use preseeding and boot options to create a custom unattended install. What we want is a basic system (command line only), then add a window system and some selected software, to achieve a system that offers a gui and a package manager to let the end user set up a desktop system according to his/her needs (like this). We will put a preseed file on the CD, and use isolinux.cfg to pass boot options (a.o. the location of the preseed file) to the linux kernel. Because we're aiming for a gui system, we'll modify isolinux.cfg to make the default boot a gui install.
create preseed.cfg text file in ~/bootdisktest/newiso/options. We use an 'options' directory to keep the cd image a bit organized. The content of the preseed file could be something like this". Apart from some sensible defaults to make the installation run unattended, note
# Individual additional packages to install d-i pkgsel/include string xorg xfce4 synaptic update-notifier menu
#tasksel : don't install anyting d-i tasksel/first multiselect tasksel tasksel/first multiselect tasksel tasksel/tasks multiselect
xserver-xorg xserver-xorg/autodetect_monitor boolean true xserver-xorg xserver-xorg/config/monitor/selection-method select medium
more about preseeding
set the default option to installgui, : DEFAULT installgui
and edit the corresponding installgui label to include a reference to your preseed file. You can also add boot options for eg language and keyboard, because the installer will want to know about them before the preseed file is read.
LABEL installgui kernel /install.386/vmlinuz append video=vesa:ywrap,mtrr vga=788 initrd=/install.386/gtk/initrd.gz preseed/file=/cdrom/options/preseed.cfg --
You may want to set ' TIMEOUT 0 ' and /or edit the isolinux txt files so that the information you give to the user corresponds to the changes you made. the isolinux txt files contain content that is shown to the user.
Because you've altered files on the CD, the checksums of those files have changed so you need to create a new checksum file :
.../newiso:# md5sum `find ! -name "md5sum.txt" ! -path "./isolinux/*" -follow -type f` > md5sum.txt
next, you create the iso file, which you can load in a virtual machine or burn to a disk :
.../newiso:# mkisofs -o ../custom_install.iso -r -J -no-emul-boot -boot-load-size 4 -boot-info-table -b isolinux/isolinux.bin -c isolinux/boot.cat ~/bootdisktest/newiso
We've included additional package to the defaylt installation, but these haven't been added to the repository (pool directory). Since we've used a net install CD, these will be automatically downloaded. It is, however, possible to add them to the CD :
To find out which package you need to include any given program, use dpkg -S with the name of the program, e.g.
~# dpkg -S /usr/bin/software-properties update-manager: /usr/bin/software-properties
An advanced approach would be to not just modify isolinux.cfg and the payload of the CD, but to actually modify (or create) the Linux kernel, initrd (and root file system) of the system your planning to boot. This allows you to fully customize the system you're booting and create your own specialized setup or live OS CD's.