LILO  -  Generic Boot Loader for Linux ("LInux LOader") by Werner Almesberger
=============================================================================

This is an ALPHA test release of a new boot loader. Be sure to have some
means to boot your system from a different media if you install LILO on your
hard disk.


NOTE: Most of the documentation has moved into the LaTeX document doc.tex.
      This is only a minimal description for those who can't print or pre-
      view LaTeX documents.


Features
--------

  - does not depend on the file system. (Tested with Minix, EXT FS and MS-DOS
    FS.)
  - can be used to boot from floppies and from hard disks.
  - can replace the master boot record.
  - can boot non-Linux systems (MS-DOS, DR DOS, OS/2, ...) and unstripped
    kernels.
  - supports up to 16 different boot images that can be selected at boot
    time. Root and swap disk/partition can be set independently for each
    image.
  - boot sector, file map and boot images can be all on different disks or
    partitions.


Restrictions and known problems
-------------------------------

  - SCSI disks are not fully supported yet. (Still waiting for some kernel
    changes.)
  - booting other operating systems doesn't seem to work everywhere. If
    everything but booting a non-Linux OS from LILO works on your system,
    you should boot LILO by BOOTACTV and select the alternate OS with the
    latter as a temporary work-around.
  - booting non-Linux systems from the second hard disk ("D:") is not yet
    supported.


Files
-----

Files contained in lilo.5.tar.Z:

  README	This file.
  Makefile	Makefile for everything else.
  *.c, *.h	LILO map installer source.
  *.S		LILO boot loader source.
  activate.c	Simple boot partition setter.
  dparam.s	Disk parameter dumper source.
  disktab	Sample disk parameter table.

Files created after  make  (among others):

  boot.b	Combined boot sector.
  chain.b	Chain loader.
  lilo		LILO installer.
  activate	Simple boot partition setter.
  dparam.com	MS-DOS executable of the disk parameter dumper.


!! STOP READING HERE IF YOU CAN USE THE LaTeX VERSION OF THE DOCUMENTATION !!

    The LaTeX part is generally more up to date and contains more useful
    hints and examples. The following sections have been trimmed to make
    it easier to maintain them, e.g. by removing as many version-dependen-
    cies as possible.


Installation
------------

You have to run the 0.96c-pl1 kernel or any newer release.

This section describes one possible installation of LILO. Please read
"Booting basics" in the LaTeX document for the whole story.

Non-SCSI installation:

Step 1: Extract all files from lilo.5.tar.Z, run make to compile and assemble
        all parts.
Step 2: Read the "LILO installer" section in this README and be sure to
	understand what the command-line options do.
Step 3: Do  make install  to copy all LILO files to /etc/lilo
Step 4: Install lilo on a floppy disk:
	lilo -b /dev/fd0 -i boot.b -v -v -v /your_kernel_image
Step 5: Reboot. If this doesn't work or if you don't want to install LILO on
	your hard disk anyway, you can stop here.
Step 6: Get a working bootimage and a rootimage. If you have reason to be
        paranoid about your boot sector, mount the rootimage and copy your
        current boot sector to a file on it, e.g.
	dd if=/dev/hda2 of=/fd/boot_sector bs=512 count=1
Step 7: Create a shell script /etc/lilo/install that installs LILO on your
        hard disk, e.g.
	# cat >/etc/lilo/install
	#!/bin/sh
	/etc/lilo/lilo <all_necessary_options> -i /etc/lilo/boot.b $* \
	  /kernel_image(s)
	^D
	# chmod 755 /etc/lilo/install
Step 8:	Now, you can check what LILO would do if you
	were about to install it on your hard disk:
	/etc/lilo/install -v -v -v -t
Step 9:	If necessary, install a boot partition switcher. Run /etc/lilo/install
        to install LILO on your hard disk. If necessary, mark that partition
        "active".
Step 10: Reboot.

SCSI installation:

  Like non-SCSI installation, but you have to put the parameters of your
  SCSI drive into the file /etc/lilo/disktab.


IMPORTANT: You have to repeat the installation procedure whenever any of the
	   boot images is replaced or moved (e.g. after the kernel is re-
	   compiled.) The -i option can be omitted if a LILO boot sector has
	   already been installed.


LILO Installer
--------------

The LILO installer accepts the following command-line options:

  -b boot_device

	Sets the name of the device that contains the boot sector. If -b is
	omitted, the boot sector is read from (and possibly written to) the
	device that is currently mounted as root. A BIOS device code can be
	specified.

  -c

	Tries to merge read requests for adjacent sectors into a single read
	request. This drastically reduces load time and keeps the map
	smaller.

  -d tsecs

	Specified the number of tenth seconds LILO should wait before booting
 	the first image. This is useful on systems that immediately boot from
	the hard disk after enabling the keyboard. LILO doesn't wait if -d is
	omitted.

  -i boot_sector

	Install the specified file as the new boot sector. If -i is omitted,
 	the old boot sector is modified. A BIOS device code can be specified.

  -m map_file

	Specifies the location of the map file. If -m is omitted, a file
	/etc/lilo/map is used. A BIOS device code can be specified.

  -r root_dir

	Change the root directory to root_dir before doing anything else.
 	This is typically used when running off a floppy, with the normal
	root mounted at some directory.

  -s backup_file

	Copy the old boot sector to backup_file instead of
	/etc/lilo/boot.<number>

  -S backup_file

	Like -s, but overwrite an old backup copy if it already exists.

  -t
	Test only. This performs the entire installation procedure except
	replacing the map file and writing the modified boot sector. This
	can be used in conjunction with the -v option to verify that LILO
	will use sane values.

  -v

	Turns on lots of progress reporting. Repeating -v will turn on more
	reporting. (-v -v -v -v is the highest verbosity level and displays
        all mappings.)


If no image files are specified, the currently mapped files are listed. Only
the options -m and -v can be used in this mode.

If at least one file name is specified, a new map is created for those files
and they are registered in the boot sector. If root or swap devices have been
set in the images, they are copied into the descriptors in the boot sector.
If no root device has been set, the current root device is used. The root and
swap devices can be overridden by appending them to the image specification,
e.g.

    lilo foo,/dev/hda1,0x302
	  ^      ^       ^
	image   root    swap

Either numbers or device names can be used.

It is perfectly valid to use different root/swap settings for the same
image, because LILO stores them in the image descriptors and not in the
images themselves. Example:

    lin-hd=/linux,/dev/hda2
    lin-fd=/linux,/dev/fd0

The image files can reside on any media that is accessible at boot time.
There's no need to put them on the root device, although this certainly
doesn't hurt.

If LILO doesn't guess the correct BIOS device code, it can be specified by
appending a colon and the code to the file name, e.g. /linux:0x80

LILO uses the first file name (without its path) of each image specification
to identify that image. A different name can be specified by prefixing the
specification with  label=  e.g.

    msdos=/etc/lilo/chain.b+/dev/sda1@/dev/sda

LILO can boot the following types of images:

  - "classic" boot images from a file
  - "classic" boot images from a device
  - unstripped kernel executables
  - the boot sector of some other OS

The image type is determined by the syntax that is used for the image
specification.


  Booting "classic" boot images from a file
  -----------------------------------------

  If defined, root and swap definitions are taken from the boot image.
  The image is specified as follows:

	file_name [ :BIOS_code ]

  I.e.  /linux


  Booting "classic" boot images from a device
  -------------------------------------------

  Root and swap settings in the image are ignored. The range of sectors
  that should be mapped, has to be specified. Either a range (start-end)
  or a start and a distance (start+number) have to be specified. If only
  the start if specified, only that sector is mapped.

	device_name [ :BIOS_code] #start [ -end | +number ]

  I.e.	/dev/fd0#1+512


  Booting unstripped kernel executables
  -------------------------------------

  Unstripped kernel executables contain no root or swap device information.
  The setup code of the kernel has also to be added to the kernel. First,
  it has to be copied to a suitable place and its header has to be removed,
  e.g.

	(dd of=/dev/null bs=32 count=1; dd) </usr/src/linux/boot/setup \
	  >/etc/lilo/setup.b

  The image specification looks like this:

	setup_name [ :BIOS_code ] +kernel_name [ :BIOS_code ]

  I.e.	/etc/lilo/setup.b+/usr/src/linux/tools/system


  Booting a foreign OS
  --------------------

  LILO can even boot other operating systems, e.g. MS-DOS. This feature
  is new and may not yet work totally reliably. (Reported to work with
  PC-DOS 4.0, MS-DOS 5.0 and DR-DOS 6.0.) To boot an other operating
  system, the name of a loader program, the device that contains the boot
  sector and the device that contains the master boot record have to be
  specified:

	loader+boot_dev [ :BIOS_code ] @ [ part_dev ]

  I.e.	/etc/lilo/chain.b+/dev/hda2@/dev/hda

  The boot sector is merged with the partition table and stored in the map
  file.

  Currently, only the loader chain.b exists.


LILO may create some device special files in your /tmp directory that are
not removed if an error occurs. They are named /tmp/dev.<number>.


Bugs and such
-------------

Please send all bug reports to almesber@nessie.cs.id.ethz.ch
