LILO - Generic Boot Loader for Linux ("LInux LOader") by Werner Almesberger =========================================================================== NOTE: This document is no longer maintained. However, it is still current. Changes to LILO for versions 21.2 and later are documented in detail in the 'man' pages for 'lilo' and 'lilo.conf'. Refer to them first, then to this document. Version 21-4 (release) -- John Coffman Minor changes suggested by Werner to show that this release is derived from the source code to his version 21. Added VERSION_MAJOR and VERSION_MINOR to replace VERSION. The file VERSION is replaced by 'version.h'. The first and second stage loaders have been modified so that ONLY 'lba32' will use EDD packet calls. 'linear' will now always ask the BIOS for the disk geometry, and then use C:H:S addressing. Version 22 (beta) -- John Coffman This version was created to allow booting on disks larger than 8.4Gb using the Enhanced BIOS call (int 0x13, AH=0x42) and the packet-call interface. These calls are supported on post-1998 systems, and through software BIOS extensions such as EZ-DRIVE(tm). My primary objective in making these changes to LILO, is not to break any- thing. Hence, the 32-bit direct addressing of sectors is supported by a new keyword in the 'lilo.conf' file: "lba32". This keyword is mutually exclusive with the keyword "linear". On the command line, these options are invoked with the new "-L" switch, or the old "-l" switch, respectively. Apologies to Werner Almesberger for not communicating these changes/addi- tions to him directly; but I have not been able to contact him by e-mail at the address he provided in the latest 'lilo.lsm' file. I do not want versions of LILO to get out-of-step. Disk sector addresses are conveyed from the Map Installer (lilo executable) to the boot loaders, first- and second-stages through a 5 byte structure: sector [1..63] plus 2 high bits of Cylinder cylinder [0..1023] low eight bits in this byte device [0..3] for floppies, [0x80..0x8F] for hard disks head [0..254] no, the max is 254, not 255 count [1...] number of sectors to transfer The first two bytes are normally loaded into the CX register, the second two bytes into the DX register, and the last byte into the AL register. This is the call used for the C:H:S addressing scheme of the original IBM-PC BIOS. LILO checks that the 64Kb DMA boundary is never crossed by a call, and that the count never exceeds the sector count of one track on the disk. When 'linear' is specified, a 24-bit, 0 based addressing scheme is employed. The low 8 bits are in 'sector'; the middle 8 bits in 'cylinder'; and the high 8 bits are in 'head'. To flag this as a 'linear' address, the 'device' byte has bit 6 set (mask 0x40 or'ed in). The count field is a maximum of 128, since anything greater would cross a 64Kb DMA boundary. It is up to the loader code (second stage only), to check that no track boundary is crossed. The situation is more complicated with 'lba32' addressing. It is flagged with bit 5 of the 'device' byte being set (mask 0x20 or'ed in). The 32-bit address is spread over the 'sector', 'cylinder', 'head', and 'count' fields, from low byte to high byte, respectively. Whenever this full 32-bit address is specified explicitly, the actual sector count to transfer is implied to be one (1), and this fact is flagged in the 'device' byte by setting bit 5 (mask 0x10 or'ed in). When a multi-sector transfer is called for, the high 8-bits of the address are NOT specified explicitly, but are assumed to be the same as the previous transfer, the 'count' of sectors to transfer will be in the range [2..127], and bit 5 (mask 0x10) of the 'device' byte will be clear. The first-stage loader uses single sector transfers only, so it uses a simplified disk read routine, always assumes a sector transfer count of 1, and always assumes that the full 32-bit address of the sector is specified when 'lba32' mode is detected in the 'device' byte. However, the second- stage loader is capable of multi-sector transfers when map-compaction has been used (-c switch, or 'compact' global option), so it uses the fully capable read routine to load the -initrd- image, and the -kernel- image. Both 'linear' and 'lba32' will use the Enhanced BIOS packet calls, if they are available. Otherwise, the disk address is converted to C:H:S, using the disk geometry returned by (int 0x13, AH=8). If cylinder overflow occurs -- i.e., cylinder > 1023, then error code '9f' is issued. The BIOS calls used to implement large disk booting conform to the Enhanced Disk Drive Specification, version 3.0, rev 0.8, dated March 12, 1998. This document is available on-line from Phoenix Technologies Ltd., at: http://www.phoenix.com/products/specs.html Known bugs: The chain loader, 'os2_d.b', still will not boot OS2 4.0 from a secondary partition on my "D:" drive. Boot Manager can, and I am still working on the problem. ---------------------------------------------------------------------------- Version 21 Important: The file INCOMPAT contains vital (in)compatibility information for this release of LILO. Read it before proceeding. Installing boot loaders is inherently dangerous. Be sure to have some means to boot your system from a different media if you install LILO on your hard disk. There is also a LaTeX version of this document in the "doc" directory. It is much nicer to read than pure ASCII. Installation ------------ Please read the file INCOMPAT for compatibility notes. The installation procedure is described in the section "Normal first-time installation". Please read "Booting basics" for the whole story. *** QUICK INSTALLATION *** If you want to install LILO on your hard disk and if you don't want to use all its features, you can use the quick installation script. Read QuickInst for details. LILO is a versatile boot loader for Linux. It does not depend on a specific file system, can boot Linux kernel images from floppy disks and from hard disks and can even act as a "boot manager" for other operating systems.* * PC/MS-DOS, DR DOS, OS/2, Windows 95, Windows NT, 386BSD, SCO UNIX, Unixware, ... One of up to sixteen different images can be selected at boot time. Various parameters, such as the root device, can be set independently for each kernel. LILO can even be used as the master boot record. This document introduces the basics of disk organization and booting, continues with an overview of common boot techniques and finally describes installation and use of LILO in greater detail. The troubleshooting section at the end describes diagnostic messages and contains suggestions for most problems that have been observed in the past. Please read at least the sections about installation and configuration if you're already using an older version of LILO. This distribution is accompanied by a file named INCOMPAT that describes further incompatibilities to older versions. For the impatient: there is a quick-installation script to create a simple but quite usable installation. See section "Quick installation" for details. But wait ... here are a few easy rules that will help you to avoid most problems people experience with LILO: - _Don't panic._ If something doesn't work, try to find out what is wrong, try to verify your assumption and only then attempt to fix it. - Read the documentation. Especially if what the system does doesn't correspond to what you think it should do. - Make sure you have an emergency boot disk, that you know how to use it, and that it is always kept up to date. - Run /sbin/lilo _whenever_ the kernel or any part of LILO, including its configuration file, has changed. When in doubt, run it. You can't run /sbin/lilo too many times. - If performing a destructive upgrade and/or erasing your Linux partitions, de-install LILO _before_ that if using it as the MBR. - Don't trust setup scripts. Always verify the /etc/lilo.conf they create before booting. - If using a big disk, be prepared for inconveniences: you may have to use the LINEAR option. System overview --------------- LILO is a collection of several programs and other files: The map installer is the program you run under Linux to put all files belonging to LILO at the appropriate places and to record information about the location of data needed at boot time. This program normally resides in /sbin/lilo. It has to be run to refresh that information whenever any part of the system that LILO knows about changes, e.g. after installing a new kernel. Various files contain data LILO needs at boot time, e.g. the boot loader. Those files normally reside in /boot. The most important files are the boot loader (see below) and the map file (/boot/map), where the map installer records the location of the kernel(s).* Another important file is the configuration file, which is normally called /etc/lilo.conf The boot loader is the part of LILO that is loaded by the BIOS and that loads kernels or the boot sectors of other operating systems. It also provides a simple command-line interface to interactively select the item to boot and to add boot options. * LILO does not know how to read a file system. Instead, the map installer asks the kernel for the physical location of files (e.g. the kernel image(s)) and records that information. This allows LILO to work with most file systems that are supported by Linux. LILO primarily accesses the following parts of the system: The root file system partition is important for two reasons: first, LILO sometimes has to tell the kernel where to look for it. Second, it is frequently a convenient place for many other items LILO uses, such as the boot sector, the /boot directory, and the kernels. The boot sector contains the first part of LILO's boot loader. It loads the much larger second-stage loader. Both loaders are typically stored in the file /boot/boot.b The kernel is loaded and started by the boot loader. Kernels typically reside in the root directory or in /boot. Note that many of the files LILO needs at boot time have to be accessible with the BIOS. This creates certain restrictions, see section "BIOS restrictions". Introduction ============ The following sections describe how PCs boot in general and what has to be known when booting Linux and using LILO in particular. Disk organization ----------------- When designing a boot concept, it is important to understand some of the subtleties of how PCs typically organize disks. The most simple case are floppy disks. They consist of a boot sector, some administrative data (FAT or super block, etc.) and the data area. Because that administrative data is irrelevant as far as booting is concerned, it is regarded as part of the data area for simplicity. +---------------------------+ |Boot sector| | |-----------+ | | | | Data area | | | | | +---------------------------+ The entire disk appears as one device (e.g. /dev/fd0) on Linux. The MS-DOS boot sector has the following structure: +------------------------+ 0x000 |Jump to the program code| |------------------------| 0x003 | | | Disk parameters | | | |------------------------| 0x02C/0x03E | | | Program code | | | | | |------------------------| 0x1FE | Magic number (0xAA55) | +------------------------+ LILO uses a similar boot sector, but it does not contain the disk parameters part. This is no problem for Minix, Ext2 or similar file systems, because they don't look at the boot sector, but putting a LILO boot sector on an MS-DOS file system would make it inaccessible for MS-DOS. Hard disks are organized in a more complex way than floppy disks. They contain several data areas called partitions. Up to four so-called primary partitions can exist on an MS-DOS hard disk. If more partitions are needed, one primary partition is used as an extended partition that contains several logical partitions. The first sector of each hard disk contains a partition table, and an extended partition and _each_ logical partition contains a partition table too. +--------------------------------------------+ | Partition table /dev/hda | | +------------------------------------------| | | Partition 1 /dev/hda1 | | | | | |------------------------------------------| | | Partition 2 /dev/hda2 | | | | +--------------------------------------------+ The entire disk can be accessed as /dev/hda, /dev/hdb, /dev/sda, etc. The primary partitions are /dev/hda1 ... /dev/hda4. +--------------------------------------------+ | Partition table /dev/hda | | +------------------------------------------| | | Partition 1 /dev/hda1 | | | | | |------------------------------------------| | | Partition 2 /dev/hda2 | | | | | |------------------------------------------| | | Extended partition /dev/hda3 | | | +----------------------------------------| | | | Extended partition table | | | |----------------------------------------| | | | Partition 3 /dev/hda5 | | | | | | | |----------------------------------------| | | | Extended partition table | | | |----------------------------------------| | | | Partition 4 /dev/hda6 | | | | | +--------------------------------------------+ This hard disk has two primary partitions and an extended partition that contains two logical partitions. They are accessed as /dev/hda5 ... Note that the partition tables of logical partitions are not accessible as the first blocks of some devices, while the main partition table, all boot sectors and the partition tables of extended partitions are. Partition tables are stored in partition boot sectors. Normally, only the partition boot sector of the entire disk is used as a boot sector. It is also frequently called the master boot record (MBR). Its structure is as follows: +------------------------+ 0x000 | | | Program code | | | | | |------------------------| 0x1BE | Partition table | | | |------------------------| 0x1FE | Magic number (0xAA55) | +------------------------+ The LILO boot sector is designed to be usable as a partition boot sector. (I.e. there is room for the partition table.) Therefore, the LILO boot sector can be stored at the following locations: - boot sector of a Linux floppy disk. (/dev/fd0, ...) - MBR of the first hard disk. (/dev/hda, /dev/sda, ...) - boot sector of a primary Linux file system partition on the first hard disk. (/dev/hda1, ...) - partition boot sector of an extended partition on the first hard disk. (/dev/hda1, ...)* * Most FDISK-type programs don't believe in booting from an extended partition and refuse to activate it. LILO is accompanied by a simple program (activate) that doesn't have this restriction. Linux fdisk also supports activating extended partitions. It _can't_ be stored at any of the following locations: - boot sector of a non-Linux floppy disk or primary partition. - a Linux swap partition. - boot sector of a logical partition in an extended partition.* - on the second hard disk. (Unless for backup installations, if the current first disk will be removed or disabled, or if some other boot loader is used, that is capable of loading boot sectors from other drives.) * LILO can be forced to put the boot sector on such a partition by using the -b option or the BOOT variable. However, only few programs that operate as master boot records support booting from a logical partition. Although LILO tries to detect attempts to put its boot sector at an invalid location, you should not rely on that. Booting basics -------------- When booting from a floppy disk, the first sector of the disk, the so-called boot sector, is loaded. That boot sector contains a small program that loads the respective operating system. MS-DOS boot sectors also contain a data area, where disk and file system parameters (cluster size, number of sectors, number of heads, etc.) are stored. When booting from a hard disk, the very first sector of that disk, the so-called master boot record (MBR) is loaded. This sector contains a loader program and the partition table of the disk. The loader program usually loads the boot sector, as if the system was booting from a floppy. Note that there is no functional difference between the MBR and the boot sector other than that the MBR contains the partition information but doesn't contain any file system-specific information (e.g. MS-DOS disk parameters). The first 446 (0x1BE) bytes of the MBR are used by the loader program. They are followed by the partition table, with a length of 64 (0x40) bytes. The last two bytes contain a magic number that is sometimes used to verify that a given sector really is a boot sector. There is a large number of possible boot configurations. The most common ones are described in the following sections. MS-DOS alone - - - - - - +-------------------------------------------------------+ | Master Boot Record Boot sector Operating system | |-------------------------------------------------------| | DOS-MBR ------------> MS-DOS ------> COMMAND.COM | +-------------------------------------------------------+ This is what usually happens when MS-DOS boots from a hard disk: the DOS-MBR determines the active partition and loads the MS-DOS boot sector. This boot sector loads MS-DOS and finally passes control to COMMAND.COM. (This is greatly simplified.) LOADLIN - - - - +------------------------------------------------------------+ | Master Boot Record Boot sector Operating system | |------------------------------------------------------------| | DOS-MBR ------------> MS-DOS ------> COMMAND.COM | | ---> LOADLIN ------> Linux | +------------------------------------------------------------+ A typical LOADLIN setup: everything happens like when booting MS-DOS, but in CONFIG.SYS or AUTOEXEC.BAT, LOADLIN is invoked. Typically, a program like BOOT.SYS is used to choose among configuration sections in CONFIG.SYS and AUTOEXEC.BAT. This approach has the pleasant property that no boot sectors have to be altered. Please refer to the documentation accompanying the LOADLIN package for installation instructions and further details. LILO started by DOS-MBR - - - - - - - - - - - - +-------------------------------------------------------+ | Master Boot Record Boot sector Operating system | |-------------------------------------------------------| | DOS-MBR ------------> LILO --------> Linux | | ---> other OS | +-------------------------------------------------------+ This is a "safe" LILO setup: LILO is booted by the DOS-MBR. No other boot sectors have to be touched. If the other OS (or one of them, if there are several other operating systems being used) should be booted without using LILO, the other partition has to be marked "active" with fdisk or activate. Installation: - install LILO with its boot sector on the Linux partition. - use fdisk or activate to make that partition active. - reboot. Deinstallation: - make a different partition active. - install whatever should replace LILO and/or Linux. Several alternate branches - - - - - - - - - - - - - +------------------------------------------------------------+ | Master Boot Record Boot sector Operating system | |------------------------------------------------------------| | DOS-MBR ------------> MS-DOS ------> COMMAND.COM | | ---> LOADLIN ------> Linux | | ---> LILO --------> Linux | | ---> MS-DOS --- ... | +------------------------------------------------------------+ An extended form of the above setup: the MBR is not changed and both branches can either boot Linux or MS-DOS. (LILO could also boot other operating systems.) LILO started by BOOTACTV* - - - - - - - - - - - - - * Other, possibly better known boot switchers, e.g. OS/2 BootManager operate in a similar way. The installation procedures typically vary. +-------------------------------------------------------+ | Master Boot Record Boot sector Operating system | |-------------------------------------------------------| | BOOTACTV -----------> LILO --------> Linux | | ---> other OS | +-------------------------------------------------------+ Here, the MBR is replaced by BOOTACTV (or any other interactive boot partition selector) and the choice between Linux and the other operating system(s) can be made at boot time. This approach should be used if LILO fails to boot the other operating system(s).* * And the author would like to be notified if booting the other operating system(s) doesn't work with LILO, but if it works with an other boot partition selector. Installation: - boot Linux. - make a backup copy of your MBR on a floppy disk, e.g. dd if=/dev/hda of=/fd/MBR bs=512 count=1 - install LILO with the boot sector on the Linux partition. - install BOOTACTV as the MBR, e.g. dd if=bootactv.bin of=/dev/hda bs=446 count=1 - reboot. Deinstallation: - boot Linux. - restore the old MBR, e.g. dd if=/MBR of=/dev/hda bs=446 count=1 or FDISK /MBR under MS-DOS. If replacing the MBR appears undesirable and if a second Linux partition exists (e.g. /usr, _not_ a swap partition), BOOTACTV can be merged with the partition table and stored as the "boot sector" of that partition. Then, the partition can be marked active to be booted by the DOS-MBR. Example: # dd if=/dev/hda of=/dev/hda3 bs=512 count=1 # dd if=bootactv.bin of=/dev/hda3 bs=446 count=1 _WARNING:_ Whenever the disk is re-partitioned, the merged boot sector on that "spare" Linux partition has to be updated too. LILO alone - - - - - +----------------------------------------+ | Master Boot Record Operating system | |----------------------------------------| | LILO ---------------> Linux | | ---> other OS | +----------------------------------------+ LILO can also take over the entire boot procedure. If installed as the MBR, LILO is responsible for either booting Linux or any other OS. This approach has the disadvantage, that the old MBR is overwritten and has to be restored (either from a backup copy, with FDISK /MBR on recent versions of MS-DOS or by overwriting it with something like BOOTACTV) if Linux should ever be removed from the system. You should verify that LILO is able to boot your other operating system(s) before relying on this method. Installation: - boot Linux. - make a backup copy of your MBR on a floppy disk, e.g. dd if=/dev/hda of=/fd/MBR bs=512 count=1 - install LILO with its boot sector as the MBR. - reboot. Deinstallation: - boot Linux. - restore the old MBR, e.g. dd if=/fd/MBR of=/dev/hda bs=446 count=1 If you've installed LILO as the master boot record, you have to explicitly specify the boot sector (configuration variable BOOT=...) when updating the map. Otherwise, it will try to use the boot sector of your current root partition, which will usually work, but it will probably leave your system unbootable. Names - - - The following names have been used to describe boot sectors or parts of operating systems: "DOS-MBR" is the original MS-DOS MBR. It scans the partition table for a partition that is marked "active" and loads the boot sector of that partition. Programs like MS-DOS' FDISK, Linux fdisk or activate (accompanies LILO) can change the active marker in the partition table. "MS-DOS" denotes the MS-DOS boot sector that loads the other parts of the system (IO.SYS, etc.). "COMMAND.COM" is the standard command interpreter of MS-DOS. "LOADLIN" is a program that loads a Linux kernel image from an MS-DOS partition into memory and executes it. It is usually invoked from CONFIG.SYS and is used in combination with a CONFIG.SYS configuration switcher, like BOOT.SYS.* "LILO" can either load a Linux kernel or the boot sector of any other operating system. It has a first stage boot sector that loads the remaining parts of LILO from various locations.** "BOOTACTV" permits interactive selection of the partition from which the boot sector should be read. If no key is pressed within a given interval, the partition marked active is booted. BOOTACTV is included in the pfdisk package. There are also several similar programs, like PBOOT and OS-BS.*** * LOADLIN is available for anonymous FTP from ftp://tsx-11.mit.edu/pub/linux/dos_utils/lodlin.tar.gz ftp://sunsite.unc.edu/pub/Linux/system/boot/dualboot/lodlin.tgz BOOT.SYS is available for anonymous FTP from ftp://ftp.funet.fi/pub/Linux/tools/boot142.zip ** LILO can be found in ftp://tsx-11.mit.edu/pub/linux/packages/lilo/lilo-.tar.gz ftp://sunsite.unc.edu/pub/Linux/system/boot/lilo/lilo-.tar.gz ftp://lrcftp.epfl.ch/pub/linux/local/lilo/lilo-.tar.gz *** pfdisk is available for anonymous FTP from ftp://sunsite.unc.edu/pub/Linux/utils/disk-management/pfdisk.tar.Z or ftp://ftp.funet.fi/pub/Linux/tools/pfdisk.tar.Z PBOOT can be found in ftp://ftp.funet.fi/pub/Linux/tools/pboot.zip Choosing the "right" boot concept ----------------------------------- Although LILO can be installed in many different ways, the choice is usually limited by the present setup and therefore, typically only a small number of configurations which fit naturally into an existing system remains. The following sections describe various possible cases. See also section "BIOS restrictions". The configuration file /etc/lilo.conf for the examples could look like this: boot = /dev/hda2 compact image = /vmlinuz image = /vmlinuz.old other = /dev/hda1 table = /dev/hda label = msdos It installs a Linux kernel image (/vmlinuz), an alternate Linux kernel image (/vmlinuz.old) and a chain loader to boot MS-DOS from /dev/hda1. The option COMPACT on the second line instructs the map installer to optimize loading. In all examples, the names of the IDE-type hard disk devices (/dev/hda...) are used. Everything applies to other disk types (e.g. SCSI disks; /dev/sda...) too. BIOS restrictions - - - - - - - - - Nowadays, an increasing number of systems is equipped with comparably large disks or even with multiple disks. At the time the disk interface of the standard PC BIOS has been designed (about 16 years ago), such configurations were apparently considered to be too unlikely to be worth supporting. The most common BIOS restrictions that affect LILO are the limitation to two hard disks and the inability to access more than 1024 cylinders per disk. LILO can detect both conditions, but in order to work around the underlying problems, manual intervention is necessary. The drive limit does not exist in every BIOS. Some modern motherboards and disk controllers are equipped with a BIOS that supports more (typically four) disk drives. When attempting to access the third, fourth, etc. drive, LILO prints a warning message but continues. Unless the BIOS really supports more than two drives, the system will _not_ be able to boot in that case.* * However, if only "unimportant" parts of the system are located on the "high" drives, some functionality may be available. The cylinder limit is a very common problem with IDE disks. There, the number of cylinders may already exceed 1024 if the drive has a capacity of more than 504 MB. Many SCSI driver BIOSes present the disk geometry in a way that makes the limit occur near 1 GB. Modern disk controllers may even push the limit up to about 8 GB. All cylinders beyond the 1024th are inaccessible for the BIOS. LILO detects this problem and aborts the installation (unless the LINEAR option is used, see section "Global options"). Note that large partitions that only partially extend into the "forbidden zone" are still in jeopardy even if they appear to work at first, because the file system does not know about the restrictions and may allocate disk space from the area beyond the 1024th cylinder when installing new kernels. LILO therefore prints a warning message but continues as long as no imminent danger exists. There are four approaches of how such problems can be solved: - use of a different partition which is on an accessible disk and which does not exceed the 1024 cylinder limit. If there is only a DOS partition which fulfills all the criteria, that partition can be used to store the relevant files. (See section "/boot on a DOS partition".) - rearranging partitions and disks. This is typically a destructive operation, so extra care should be taken to make good backups. - if the system is running DOS or Windows 95, LOADLIN can be used instead of LILO. - if all else fails, installation of a more capable BIOS, a different controller or a different disk configuration. LILO depends on the BIOS to load the following items: - /boot/boot.b - /boot/map (created when running /sbin/lilo) - all kernels - the boot sectors of all other operating systems it boots - the startup message, if one has been defined Normally, this implies that the Linux root file system should be in the "safe" area. However, it is already sufficient to put all kernels into /boot and to either mount a "good" partition on /boot or to let /boot be a symbolic link pointing to or into such a partition. See also /usr/src/linux/Documentation/ide.txt (or /usr/src/linux/drivers/block/README.ide in older kernels) for a detailed description of problems with large disks. One disk, Linux on a primary partition - - - - - - - - - - - - - - - - - - - If at least one primary partition of the first hard disk is used as a Linux file system (/, /usr, etc. but _not_ as a swap partition), the LILO boot sector should be stored on that partition and it should be booted by the original master boot record or by a program like BOOTACTV. +--------------------------+ | MBR /dev/hda | | +------------------------| | | MS-DOS /dev/hda1 | | |------------------------| --> | | Linux / /dev/hda2 | +--------------------------+ In this example, the BOOT variable could be omitted, because the boot sector is on the root partition. One disk, Linux on a logical partition - - - - - - - - - - - - - - - - - - - If no primary partition is available for Linux, but at least one logical partition of an extended partition on the first hard disk contains a Linux file system, the LILO boot sector should be stored in the partition sector of the extended partition and it should be booted by the original master boot record or by a program like BOOTACTV. +--------------------------+ | MBR /dev/hda | | +------------------------| | | MS-DOS /dev/hda1 | | |------------------------| --> | | Extended /dev/hda2 | | | +----------------------| | | | Linux /dev/hda5 | | | |----------------------| | | | ... /dev/hda6 | +--------------------------+ Because many disk partitioning programs refuse to make an extended partition (in our example /dev/hda2) active, you might have to use activate, which comes with the LILO distribution. OS/2 BootManager should be able to boot LILO boot sectors from logical partitions. The installation on the extended partition itself is not necessary in this case. Two disks, Linux (at least partially) on the first disk - - - - - - - - - - - - - - - - - - - - - - - - - - - - This case is equivalent to the configurations where only one disk is in the system. The Linux boot sector resides on the first hard disk and the second disk is used later in the boot process. Only the location of the boot sector matters - everything else (/boot/boot.b, /boot/map, the root file system, a swap partition, other Linux file systems, etc.) can be located anywhere on the second disk, provided that the constraints described in section "BIOS restrictions" are met. Two disks, Linux on second disk, first disk has an extended partition - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - If there is no Linux partition on the first disk, but there is an extended partition, the LILO boot sector can be stored in the partition sector of the extended partition and it should be booted by the original master boot record or by a program like BOOTACTV. FIRST DISK SECOND DISK +--------------------------+ +--------------------------+ | MBR /dev/hda | | MBR /dev/hdb | | +------------------------| | +------------------------| | | MS-DOS /dev/hda1 | | | Linux /dev/hdb1 | | |------------------------| | |------------------------| --> | | Extended /dev/hda2 | | | ... /dev/hdb2 | | | +----------------------| | | | | | | ... /dev/hda5 | | | | | | |----------------------| | | | | | | ... /dev/hda6 | | | | +--------------------------+ +--------------------------+ The program activate, that accompanies LILO, may have to be used to set the active marker on an extended partition, because MS-DOS' FDISK and some older version of Linux fdisk refuse to do that. (Which is generally a good idea.) Two disks, Linux on second disk, first disk has no extended partition - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - If there is neither a Linux partition nor an extended partition on the first disk, then there's only one place left, where a LILO boot sector could be stored: the master boot record. In this configuration, LILO is responsible for booting all other operating systems too. FIRST DISK SECOND DISK +--------------------------+ +--------------------------+ --> | MBR /dev/hda | | MBR /dev/hdb | | +------------------------| | +------------------------| | | MS-DOS /dev/hda1 | | | Linux /dev/hdb1 | | |------------------------| | |------------------------| | | ... /dev/hda2 | | | ... /dev/hdb2 | +--------------------------+ +--------------------------+ You should back up your old MBR before installing LILO and verify that LILO is able to boot your other operating system(s) before relying on this approach. The line boot = /dev/hda2 in /etc/lilo.conf would have to be changed to boot = /dev/hda in this example. More than two disks - - - - - - - - - - On systems with more than two disks, typically only the first two can be accessed. The configuration choices are therefore the same as with two disks. When attempting to access one of the extra disks, LILO displays a warning message ( Warning: BIOS drive 0x may not be accessible ) but does not abort. This is done in order to allow the lucky few whose BIOS (or controller-BIOS) does support more than two drives to make use of this feature. By all others, this warning should be considered a fatal error. Note that the two disks restriction is only imposed by the BIOS. Linux normally has no problems using all disks once it is booted. /boot on a DOS partition - - - - - - - - - - - - Recent kernels support all the functions LILO needs to map files also on MS-DOS (or UMSDOS) file systems. Since DOS partitions tend to occupy exactly the places where BIOS restrictions (see section "BIOS restrictions") are invisible, they're an ideal location for /boot if the native Linux file systems can't be used because of BIOS problems. In order to accomplish this, the DOS partition is mounted read-write, a directory (e.g. /dos/linux) is created, all files from /boot are moved to that directory, /boot is replaced by a symbolic link to it, the kernels are also moved to the new directory, their new location is recorded in /etc/lilo.conf, and finally /sbin/lilo is run. From then on, new kernels must always be copied into that directory on the DOS partition before running /sbin/lilo, e.g. when recompiling a kernel, the standard procedure changes from # make zlilo to # make zImage # mv /dos/linux/vmlinuz /dos/linux/vmlinuz.old # mv arch/i386/boot/zImage /dos/linux/vmlinuz # /sbin/lilo _WARNING:_ De-fragmenting such a DOS partition is likely to make Linux or even the whole system unbootable. Therefore, the DOS partition should either not be de-fragmented, or a Linux boot disk should be prepared (and tested) to bring up Linux and to run /sbin/lilo after the de-fragmentation.* * Setting the "system" attribute from DOS on the critical files (e.g. everything in C:\LINUX) may help to protect them from being rearranged. However, the boot floppy should still be ready, just in case. The boot prompt =============== Immediately after it's loaded, LILO checks whether one of the following is happening: - any of the [Shift], [Control] or [Alt] keys is pressed. - [CapsLock] or [ScrollLock] is set. If this is the case, LILO displays the boot: prompt and waits for the name of a boot image (i.e. Linux kernel or other operating system). Otherwise, it boots the default boot image* or - if a delay has been specified - waits for one of the listed activities until that amount of time has passed. * The default boot image is either the first boot image, the image specified with the DEFAULT variable, or the image that has been selected at the boot prompt. At the boot prompt, the name of the image to boot can be entered. Typing errors can be corrected with [BackSpace], [Delete], [Ctrl U] and [Ctrl X]. A list of known images can be obtained by pressing [?] or [Tab]. If [Enter] is pressed and no file name has been entered, the default image is booted. Boot command-line options ------------------------- LILO is also able to pass command-line options to the kernel. Command-line options are words that follow the name of the boot image and that are separated by spaces. Example: boot: linux single root=200 This document only gives an overview of boot options. Please consult Paul Gortmaker's BootPrompt-HOWTO for a more complete and more up to date list. You can get it from ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/BootPrompt-HOWTO.gz or from one of the many mirror sites. Standard options - - - - - - - - Recent kernels recognize a large number of options, among them are debug , no387 , no-hlt , ramdisk= , reserve=,,... , root= , ro , and rw . All current init programs also recognize the option single . The options lock and vga are processed by the boot loader itself. Boot command-line options are always case-sensitive. single boots the system in single-user mode. This bypasses most system initialization procedures and directly starts a root shell on the console. Multi-user mode can typically be entered by exiting the single-user shell or by rebooting. root= changes the root device. This overrides settings that may have been made in the boot image and on the LILO command line. is either the hexadecimal device number or the full path name of the device, e.g. /dev/hda3.* * The device names are hard-coded in the kernel. Therefore, only the "standard" names are supported and some less common devices may not be recognized. In those cases, only numbers can be used. reserve=,,... reserves IO port regions. This can be used to prevent device drivers from auto-probing addresses where other devices are located, which get confused by the probing. ro instructs the kernel to mount the root file system read-only. rw mounts it read-write. If neither ro nor rw is specified, the setting from the boot image is used. no-hlt avoids executing a HLT instructions whenever the system is idle. HLT normally significantly reduces power consumption and therefore also heat dissipation of the CPU, but may not work properly with some clone CPUs. no387 disables using the hardware FPU even if one is present. debug enables more verbose console logging. Recent kernels also accept the options init= and noinitrd . init specifies the name of the init program to execute. Therefore, if single mode cannot be entered because init is mis-configured, one may still be able to reach a shell using init=/bin/sh. noinitrd disables automatic loading of the initial RAM disk. Instead, its content is then available on /dev/initrd. vga= alters the VGA mode set at startup. The values normal , extended , ask or a decimal number are recognized. (See also "Booting kernel images from a file".) kbd=,... preloads a sequence of keystrokes in the BIOS keyboard buffer. The keystrokes have to be entered as 16 bit hexadecimal numbers, with the upper byte containing the scan code and the lower byte containing the ASCII code. Note that most programs only use the ASCII code, so the scan code can frequently be omitted. Scan code tables can be found in many books on PC hardware. Note that scan codes depend on the keyboard layout. Finally, lock stores the current command-line as the default command-line, so that LILO boots the same image with the same options (including lock ) when invoked the next time. Device-specific options - - - - - - - - - - - - There is also a plethora of options to specify certain characteristics (e.g. IO and memory addresses) of devices. Some common ones are ether , floppy , hd , bmouse , and sound . The usage of these options is