You may also find this page useful: http://www.pre-emptive.net/doco/linux-boot-and-installation-disk
This page is about making your own bootable (Fedora) Linux CDs. You may need this information if you're creating your own "live CD" or otherise making some sort of software installer that you want to provide on CD.
In my case, I've made a CD that installs a system with a pre-defined Linux image. The image is specific to a small number of hardware variants, each running exactly the same software. That means I can literally "clone" one system onto the next (and changing IP addresses etc once that's done).
If you're looking for information on how to boot Fedora CDs, or how to make and burn CDs under Linux, you're out of luck - sorry ;-)
In short, you will need:
* Some sort of linux image that will ultimately appear on the CD
* The isolinux software
* An initrd image for the kernel your CD will be using
* A stack of blank CDs - you're bound to make a few mistakes along the way!
* Lots of testing and development time! (including a machine to work with, of course)
Step 1: Make the Linux Image for the CD
This is the process of making a system that boots up, and does whatever you want your CD to do. Most of this is obviously dependent on what you're trying to do, but making the image work when it eventually gets onto the (read only!) CD takes a bit of work, which I've tried to describe here.
(sorry, still got to do this section!)
Step 2: Use isolinux
isolinux is software that you can use to make bootable CDs quite easily. It's a bit like Grub or Lilo, but it's for CDs. Curiously, you need to make a boot disk to get it. You should do this on a running system, although probably not your "CD system" because you'll probably have stripped that down and removed the necessary files.
You need to select a kernel to use. Any kernel will do, so long as you have a modules directory for it, and it's installed properly on your system (you don't need to be running it to use it though). Run mkbootdisk to get an isolinux bundle for it:
mkbootdisk --iso --device /tmp/boot.iso 2.6.11-1.14_FC3
(obviously, change "2.6.11-1.14_FC3" to whatever kernel version you want to use)
The mkbootdisk program will create an ISO file in /tmp. You need to mount this to get at the files inside it:
mount /tmp/boot.iso /mnt -o loop
You'll find nothing but an isolinux subdirectory, which you should copy into your "CD system". After that, you're done with the image, so unmount it and delete /tmp/boot.iso.
Step 3: Sort out isolinux Config and initrd Images
First, a little recap about Linux booting. Linux boots in a series of steps. The first step is to run whatever code is in the boot sector of the disk (true for CDs, harddisks, floppies etc). That bit of code tells the machine what to do next. The next stage is to run the main bootloader, which will be located somewhere on the actual disk. The boot sector really just says where to find the bootloader.
The bootloader is a program such as [[LILO]] or Grub (for harddisks) or isolinux for CDs. Most bootloaders can do all sorts of things like allow you to select systems to boot, or change boot options. However, in essence they all load a kernel. That kernel uses an Initial Ram Disk (initrd) to boot the rest of the system.
The initrd contains the bare minimum that the system needs to get the filesystems mounted (where of course it can find all the other things it needs). This usually involves getting kernel modules like the filesystem modules and perhaps USB modules loaded. Once they're in, the real disks are mounted and the system boots. Note: Everything that happens before that mount comes from the initrd image - NOT the disk!
The mkbootdisk program used in step 2 assumes you're going to use the harddisk to boot your system. Of course you're going to use a CD, so we have to make a few changes. The first is to change the boot config for isolinux. This is much like a Grub config and is called isolinux.cfg (in the isolinux directory of the "CD system"). If you look at the file, you'll obviously have to change the root location from /dev/hda1 (or whatever) to /dev/hdc. You might also want to stop isolinux displaying any welcome page or prompting for kernel options. Here's my isolinux.cfg file:
append initrd=initrd.img roroot=/dev/hdc
This will instruct isolinux to look to /dev/hdc for the root of the system, where it will also find the initrd image.
The initrd image is a funny one. On my FC2 system, mkbootdisk created a ext2fs format initrd file. On FC3 it seems to create a gzipped [[CPIO]] archive. I couldn't get that to work at all, so had to recreate it as an ext2fs file instead. I guess FC2 users can skip this next bit ;-)
To make the modified initrd image, we have to do the following (taken from [http://trinityhome.org/trk/old/trk04-dev-howto.htm]):
dd if=/dev/zero of=/tmp/newinitrd.img bs=1k count=2880
(to create a file that we'll put a filesystem onto in a moment)
losetup /dev/loop0 /tmp/newinitrd.img
(to get the loopback system working with our file)
(to make a filesystem on the file)
mount /dev/loop0 /mnt
(to mount it)
zcat (wherever)/isolinux/initrd.img | cpio -i
(to extract the old initrd image into the new one)
cp /tmp/newinitrd.img.gz (wherever)/isolinux/initrd.img
(to compress the new file and put it in place of the old one)
Step 4: Burn Baby, Burn!
Now we have a whole system and bootloader ready, we can burn it to disk. Change directory into the root of the "CD system" and run this:
mkisofs -o ../image.iso -V 'My Linux CD' -b isolinux/isolinux.bin -c isolinux/boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table -R -J -V -T .
Now to burn it to a CD:
cdrecord -eject -tao ../image.iso
(or else do whatever you need to in order to burn a .iso to a CD)
Step 5: Test, Rinse and Repeat
Try booting your system with the CD. If you're very lucky it'll work right away. You're more than likely going to make a few mistakes or havea few problems though, so you'll probably burn quite a few CDs that go straight into the bin.
You could have any number of problems, some of them are listed here so might give you some clues as to where the problem is:
* System "ignores" the CD and just goes ahead and boots the harddisk
Check the mkisofs command and make sure you've got isolinux in place properly.
* System start to boot the kernel, but then panics (possibly with "unable to mount root fs on unknown block(22,0)")
This is the initrd image problem - Check and make sure that your initrd.img file is a gzipped ext2fs file, not a gzipped CPIO archive.
This problem can also be due to some problem with "udev" (which dynamically makes entries in /dev) during the initrd booting phase. I think the advice is "update udev", which probably means you need to update quite a few things in your system. Sorry, I don't really know te answer ;-)
* System boots from the CD but then switches over to the harddisk
Check that you have correctly edited the isolinux.cfg file to point the kernel at the CD rather than the harddisk.
* As the system boots, it grumbles about "read only filesystem"
Hmm, tough one. It depends on what exactly the problem is, but you might like to look into ram disks, udev and the like so whatever it is doesn't have a problem.
Stuff to Try (if you've got it all working!)
If you're "CD system" is small, you could move it all into the initrd image. You'll need to be careful to modify your rc.sysinit file to include the things that previously got done in the initrd image. However, once done, your whole system will run out of the initial ram disk, so besides loading in the image, the CD won't get used. In fact, if you play your cards right, the CD won't even get mounted, so you can eject it! (which is very useful if you want to use a second disk for something).
Using the initrd image for everything is useful in other ways too. For example, it's a read-write filesystem, so you don't have to make special concessions for /tmp, /var/tmp etc. Also, since it's all in ram, it's faster than running off CD. You do have to be careful though, because of course the ram disk is using up a chunk of your available memory. In other words, make the uncompressed initrd image as small as you can, which of course defines the size of the filesystem of the ram disk.