Ken Yap, <ken_yap AT users PERIOD sourceforge PERIOD net>
10 May 2002
This HOWTO explains how to install LILO on disks that do not have any Linux filesystems to boot DOS as well as Etherboot .(z)lilo images.
LILO is perhaps the best known Linux boot loader and many people use it to single or multiple boot OSes?. What is less well known is that LILO can also boot from disks that do not have any Linux partitions at all. This follows from the design of LILO. The installer stores lists of disk blocks to read in and the boot time portion does not care what kind of partition the boot images are stored on. All that is needed is a way to run the installer on a non-Linux partition. Any filesystem supported by Linux can be handled, provided it can be mounted RW. This includes all the FAT based DOS and Windows filesystems.
What I describe below is not actually Etherboot specific. It will work just as well if you want to boot a Linux kernel from a DOS partition. It just so happens that Etherboot can build images that look like Linux kernels to the LILO installer. Therefore most of the cleverness is in getting a LILO installer to run on a non-Linux partition.
floppies or CD's should work also. All you have to be able to do with the rescue disk is mount a DOS/Windows filesystem on the Linux filesystem.
The next 4 steps are done on a host Linux system.
Makefile to generate a statically linked lilo executable by adding –static to the link command. Do a make. This will generate a lilo executable. You might want to run strip on this to reduce the size. Also generated will be various boot programs ending in .b.
/boot.b. You can also substitute -text for -menu if you prefer a plain text prompt. Copy the lilo executable to /tmp/lilo/sbin. Create /tmp/lilo/etc/ lilo.con and add an entry for DOS. Add entries to /tmp/lilo/etc/lilo.con for the Etherboot images.
/tmp/lilo/boot. Remember to alter the names to 8.3 standard as necessary.
means to transfer this to the DOS system. To save you work, you can find a copy of this zip archive, minus the Etherboot images and the lilo.con modifications, here.
transfer this to the DOS system using the wget on the rescue floppy, see below.
using pkunzip, remember to use the option that preserves the paths. You should end up with three new top level directories: \boot, \sbin and \etc.
say on /mnt.
of lilo because it will chroot to /mnt and look for /mnt/dev/hda, and of course those device files don't exist on a DOS FS.
master boot sector.
modifications to \etc\lilo.con.
streamline all of the above with a couple of commands if you have a web server handy and you can put a shell script and the .tar.gz package there.
Once you have booted tomsrtbt, issue a wget for the install shell script, something like this:
#!/bin/sh mount -t msdos /dev/hda1 /mnt (cd /mnt; wget -O - http://172.16.2.25/thin/lilo2175.tar.gz | gunzip | tar xf - 2>/dev/null) rm -f /boot ln -s /mnt/boot /boot /mnt/sbin/lilo -v -C /mnt/etc/lilo.con umount /mnt
Run it with:
could provide different install scripts for them which would fetch different images. Or you could parameterise install.sh. Of if you are really cunning, you could try to extract the network card identity out of a lsmod, as tomsrtbt autoprobes for several common NICs?.
and each Etherboot image. You can even have fancy splash graphics, this is a LILO enhancement in some distributions like SuSE.
floppy is that the lilo executable must match the boot programs, otherwise you get mysterious errors like Map segment is too big. For example the LILO in tomsbtrt is version 20.
the disk, if you ever defrag the partition containing the boot/ files, and the files get moved as a result, then LILO will fail. So it would be a good idea to mark those files as unmovable (system and RO I think). If you accidentally move the images, then you have to run the LILO install step again.