MakeBootableCds

Create Bootable CDs Under Linux

Software Needed

  • cdrtools-cdrecord
  • cdrtools-mkisofs
  • dd

Steps

  • Make a bootable floppy. For example, format a floppy with system files on a DOS system. You could create a single-disk linux floppy, too (maybe muLinux).
  • Put that floppy in the drive on your linux system and turn it into an image file.
  dd if=/dev/fd0 of=floppy.img bs=18k
  • Create a directory to hold your cd filesystem. Put your floppy image in that directory.
  mkdir /tmp/cdimage
  cp floppy.img /tmp/cdimage
  • Place any other files you want on the CD in that directory too.
  • Turn the directory in to an iso9660 filesystem image
  mkisofs -J -r -b floppy.img /tmp/cdimage -o /tmp/cdimage.iso
  • Burn a CD containing the new image
  cdrecord -v /tmp/cdimage.iso -d 0,0,0

Discussion

Bootable CDs are an ugly hack. What really happens is that the BIOS makes a file on the CD look like a floppy disk and causes the system to boot from that floppy. After the system boots, the floppy gets magically removed and you go back to having just a CD-ROM drive. Thus, you have to go through contortions to create that floppy, and you are limited to 1.44MB of data (actually you can probably do 2.88MB too, if you can find a 2.88 drive to create the initial image).

Note that you won't be able to access anything else on the CD unless your floppy boot image makes the CD-ROM drive available (i.e. loads the right drivers)

Note that you have to have your system set up right to burn CDs. In particular, you need SCSI support (because CD burners act like scsi devices). You need some /etc/modules.conf entries like this:

  options ide-cd ignore='hdc hde'
  alias scd0 sr_mod
  alias scd1 sr_mod
  pre-install sg     modprobe ide-scsi
  pre-install sr_mod modprobe ide-scsi
  pre-install ide-scsi modprobe ide-cd
  post-install scsi_mod modprobe ide-scsi

These entries make the ide-cd driver ignore your cdrom drive, and instead load the scsi drivers. This means you have to access your cdrom drives as /dev/scd0, /dev/scd1, etc.

If you want to be clever, you can feed the output of mkisofs directly to cdrecord and skip the intermediary cd image file on disk.

--phil 5/11/01

CategoryGeekStuff

CategoryLinuxStuff



Our Founder
ToolboxClick to hide/show
RecentChanges Click to hide/show