next up previous contents index
Next: 4.3 Shutting Down Up: 4.2 Booting the System Previous: 4.2.1 Using a boot

4.2.2 Using LILO

 

    Another method of booting is to use LILO, a program which resides in the boot sector of your hard disk. This program is executed when the system is booted from the hard disk, and can automatically boot up Linux from a kernel image stored on the hard drive itself.

      LILO can also be used as a first-stage boot loader for several operating systems, allowing you to select at boot time which operating system (such as Linux or MS-DOS) to boot. When you boot using LILO, the default operating system is booted unless you press , , or during the bootup sequence. If you press any of these keys, you will be provided with a boot prompt, at which you type the name of the operating system to boot (such as ``linux'' or ``msdos''). If you press at the boot prompt, a listing of available operating systems will be provided.

  The easy way to install LILO is to edit the configuration file, /etc/lilo.conf, and then run the command

# /sbin/lilo

The LILO configuration file contains a ``stanza'' for each operating system that you want to boot. The best way to demonstrate this is with an example LILO config file. The below setup is for a system which has a Linux root partition on /dev/hda1, and an MS-DOS partition on /dev/hda2.

# Tell LILO to modify the boot record on /dev/hda (the first
# non-SCSI hard drive). If you boot from a drive other than /dev/hda,
# change the following line. 
boot = /dev/hda

# Name of the boot loader. No reason to modify this unless you're doing
# some serious hacking on LILO.
install = /boot/boot.b

# Have LILO perform some optimization.
compact

# Stanza for Linux root partition on /dev/hda1.
image = /etc/Image   # Location of kernel
   label = linux     # Name of OS (for the LILO boot menu)
   root = /dev/hda1  # Location of root partition
   vga = ask         # Tell kernel to ask for SVGA modes at boot time

# Stanza for MSDOS partition on /dev/hda2.
other = /dev/hda2    # Location of partition
   table = /dev/hda  # Location of partition table for /dev/hda2 
   label = msdos     # Name of OS (for boot menu)

    The first operating system stanza in the config file will be the default OS for LILO to boot. You can select another OS to boot at the LILO boot prompt, as discussed above.

Remember that every time you update the kernel image on disk, you should rerun /sbin/lilo in order for the changes to be reflected on the boot sector of your drive.

Also note that if you use the ``root ='' line, above, there's no reason to use rdev to set the root partition in the kernel image. LILO sets it for you at boot time.

The Linux FAQ (see Appendix A) provides more information on LILO, including how to use LILO to boot with OS/2's Boot Manager.        



next up previous contents index
Next: 4.3 Shutting Down Up: 4.2 Booting the System Previous: 4.2.1 Using a boot



Matt Welsh
mdw@sunsite.unc.edu