next up previous contents
Next: Conclusions Up: Linux Boot Loaders Compared Previous: Hard Disk Installation   Contents

CD-ROM Installation

Most Linux distributions come on a CD-ROM and there are various rescue disk images available that you can burn to a CD-ROM. In the near future, most PC's won't even have a floppy drive, so the CD-ROM is the only choice.

Most modern BIOS-es support the El Torito standard to boot from a CD-ROM. There are two different ways to boot Linux from a CD-ROM:

As soon as the Linux kernel is booted, it runs with the RAM disk as the root file system. From there it is easy to mount the CD-ROM. The CD-ROM can be filled with utilities, packages to install or whatever. In theory it is even possible to mount the CD-ROM as the root file system, but then it becomes impossible to swap disks while the system is running.

Both types of bootable CD-ROM can be created with mkisofs. The resulting ISO image can then be burnt to a CD-ROM using cdrecord or another CD writing program, even under Windows. I've tried both types using CD-RW disks.

Let's start with an emulated diskette. In the example I used the GRUB diskette, as it was already formatted at 1.44M (the image from my home page uses LILO and it should work fine too). First create a directory tree for the ISO image.

mkdir iso
mkdir iso/boot
mkdir iso/data
Next copy some files to the data subdirectory and copy the diskette to the boot directory.
cp somefile iso/boot/data
dd if=/dev/fd0 of=iso/boot/boot.img
Now create the ISO image.
mkisofs -o emuboot.iso -b boot/boot.img \ 
        -c boot/boot.catalog -r iso
Finally burn it to a CD-ROM. Use the appropriate device ID.
cdrecord dev=0,1,0 -eject -pad -data emuboot.iso

This CD is bootable and from the booted Linux you should be able to mount the CD-ROM to access the data files. As my CD-ROM is on /dev/hdd and the RAM disk image does not include this device, I had to mknod it first:

mknod /dev/hdd b 22 64
mount -r -t iso9660 /dev/hdd /mnt

Next create a bootable Linux CD-ROM with ISOLINUX. First create the file isolinux.cfg with the following contents:

prompt 1
timeout 100
say Available options: linux and noram
label linux
kernel zimage
append initrd=root.gz
label noram
kernel zimage
In fact this file is identical to syslinux.cfg on the SYSLINUX diskette.

Remove the old boot directory from the iso directory tree and replace it with the isolinux directory containing the kernel, the RAM disk image and the boot files:

rm -rf iso/boot
mkdir iso/isolinux
cp zImage iso/isolinux/zimage
cp root.img.gz iso/isolinux/root.gz
cp syslinux-1.75/isolinux.bin iso/isolinux
cp isolinux.cfg iso/isolinux

Next create the ISO image and burn it to CD as usual:

mkisofs -o isoboot.iso -b isolinux/isolinux.bin \
        -c isolinux/boot.catalog \
        -no-emul-boot -boot-load-size 4 \
        -boot-info-table -r iso

Older BIOS-es cannot boot from CD-ROM. There are two solutions:

Most Linux distributions provide both RAWRITE and LOADLIN on the CD-ROM and some even provide a real boot diskette.


next up previous contents
Next: Conclusions Up: Linux Boot Loaders Compared Previous: Hard Disk Installation   Contents
Lennart Benschop 2003-05-29