next up previous contents
Next: Creating the Install Scripts Up: Making Linux Installation Disks Previous: Making a Bootable Diskette   Contents

Subsections

Creating a CD-ROM

Most modern PCs can boot from CD-ROM and in the near future most computers will not even have floppy drives. Therefore we present an alternative configuration using a CD-ROM. In our method we are essentially creating three levels of disk image files:

We have to start at the innermost level.

Creating the RAM disk image

Creating the RAM disk image for a CD is really the same as for a diskette, only this time we will fit the modules.tar.gz file into the RAM disk and hence the RAM disk will be larger. Run the following commands (put them in a shell script):

cd $MYBOOT
dd if=/dev/zero of=initrd.img bs=1k count=3000
mke2fs -F -N 300 initrd.img
mount -o loop initrd.img mnt
cp -a rootfs/* mnt
cp modules.tar.gz mnt/lib
umount initrd.img
gzip -9 initrd.img

Creating the Diskette Image

On the CD-ROM we will use a diskette image of 2.88MB. Real diskettes of this size are really rare, but most PCs can boot from a diskette image on a CD.

First prepare an image file of a 2.88MB diskette and copy GRUB to it.

dd if=/dev/zero of=isoboot.img bs=1k count=2880
mke2fs -F isoboot.img
mount -o loop isoboot.img mnt
mkdir mnt/boot
mkdir mnt/boot/grub
cp grub-0.92/stage1/stage1 mnt/boot/grub
cp grub-0.92/stage2/stage2 mnt/boot/grub

Next create the file mnt/boot/grub/menu.lst with the following contents:

title Linux Installation Disk
root (fd0)
kernel (fd0)/boot/kernel
initrd (fd0)/boot/initrd.img.gz

Unmount and run GRUB:

umount mnt
grub-0.92/grub/grub

Inside GRUB type the following commands:

device (fd0) isoboot.img
root (fd0)
setup (fd0)
quit

Now the diskette image (hopefully) contains a working boot loader. Keep a copy of this image, so you can add your kernels and RAM disk images later.

Finally copy your RAM disk and kernel to it:

mount -o loop isoboot.img mnt
cp linux-2.4.21/arch/i386/boot/bzImage mnt/boot/kernel
cp initrd.img.gz mnt/boot
umount mnt
This diskette image is already quite full, so this spells the worst for newer software versions or extensions. As a first measure we can remove the Ethernet drivers from modules.tar.gz. If we can boot from a CD-ROM, we may as well assume we have a CD-ROM and we can install from there. Otherwise you can consider the isolinux CD boot loader, which does not use diskette images, but can use kernels and RAM disk images anywhere on the CD.

It's worth considering the removal of both module support and network support from the kernel and to compile most common SCSI host adapters directly into the kernel. Functionality related to modules and networking can then also be removed from Busybox.

Creating the Bootable CD

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 (in our example we use a hypothetical file distro.tar.gz and copy the diskette image to the boot directory.
cp distro.tar.gz iso/data
cp isoboot.img iso/boot
Now create the ISO image.
mkisofs -o bootcd.iso -b boot/isoboot.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 bootcd.iso

This CD is bootable and from the booted Linux you should be able to mount the CD-ROM to access the data files.


next up previous contents
Next: Creating the Install Scripts Up: Making Linux Installation Disks Previous: Making a Bootable Diskette   Contents
Lennart Benschop 2003-07-16