Linux Boot Media

How to Create Bootable Media

These are just some preliminary notes - still working on it . See also DAS BOOT - about creating bootable media.

Bootable Linux CD's

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.

Contents of a Debian Etch netinst.iso

the isolinux system : files required to make the cd bootable + boot options
linux kernel (debian installer kernel) and other files needed to run the installer after booting the CD. :
config files for installer ?
-- "payload" --
symlink to . (cd root), part of the repository url (a la deb http:// ... /debian/ ... ... )
partial debian mirror / software repository. contains software that you can install during setup
system files for debian mirror
misk tools, probably to create boot floppies on Windows. not necessary
tools to create "smart boot manager" floppies, a workaround for systems that can't boot from CD directly
logo and graphic elements - not required

Getting started

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 :

You now have a working directory with the contents of the original iso, and we can start to work on them

Creating a customized unattended installation

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 the preseed.file

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

more about preseeding

modify isolinux.cfg

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.

Create the iso file

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/ ~/bootdisktest/newiso

Customizing the payload

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

Advanced topics

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.

Other Tools for CD remastering and Customization

Koen Noens
April 2008