Minimal boot CD

Dec 08, 2004 2 Replies

I'm trying to learn how to make a bootable Linux CD with a bare minimum of tools on it as I only need it to do a few things. I've spent hours searching google and experimenting with some various methods explained in articles I found, but none of them have panned out.



I've read the bootdisk howto but besides being seriously outdated, it focuses on floppies.



So far I have been able to use ISOLINUX to create a bootable CD by following the instructions at

formatting link



The CD boots, finds my kernel, and then panics because it can't find anything else. That was obviously expected since I had not yet built the root file system. But at least getting to that point assured me I was on the right track.



I knew I needed some kind of sane working environment for the kernel to load. Busybox was the first thing I thought of. I may one day be interested in compiling everything I want from source, but for the time being Busybox is absolutely perfect for what I want.



I'm just not sure how to proceed from the point I'm at now. I was thinking I had to make an initrd image, mount it as a loop device, and then install busybox to that location. I have done that. (Though I'm not sure I did it right ... does the initrd have to be a specific size?) I then updated my CD image to include the initrd image I created. I reburned the CDRW and tried to boot from it.



The loader finds and loads vmlinuz and even finds and loads intird ... but it still kernel panics. I didn't expect it to work the first time, but I have tried reburning the CDRW a dozen times, trying a few different things, and I'm getting nowhere.



The kernel panic I'm getting is:



Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)



I think the problem may be with my /dev directory inside of my initrd ... but I'm not even sure if we are at that point yet when the kernel panics. Do I need two /devs? One inside of the initrd for the ram disk image and one outside of the initrd so the system can boot?



I'm pretty confused about that point. My ISO contains:



initrd.gz isolinux.bin isolinux.cfg vmlinuz



Here are the lines I have in my isolinux.cfg:



timeout 10 default vmlinuz append initrd=initrd.gz load_ramdisk=1 ramdisk_blocksize=4096 root=/dev/rd/0



I compiled everything I needed into my kernel. No module support at all. I included RAM disk support ((4096) Default RAM disk size) and Initial RAM disk (initrd) support into the kernel.



I'm not sure if my isolinux.cfg is being read properly ... my timeout setting of 10 seconds doesn't seem to work. It boots instantly. (Though now that I'm writing this I'm thinking that might be miliseconds?)



Also I'm not sure if "root=/dev/rd/0" is right. I copied that from someone else's setup and I'm thinking it could be the source of my current problem. But since there's no /dev on the CD to look at, I don't know what it should be.



I feel like I'm pretty close to achieving my goal. Can someone help me make the final leap?



---- clip clip ----

Get the Diskless-root-NFS-HOWTO from the Linux Documentation Project. It has part 5: Added bonus: booting from cdrom. It explains the bootable CD pretty well.

In principle, the BIOS looks at the El Torito boot directory on the CD and shows the boot image as a diskette to the rest of BIOS. This is why the boot image has to be 1.44 or 2.88 MBytes. You have to have on the floppy image the kernel and enough stuff to get the root filesystem mounted.

As you clearly cannot write on a normally mounted CD, the root of the filesystem has to be on a ramdisk. You may need to have an initial ramdisk to get all the necessary drivers if they are not compiled in the kernel.

HTH

Tauno Voipio tauno voipio (at) iki fi

Tauno only tells 1/3 of the story, and not the most interesting part. El-torito allows for you to make a bootable CD using floppy emulation, disk emulation, or no emulation.

  1. floppy emulation has the size limitations Tauno mentions.
  2. disk emulation has the complication that you must create a boot sector for your image and it is reported that some BIOS don't fully support the specification.
  3. no emulation. What most vendors use.

Look at SYSLINUX:

formatting link

You may want to try disecting a working cd to see how they are put together.

-CB

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required