Resource Sharing
LPIC-1 101 » Appendix » LILO

LILO

LILO (Linux Loder) (Appendix)

LILO needs to load the following files to boot:
 - /boot/boot.b
 - /boot/map (created by executing /sbin/lilo)
 - kernels
 - other OS boot sector

Boot process is largely related to CPU framework, e.g. LILO or GRUB boot loader cannot be applied to ARM framework in Linux system. However, LILO and GRUB are the current two major boot loaders, but the later is mainly accepted by most Linux distributors because GRUB provides the prompt “grub>” to directly control boot configuration parameter., which is much more flexible than LILO.

Let’s discuss LILO first. LILO (LInux LOader) configuration file is located in /etc/lilo.conf, but any modification upon this configuration file would come into effect only if /sbin/lilo is re-executed.

LILO contains two main parts:
map installer: map installer: /sbin/lilo installs the first- and second-stage boot loaders that allow you to boot different operating systems, select the operating system at boot time and pass parameters to the booting kernel.
map file: map file: /boot/map records which disk block the kernel file is located in.

/etc/lilo.conf

boot loader: executed by BIOS and provides boot options to load operating system.

/boot/boot.b located at MBR loads the first stage boot loader then starts with second stage boot loader to load and execute kernel.

Within lilo.conf there are typically two section types. The first section, which defines the global options, contains parameters which specify boot location attributes. The second section(s) contain parameters associated with the operating system images to be loaded. See the following example:

compact
message=/etc/boot_mesg
boot=/dev/hdc
disk=/dev/hda
bios=0x80
delay=0
vga=0
map=/map
install=/boot.b
read-only
serial="0,9600n8"
linear

image=/k6_via.24
   label=msi_gw
   initrd = /k6_via.img
   append = "console=ttyS0,9600n8 root=/dev/ram0 init=linuxrc rw"

other=/dev/hda2
   label=Windows_XP

As you can see, the parts above the line starting with “image” are the first section of lilo.conf indicating global options while the parts below the line starting with “image” (such line is also included) are the second section of lilo.conf containing parameters associated with the operating system to be loaded.

LILO Global Options

Keywords Description
compact Tries to merge read requests for adjacent sectors into a single read request. This drastically reduces load time and keeps the map smaller. Using `compact' is especially recommended when booting from a floppy disk.
message Specifies a file containing a message that is displayed before the boot prompt. No message is displayed while waiting for a shifting key after printing "LILO ". In the message, the FF character ([Ctrl L]) clears the local screen. The size of the message file is limited to 65535 bytes. The map file has to be rebuilt if the message file is changed or moved.
boot Sets the name of the device (e.g. a hard disk partition) that contains the boot sector, e.g. boot=/dev/md0 means the boot device is RAID1.
disk

Defines non-standard parameters for the specified disk. See section "Disk geometry" of user.tex for details. Especially useful is the `bios=' parameter. The BIOS numbers your disks 0x80, 0x81, etc. and it is impossible to decide which Linux disk corresponds to which BIOS disk (since this depends on the BIOS setup, and on the type of BIOS), so if you have an unusual setup you need to state the correspondence between Linux disks and BIOS disks. For example,

    disk=/dev/sda
       bios=0x80
   disk=/dev/hda
       bios=0x81

would say that your SCSI disk is the first BIOS disk, and your (primary master) IDE disk is the second BIOS disk.

bios Specifies BIOS storage code. The first BIOS boot device code is 0x80, the second is 0x81 and so forth.
delay Specifies the number of tenths of a second the boot loader should wait before booting the first image. This is useful on systems that immediately boot from the hard disk after enabling the keyboard. The boot loader doesn't wait if `delay' is omitted or is set to zero.
prompt Forces entering the boot prompt without expecting any prior key-presses. Unattended reboots are impossible if `prompt' is set and `timeout' isn't.
timeout Sets a timeout (in tenths of a second) for keyboard input. If no key is pressed for the specified time, the first image is automatically booted. Similarly, password input is aborted if the user is idle for too long. The default timeout is infinite.
vga Specifies the VGA text mode that should be selected when booting. The following values are recognized (case is ignored): 1) normal: select normal 80x25 text mode; 2) extended (or ext): select 80x50 text mode; 3) ask: stop and ask for user input (at boot time).
map Specifies the location of the map file. If `map' is omitted, the file /boot/map is used.
Install /boot/boot.b。Install the specified file as the new boot sector. From Version 21.5 there are two alternative boot loaders available: boot-text.b and boot-menu.b. If `install' is omitted, /boot/boot.b is used as the default.
read-only Specifies that the root file system should be mounted read-only.
serial Enables control from a serial line. If `serial' is set, the value of `delay' is automatically raised to 20. For example, in serial=”0,9600n8”:
0: the number of the serial port, zero-based. 0 corresponds to COM1 alias /dev/ttyS0, etc.
9600: the baud rate of the serial port. The following baud rates are supported: 110, 150, 300, 600, 1200, 2400, 4800 and 9600 bps. Default is 2400 bps.
n: the parity used on the serial line. n for no parity, e for even parity and o for odd parity.
8: the number of bits in a character. Only 7 and 8 bits are supported. Default is 8 if parity is "none", 7 if parity is "even" or "odd".
initrd Specifies the name and location of boot ramdisk image, usually contains network or SCSI driver.
ramdisk_size Specifies ramdisk size counted by KB. For example, ramdisk_size=16384 is assigned for 16MB.

Then execute the command line lilo -v -v to start up the configuration above.

One LILO bug(http://www.tldp.org/HOWTO/Large-Disk-HOWTO-5.html#LILO)

With LILO versions below v21 there is another disadvantage: the address conversion done at boot time has a bug: when c*H is 65536 or more, overflow occurs in the computation. For H larger than 64 this causes a stricter limit on c than the well-known c < 1024; for example, with H=255 and an old LILO one must have c < 258. (c=cylinder where kernel image lives, H=number of heads of disk)