UNIX System Administration Handbook - Evi Nemeth [22]
LILO can either be installed into the MBR of the disk or it can be installed into the boot record of the Linux root partition.
LILO is configured and installed with the lilo command. lilo bases the installed configuration on the contents of the /etc/lilo.conf file. To change your boot configuration, you simply update /etc/lilo.conf and rerun lilo. LILO must be reconfigured every time the boot process changes—in particular, every time you want to add a new boot partition and every time you have a new kernel to boot.
Configuring LILO
Here’s a basic lilo.conf file for a Linux system that has both a production kernel and a backup kernel:
boot=/dev/hda # Put boot loader on MBR
root=/dev/hda1 # Specify root partition
install=/boot/boot.b
map=/boot/map
delay=20 # 2sec for user interrupt
image=/vmlinuz # Kernel to boot
label=linux # Label to refer to this entry
read-only
image=/vmlinuz-backup # Backup entry
label=backup
read-only
Each possible boot scenario has a label. At boot time, you can tell LILO which one to use by entering the appropriate label. The first label to appear in lilo.conf becomes the default.
The default scenario (named linux) boots the file /vmlinuz. The read-only tag specifies that the kernel should mount its root filesystem read-only. This option should always be present; the startup scripts will take care of remounting the partition read-write at the appropriate time. This system is also configured to boot a backup kernel, /vmlinuz-backup. It’s always a good idea to have such an alternate.
Running lilo without any arguments will generate and install the boot loader and tell you which entries are available. It puts a star next to the default image. However, if you have made an error in the lilo.conf file, lilo usually won’t discover the problem until halfway through the installation of the boot loader. When this happens, the boot loader is in a confused state. Do not reboot until you’ve run lilo successfully. To avoid getting into this situation, you can run lilo -t to test the configuration without really installing it. If everything looks kosher, you can then run lilo for real. It is something of a mystery why lilo does not run this pretest for you by default.
lilo’s output when run with the config file above is:
# lilo
Added linux*
Added backup
When the system boots, LILO prints the following prompt:
LILO:
It then waits 2 seconds (20 tenths of a second, set with the delay tag), then boots the /vmlinuz kernel and mounts the first partition of the first IDE disk as the root partition. You can see a list of defined boot scenarios by pressing the LILO: linux backup LILO: To boot using an alternate scenario, just enter its label at the prompt. The FreeBSD boot loader You install the MBR-resident portion of the boot loader with the boot0cfg command. For example, the command # boot0cfg -B /dev/wd0 installs the first-stage boot loader into the MBR of the first IDE disk on the system. Very little configuration of the first-stage boot loader is necessary or possible. At boot time, it scans the list of available drives (which it obtains from the BIOS) and looks for partitions that it thinks are bootable. It presents the list of bootable partitions in a little menu: F1 FreeBSD F2 Windows Default: F1 For more information about fine-tuning the installation of the first-stage boot loader, refer to the boot0cfg man page. The second part of the boot loader is the one that actually boots FreeBSD and lets you pass special options to the kernel. It’s installed into the FreeBSD root partition with disklabel -B. disklabel is used for almost all disk configuration, so
The FreeBSD boot loader is simple and efficient. It’s divided into two parts: one that lives in the MBR and one that lives in the FreeBSD root partition. The two segments must be installed separately.