lilo
lilo
is the Linux Boot Loader. Not only allows it to boot Linux but also Windows or from a Diskette, and even from CD-ROM. Omitting the latter two adds a bit of security because even forgotten CDs or Floppies won't disturb the normal boot process.
Booting from Floppy via lilo
is easy. Just add
... other = /dev/fd0 label = Floppy unsafe ...
to your /etc/lilo.conf
. The unsafe
parameter is necessary because otherwise lilo
tries to read the diskette's boot sector when it writes the new configuration to disk.
Booting from a CD-ROM is a bit trickier, because the system's BIOS handles CD-ROMs in a completely different fashion than harddisks or diskettes. Thus it is necessary to fool the BIOS a bit.
Remember the golden olden DOS times? When a harddisk was not formatted, the PC would jump into ROM-Basic or display the infamous "insert diskette" message. And here comes the trick: We tell the BIOS the harddisk couldn't be found (don't worry, it still exists). Technically, we call the BIOS' interrupt 18 ("invoke ROMBASIC" or so), and the BIOS will proceed to the next configured boot device, in our case the CD-ROM (or the network's PXE code if no CD is present).
For this, you must make sure your System boots off the harddisk first, from CD-ROM after. (HD0 as "First Boot Device", CD-ROM as "Second Boot Device"). That was the easy part.
Now we need a fake boot sector that is loaded and executed. A boot sector consists of 512 bytes, of which the first xxx are machine code that is executed and the last two bytes are 0x55, 0xAA. This file contains a gzip-compressed boot sector that contains the bytes
CD 18 00 00 ... 00 55 AA
gunzip
this file, put it into /boot
and modify your /etc/lilo.conf
like this:
... other = /boot/cdboot.b label = CD-ROM ...
Then save the file and run /sbin/lilo
(you should be root for this and have an idea what exactly you're doing with your system; when in doubt, leave lilo alone. You have been warned.)
(found in this usenet post by Kasper Dupont)