Booting a foreign operating system - - - - - - - - - - - - - - - - - LILO can even boot other operating systems, i.e. MS-DOS. To boot an other operating system, the name of a loader program, the device or file that contains the boot sector and the device that contains the partition table have to be specified. The boot sector is merged with the partition table and stored in the map file. Currently, the loaders chain.b and os2_d.b exist. chain.b simply starts the specified boot sector.* os2_d.b it a variant of chain.b that can boot OS/2 from the second hard disk. The MAP-DRIVE option has to be used with os2_d.b to actually swap the drives. * The boot sector is loaded by LILO's secondary boot loader before control is passed to the code of chain.b. The image is specified as follows: OTHER= or OTHER= In addition to the options listen in section "Per-image options for kernels", the following variables are recognized: CHANGE Change the partition table according to the rules specified in this CHANGE section. This option is intended for booting systems which find their partitions by examining the partition table. See section "Partition type changes" for details. LOADER= Specifies the chain loader that should be used. If it is omitted, /boot/chain.b is used. MAP-DRIVE= Instructs chain.b to installs a resident driver that re-maps the floppy or hard disk drives. This way, one can boot any operating system from a hard disk different from the first one, as long as that operating system uses _only_ the BIOS to access that hard disk.* This is known to work for PC/MS-DOS. * So you should be very suspicious if the operating system requires any specific configuration or even drivers to use the disk it is booted from. Since there is a general trend to use optimized drivers to fully exploit the hardware capabilities (e.g. non-blocking disk access), booting systems from the second disk may become increasingly difficult. MAP-DRIVE is followed by the variable TO= which specifies the drive that should effectively be accessed instead of the original one. The list of mappings is only searched until the first match is found. It is therefore possible to "swap" drives, see the second example below. TABLE= Specifies the device that contains the partition table. LILO does not pass partition information to the booted operating system if this variable is omitted. (Some operating systems have other means to determine from which partition they have been booted. E.g. MS-DOS usually stores the geometry of the boot disk or partition in its boot sector.) Note that /sbin/lilo must be re-run if a partition table mapped referenced with TABLE is modified. UNSAFE Do not access the boot sector at map creation time. This disables some sanity checks, including a partition table check. If the boot sector is on a fixed-format floppy disk device, using UNSAFE avoids the need to put a readable disk into the drive when running the map installer. UNSAFE and TABLE are mutually incompatible. None of these options can be set in the global options section. Examples: other = /dev/hda2 label = dos table = /dev/hda other = /dev/hdb2 label = os2 loader = /boot/os2_d.b map-drive = 0x80 to = 0x81 map-drive = 0x81 to = 0x80 Disk geometry ------------- For floppies and most hard disks, LILO can obtain the disk geometry information from the kernel. Unfortunately, there are some exotic disks or adapters which may either not supply this information or which may even return incorrect information. If no geometry information is available, LILO reports either the error geo_query_dev HDIO_GETGEO (dev 0x) or Device 0x: Got bad geometry // If incorrect information is returned, booting may fail in several ways, typically with a partial "LILO" banner message. In this document, that is called a "geometry mismatch". The next step should be to attempt setting the LBA32 or LINEAR configuration variable or the -L or -l command-line option. If this doesn't help, the entire disk geometry has to be specified explicitly. Note that LINEAR doesn't always work with floppy disks. Another common use of disk sections is if an (E)IDE and a SCSI drive are used in the same system and the BIOS is configured to use the SCSI drive as the first drive. (Normally, the (E)IDE drive would be the first drive and the SCSI drive would be the second one.) Since LILO doesn't know how the BIOS is configured, it needs to be told explicitly about this arrangement. (See the second example below.) Obtaining the geometry - - - - - - - - - - - The disk geometry parameters can be obtained by booting MS-DOS and running the program DPARAM.COM with the hexadecimal BIOS code of the drive as its argument, e.g. dparam 0x80 for the first hard disk. It displays the number of sectors per track, the number of heads per cylinder and the number of cylinders. All three numbers are one-based. Alternatively, the geometry may also be determined by reading the information presented by the "setup" section of the ROM-BIOS or by using certain disk utilities under operating systems accessing the disk through the BIOS. Specifying the geometry - - - - - - - - - - - - Disk geometry parameters are specified in the options section of the configuration file. Each disk parameter section begins with DISK=, similar to the way how boot images are specified. It is suggested to group disk parameter sections together, preferably at the beginning or the end of the options section. For each disk, the following variables can be specified: BIOS= Is the number the BIOS uses to refer to that device. Normally, it's 0x80 for the first hard disk and 0x81 for the second hard disk. Note that hexadecimal numbers have to begin with "0x". If BIOS is omitted, LILO tries to "guess" that number. SECTORS= and HEADS= specify the number of sectors per track and the number of heads, i.e. the number of tracks per cylinder. Both parameters have to be either specified together or they have to be entirely omitted. If omitted, LILO tries to obtain that geometry information from the kernel. CYLINDERS= Specifies the number of cylinders. This value is only used for sanity checks. If CYLINDERS is omitted, LILO uses the information obtained from the kernel if geometry information had to be requested in order to determine some other parameter. Otherwise,* it just assumes the number of cylinders to be 1024, which is the cylinder limit imposed by the BIOS. INACCESSIBLE Marks the device as inaccessible (for the BIOS). This is useful if some disks on the system can't be read by the BIOS, although LILO "thinks" they can. If one accidentally tries to use files located on such disks for booting, the map installer won't notice and the system becomes unbootable. The most likely use of INACCESSIBLE is to prevent repetition after experiencing such a situation once. No other variables may be specified if a device is configured as INACCESSIBLE. * I.e. if the BIOS device code, the number of sectors, the number of heads and the partition start are specified. Note that the number of cylinders may appear to vary if CYLINDERS is absent and only some of the partition starts are specified. Additionally, partition subsections can be added with PARTITION=. Each partition section can contain only one variable: START= Specifies the zero-based number of the start sector of that partition. The whole disk always has a partition offset of zero. The partition offset is only necessary when using devices for which the kernel does not provide that information, e.g. CD-ROMs. Examples: disk = /dev/sda bios = 0x80 sectors = 32 heads = 64 cylinders = 632 partition = /dev/sda1 start = 2048 partition = /dev/sda2 start = 204800 partition = /dev/sda3 start = 500000 partition = /dev/sda4 start = 900000 disk = /dev/sda bios = 0x80 disk = /dev/hda bios = 0x81 Partition table manipulation ---------------------------- Some non-Linux operating systems obtain information about their partitions (e.g. their equivalent of the root file system) from the partition table. If more than one such operating system is installed on a PC, they may have conflicting interpretations of the content of the partition table. Those problems can be avoided by changing the partition table, depending on which operating system is being booted. Partition table changes are specified in a CHANGE section in the configuration file section describing the foreign operating system. Note that CHANGE sections are only accepted if the build-time option REWRITE_TABLE is set. The CHANGE section contains subsections for each partition whose table entry needs to be modified. Partitions are specified with PARTITION= Changes are applied in the sequence in which they appear in the configuration file. Configurations containing changes that are redundant either by repeating a previous change or by changing its result further are invalid and refused by the map installer. Internally, all changes are expressed as rules which specify the location (disk and offset in the partition table), the value this location must contain before the change, and the value that has to be stored. As a safety measure, the rule is ignored if the previous value is found to be different. Partition activation - - - - - - - - - - This option is intended for booting systems which determine their boot partition by examining the active flag in the partition table. The flag is enabled with ACTIVATE and disabled with DEACTIVATE. Note that only the current partition is affected. LILO does not automatically change the active flags of other partitions and it also allows more than one partition to be active at the same time. Example: other = /dev/sda4 label = sco change partition = /dev/sda4 activate partition = /dev/sda3 deactivate Partition type change rules - - - - - - - - - - - - - - Partition type changes are normally a transition between two possible values, e.g. a typical convention is to set the lowest bit in the upper nibble of the partition type (i.e. 0x10) in order to "hide", and to clear it to "unhide" a partition. LILO performs these changes based on a set of rules. Each rule defines the name of a partition type, its normal value, and the value when hidden. Those rules are defined in the options section of the configuration file. The section defining them begins with CHANGE-RULES. The following options and variables can appear in the section: RESET Removes all previously defined rules. This is needed if a user doesn't wish to use the pre-defined rules (see below). TYPE= Adds a rule for the type with the specified name. Type names are case-insensitive. The values are defined with NORMAL= and HIDDEN=. Values can be specified as decimal or as hexadecimal numbers with a leading 0x . If only one of the values is present, the other value is assumed to be the same number, but with the most significant bit inverted. LILO pre-defines rules for the three partition types of DOS partitions. The following example removes the pre-defined rules and creates them again: change-rules reset type = DOS12 normal = 0x01 hidden = 0x11 type = DOS16_small normal = 4 # hidden is 0x14 type = DOS16_big hidden = 0x16 Partition type changes - - - - - - - - - - - Partition type changes are specified in the partition section as SET=_, where is the name of the partition type, and is its state, i.e. NORMAL or HIDDEN. Example: other = /dev/sda3 label = dos change partition = /dev/sda2 set = dos16_big_normal partition = /dev/sda3 activate set = DOS16_big_normal Only one SET variable is allowed per partition section. In the rare event that more than one SET variable is needed, further partition sections can be used.