NAME
lilo.conf - lilo 配置文件
描述
默认情况下,本文件 ( /etc/lilo.conf ) 由引导管理程序 lilo 读取 (参考 lilo(8)).
它看起来可能象这样:
-
boot = /dev/hda delay = 40 compact vga = normal root = /dev/hda1 read-only image = /zImage-2.5.99 label = try image = /zImage-1.0.9 label = 1.0.9 image = /tamu/vmlinuz label = tamu root = /dev/hdb2 vga = ask other = /dev/hda3 label = dos table = /dev/hda
该文件表明 lilo 使用设备 /dev/hda 的 Master Boot Record (简称 MBR, 主引导记录). (有关 lilo 使用方法 及与其它操作系统 相互影响的讨论, 参考 lilo 文档中 user.tex 部分).
引导时, 引导载入程序会等待 4 秒 (40 个十分之一秒), 使你有机会按下 Shift 键. 如果没有按键动作发生, 第一个核心映像文件 (/zImage-1.5.99, 也许你刚在 五分钟之前 完成的安装) 将被引导; 否则, 引导载入程序会 询问你要引导哪一个映像. 如果你不知道 有哪些选项可以选择, 按 [TAB] 键 (如果使用的 是美国键盘布局, 还可以按 [?]), 可以得到一个菜单, 这时你就可以 选择引导较新的核心, 或者是老的稳定的核心, 甚至是另外的 根文件系统上的核心, 也可以引导其它的操作系统, 在 lilo.conf 中可以配置最多 16 个映像.
正如上面所见, 配置文件以一定数量的全局选项开始 (例子中开始的 6 行), 紧接着是各映像的描述选项, 在各映像中的选项会覆盖全局选项.
全局选项
这部分有许多 可能的关键字, 下面部分尽可能按照 user.tex 中的描述进行解释.
- backup=backup-file
- 使用 backup-file 文件 (可能是一个设备,如 /dev/null) 代替原来的 /boot/boot.NNNN 存放引导扇区的备份.
- boot=boot-device
- 指定包含引导扇区的设备名称 (如硬盘分区), 如果忽略了该关键字, 引导扇区就从当前作为 root 文件系统安装的设备读取 (也可能是进行写入).
- change-rules
- 定义引导时用于改变分区类型的数字 ('隐藏'). 细节请参考 user.tex 中的 "Partition type change rules" 部分.
- compact
- 尽力把读取相邻扇区的请求合并为一次读取. 这可以显著 缩短装载时间并减小映像, 在用软盘引导时, 强烈推荐使用 `compact' 选项.
- default=name
- 使用指定的映像文件 作为默认值加以引导. 如果忽略了 `default' 选项, 配置文件中 第一个出现的映像会被引导.
- delay=tsecs
- 在装载第一个映像之前等待的十分之一秒数. 这在需要激活键盘之后立即从硬盘启动系统非常有用, 如果忽略了本选项或设置为 0 将不等待.
- disk=device-name
- 为指定的磁盘给出非标准参数, 有关细节参考 user.tex 中的 "Disk geometry" 部分. 特别有用的是 `bios=' 参数, BIOS 为磁盘编号为0x80, 0x81等,但是它不知道 Linux 磁盘对应的是哪一个 BIOS 盘 (因为这依赖于 BIOS 的设置, 也依赖于 BIOS 的类型), 所以如果你使用的是设置很特殊的系统, 你就必须说明 Linux 磁盘与 BIOS 盘之间的对应关系. 例如:
disk=/dev/sda bios=0x80 disk=/dev/hda bios=0x81
意思是, 你的第一块 SCSI 盘 (译者注: 通常id=0) 对应一号 BIOS 盘, 第一个 IDE 口上的主盘对应二号 BIOS 盘.
- disktab=disktab-file
- 指定包含磁盘参数表的文件名称. 如果忽略 `disktab' 选项, 映像安装程序查找 /etc/disktab , 不鼓励使用 disktab .
- fix-table
- 允许 lilo 调整分区表中的三维地址 (sector/head/cylinder). 每个分区表项包含有本分区起始扇区与结束扇区的三维地址和线性地址, 如果分区不是对应在整个磁道上并且有其它的操作系统 (如PC/MS-DOS 或 OS/2) 在使用同一磁盘, 它们可能会修改三维地址, lilo 可以在分区上保存两种地址的引导扇区, 如果使用了 `fix-table' 选项, lilo 可以重新调整错误的三维开始地址.
警告: 这并不能保证其它的操作系统随后不重新修改地址, 并且发生其它的负作用. 正确的方法是对磁盘重新分区, 使得分区对应于整个磁道.
- force-backup=backup-file
- 类似 `backup', 如果原来有同名的备份文件就予以改写.
- ignore-table
- 通知 lilo 忽略混乱的分区表.
- install=boot-sector
- 把指定的文件作为新的引导扇区进行安装, 如果忽略 `install' 选项,默认使用 /boot/boot.b.
- linear
- 生成线性的扇区地址代替 sector/head/cylinder 类型的三维地址. 线性地址是在运行时进行转换, 它不依赖于磁盘的几何结构. 注意如果使用 `linear' 选项, 就不能使用 便携式磁盘 (如软盘) 作为引导盘, 这是因为 决定磁盘 几何结构的 BIOS 服务对于软盘 不能可靠的工作. 对于大磁盘使用 `linear' 选项时, /sbin/lilo 可以生成对不可到达 磁盘区域的引用, 这是由于 在引导完成之前 并不知道扇区的三维地址.
- lba32
- 生成 32 位的逻辑块地址代替 sector/head/cylinder 结构的三维地址. 如果 BIOS 支持数据分组 (packet) 定址, 就会使用这类调用去存取磁盘, 这样就可以从大于 8.4Gb 的分区进行引导, 变换的几何结构仅限于是 C:H:S 类型的地址 ; 如果 BIOS 不支持数据分组定址, 'lba32' 就如 'linear' 选项, 地址被转换为 C:H:S 结构. 使用 'lba32' 选项,所有的软盘仍保持 C:H:S 类型的格式.
- lock
- 允许自动记录引导命令作为下次引导的缺省值. 通过这种方法, lilo 可以"锁定"一个选项直到手工覆盖它.
- map=map-file
- 指定映像文件的位置. 如果忽略了 `map' 选项,就使用 /boot/map .
- message=message-file
- 指定包含有在引导提示出现之前显示的消息的文件名称. 在打印 "LILO " 之后等待按 Shift 键过程中消息不会显示. 在此消息中, FF 字符 ([Ctrl L]) 清除本地屏幕, 消息文件的大小限制为 65535 字节, 如果改变或删除了此文件, 映像文件必须重建.
- nowarn
- 禁止对后来的危险发出警告.
- optional
- 每一个 `optional' 选项 (参考下面) 都作用于所有的映像.
- password=password
- 每一个 `password=...' 选项 (参考下面) 都作用于所有的映像.
- prompt
- 在任何按键之前强制进入引导提示. 如果设置了 'prompt' 但是没有设置 `timeout', 就不能自动引导机器 (需要人工干预).
- restricted
- 每一个 `restricted' 选项 (参考下面) 都作用于所有的映像.
- serial=parameters
- 允许从串行线路进行控制. 指定的串行端口被初始化, 引导载入程序接受从此端口和 PC 键盘的输入. 在串行线路上发送一个中断 (break) 相当于在控制台按下 shift 键, 可以得到载入程序的注意. 允许串行线路控制时, 所有的引导映像都应该加上口令保护. 比如线路是连接在 modem 上时, 相对于控制台, 这是最起码的安全要求. 参数串有如下的语法格式:
<port>[,<bps>[<parity>[<bits>]]]
<port>: 串行端口号, 以 0 为基准. 0 对应于 COM1, 也就是 /dev/ttyS0, 依此类推. 可以使用所有的四个端口 (如果有的话).
<bps>: 本端口的波特率. 支持如下波特率: 110, 150, 300, 600, 1200, 2400, 4800 和 9600 bps. 默认是 2400 bps.
<parity>: 线路上使用的奇偶校验方式. 载入程序忽略输入的奇偶校验, 即省略第八位, 下面字符描述校验方式 (大小写均可): n 无校验, e 偶校验, o 奇校验.
<bits>: 字符位数. 仅支持 7 位或 8位, 如果无奇偶校验, 默认为 8 位, 有校验则为 7 位.
如果设置了 `serial' 选项, `delay' 的值自动增加到 20.
例如: serial=0,2400n8 用缺省的参数初始化 COM1 端口.
- timeout=tsecs
- 设置键盘输入的超时时间 (以十分之一秒为单位). 到了指定的时间没有按键发生, 第一个映像被自动引导. 类似的, 如果用户停顿时间太长, 口令输入过程也被终止, 默认没有超时时间.
- verbose=level
- 打开详细报告过程. 更大的数字可以得到更多的输出, 如果在 lilo 的命令行附加了 -v , level 值会再增加. 最大值为 5.
另外, 核心配置参数 append, ramdisk, read-only, read-write, root 和 vga 也在全局选项部分设置. 如果没有在各核心映像部分修改它们, 默认是使用了的.
各映像选项
各个映像部分从任意一行开始.
image=pathname
(用于指出包含有 Linux 核心的文件或设备), 或者如下面这行:
other=pathname
指出要引导的其它系统.
在以前, image 行指定引导的设备时, 就必须用
- range=start-end
- 格式给出扇区的范围.
后来 (要引导其它系统) 使用了下面这三个选项 :
- loader=chain-loader
- 指出使用的 chain 装入程序. 默认时使用 /boot/chain.b , 当不是从第一块硬盘或软盘引导时, 必须给出 chain 装入程序.
- table=device
- 给出包含有分区表的设备. 如果忽略了此选项, 引导载入程序就不会给被引导的操作系统传送分区信息, (有些操作系统可以通过其它办法知道自己是从哪个分区引导的, 如 MS-DOS 通常在它的引导扇区保存磁盘的几何结构或分区信息). 注意: 如果通过 `table' 选项引用的分区表设备被修改了, 就需要重新执行 /sbin/lilo.
- unsafe
- 在建立映射时不能存取引导扇区. 这样禁止某些包括分区表的完整性检查, 如果引导扇区在固定格式的软盘设备上, 使用 UNSAFE 可以避免在执行映射安装程序时需要把可读盘放入驱动器中, `unsafe' 和 `table' 不兼容.
在上面所示的两种情况下, 都适用下述选项 :
- label=name
- 指出每个映像的标识文件名称 (不含路径). 通过设置各种 `label', 可以为映像指定不同的名称.
- alias=name
- 通过使用别名可以为同一个项目指定第二个名称.
- lock
- (参考前面.)
- optional
- 如果在映射建立时没有提供映像文件就忽略它. 这对于指定 实际上并不存在的实验核心是非常有用的.
- password=password
- 通过 password 口令保护映像.
- restricted
- 如果参数是在命令行中给出的, 为引导映像就仅需要口令 (如 single).
Linux 核心选项
如果引导的是 Linux 核心, 可以传递命令行参数到核心.
- append=string
- 在传递给核心的参数表中附加本选项. 典型的应用是指定不能完全自动探测到的硬件参数, 或者是可能有风险的情况. 例如:
append = "hd=64,32,202"
- literal=string
- 类似 `append', 但删除其它选项 (如设置 root 设备). 因为通过 `literal' 选项, 可以无意中删除掉其它关键选项, 所以它不能用在全局选项部分.
- ramdisk=size
- 指出 RAM 磁盘的大小, 0 表示没有 RAM 盘需要建立. 忽略了此选项, RAM 盘的大小就使用引导映像中原来配置的值.
- read-only
- 指出 root 文件系统以只读方式安装. 典型地, 系统在启动过程中 (在 fsck 检查过程之后) 以读写方式安装 root 文件系统.
- read-write
- 以读写方式安装 root 文件系统.
- root=root-device
- 指定作为 root 安装的设备. 如果使用的是 current , root 就设置为当前以根文件系统安装的设备. 如果用 -r 选项改变了 root 的值, 就使用各个自己的设备. 如果忽略了 'root' 选项, 就使用核心中包含的 root 设备. (该值是在核心的 Makefile 文件中由 ROOT_DEV 给出并在编译核心时就确定了的, 以后可以用 rdev(8) 程序修改.)
- vga=mode
- 引导时可以选择的 VGA 文本模式. 可以使用下列值:
normal: 普通 80x25 文本模式 .
extended (或 ext): 选择 80x50 文本模式 .
ask: 引导停止并等待用户输入.
<number>: 使用此数字对应的文本模式. 通过 vga=ask 引导, 然后按 [Enter] 可以得到一个支持的列表输出.
忽略了此选项, 就使用核心映像中包含的 VGA 模式设置值. (该值是在核心的 Makefile 文件中由 SVGA_MODE 给出并在编译核心时就确定了的, 以后可以用 rdev(8) 程序修改.)
参考
lilo(8), rdev(8).
lilo 的发行版都有很多的文档资料, 以上仅仅是其中的一小部分.
#p#
NAME
lilo.conf - configuration file for lilo
DESCRIPTION
This file, by default /etc/lilo.conf, is read by the boot loader installer lilo (see lilo(8)).
It might look as follows:
-
boot = /dev/hda delay = 40 compact vga = normal root = /dev/hda1 read-only image = /zImage-2.5.99 label = try image = /zImage-1.0.9 label = 1.0.9 image = /tamu/vmlinuz label = tamu root = /dev/hdb2 vga = ask other = /dev/hda3 label = dos table = /dev/hda
This configuration file specifies that lilo uses the Master Boot Record on /dev/hda. (For a discussion of the various ways to use lilo, and the interaction with other operating systems, see user.tex from the lilo documentation.)
When booting, the boot loader will wait four seconds (40 deciseconds) for you to press Shift. If you don't, then the first kernel image mentioned (/zImage-1.5.99, that you probably installed just five minutes ago) will be booted. If you do, the boot loader will ask you which image to boot. In case you forgot the possible choices, press [TAB] (or [?], if you have a US keyboard), and you will be presented with a menu. You now have the choice of booting this brandnew kernel, or an old trusted kernel, or a kernel on another root file system (just in case you did something stupid on your usual rootfs), or booting a different operating system. There can be up to 16 images mentioned in lilo.conf.
As can be seen above, a configuration file starts with a number of global options (the top 6 lines in the example), followed by descriptions of the options for the various images. An option in an image description will override a global option.
GLOBAL OPTIONS
There are many possible keywords. The description below is almost literally from user.tex (just slightly abbreviated).
- backup=backup-file
- Copy the original boot sector to backup-file (which may also be a device, e.g. /dev/null) instead of /boot/boot.NNNN.
- boot=boot-device
- Sets the name of the device (e.g. a hard disk partition) that contains the boot sector. If this keyword is omitted, the boot sector is read from (and possibly written to) the device that is currently mounted as root.
- change-rules
- Defines boot-time changes to partition type numbers (`hiding'). See section "Partition type change rules" of user.tex for details.
- 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.
- default=name
- Uses the specified image as the default boot image. If `default' is omitted, the image appearing first in the configuration file is used.
- delay=tsecs
- 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.
- disk=device-name
- 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.
- disktab=disktab-file
- Specifies the name of the disk parameter table. The map installer looks for /etc/disktab if `disktab' is omitted. The use of disktabs is discouraged.
- fix-table
- This allows lilo to adjust 3D addresses in partition tables. Each partition entry contains a 3D (sector/head/cylinder) and a linear address of the first and the last sector of the partition. If a partition is not track-aligned and if certain other operating systems (e.g. PC/MS-DOS or OS/2) are using the same disk, they may change the 3D address. lilo can store its boot sector only on partitions where both address types correspond. lilo re-adjusts incorrect 3D start addresses if `fix-table' is set.
WARNING: This does not guarantee that other operating systems may not attempt to reset the address later. It is also possible that this change has other, unexpected side-effects. The correct fix is to re-partition the drive with a program that does align partitions to tracks. Also, with some disks (e.g. some large EIDE disks with address translation enabled), under some circumstances, it may even be unavoidable to have conflicting partition table entries.
- force-backup=backup-file
- Like `backup', but overwrite an old backup copy if it exists.
- ignore-table
- tells lilo to ignore corrupt partition tables.
- install=boot-sector
- Install the specified file as the new boot sector. If `install' is omitted, /boot/boot.b is used as the default.
- linear
- Generate linear sector addresses instead of sector/head/cylinder addresses. Linear addresses are translated at run time and do not depend on disk geometry. Note that boot disks may not be portable if `linear' is used, because the BIOS service to determine the disk geometry does not work reliably for floppy disks. When using `linear' with large disks, /sbin/lilo may generate references to inaccessible disk areas, because 3D sector addresses are not known before boot time.
- lba32
- Generate 32-bit Logical Block Addresses instead of sector/head/cylinder addresses. If the BIOS supports packet addressing, then packet calls will be used to access the disk. This allows booting from any partition on disks greater than 8.4Gb, the translated geometry limit for C:H:S addressing. If the BIOS does not support packet addressing, then 'lba32' addresses are translated to C:H:S, just as for 'linear'. Using 'lba32', all floppy disk references are retained in C:H:S form.
- lock
- Enables automatic recording of boot command lines as the defaults for the following boots. This way, lilo "locks" on a choice until it is manually overridden.
- map=map-file
- Specifies the location of the map file. If `map' is omitted, the file /boot/map is used.
- message=message-file
- 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.
- nowarn
- Disables warnings about possible future dangers.
- optional
- The per-image option `optional' (see below) applies to all images.
- password=password
- The per-image option `password=...' (see below) applies to all images.
- prompt
- forces entering the boot prompt without expecting any prior key-presses. Unattended reboots are impossible if `prompt' is set and `timeout' isn't.
- restricted
- The per-image option `restricted' (see below) applies to all images.
- serial=parameters
- enables control from a serial line. The specified serial port is initialized and the boot loader is accepting input from it and from the PC's keyboard. Sending a break on the serial line corresponds to pressing a shift key on the console in order to get the boot loader's attention. All boot images should be password-protected if the serial access is less secure than access to the console, e.g. if the line is connected to a modem. The parameter string has the following syntax:
<port>[,<bps>[<parity>[<bits>]]]
<port>: the number of the serial port, zero-based. 0 corresponds to COM1 alias /dev/ttyS0, etc. All four ports can be used (if present).
<bps>: 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.
<parity>: the parity used on the serial line. The boot loader ignores input parity and strips the 8th bit. The following (upper or lower case) characters are used to describe the parity: n for no parity, e for even parity and o for odd parity.
<bits>: 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".
If `serial' is set, the value of `delay' is automatically raised to 20.
Example: serial=0,2400n8 initializes COM1 with the default parameters.
- timeout=tsecs
- 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.
- verbose=level
- Turns on lots of progress reporting. Higher numbers give more verbose output. If -v is additionally specified on the lilo command line, the level is increased accordingly. The maximum verbosity level is 5.
Additionally, the kernel configuration parameters append, ramdisk, read-only, read-write, root and vga can be set in the global options section. They are used as defaults if they aren't specified in the configuration sections of the respective kernel images.
PER-IMAGE SECTION
A per-image section starts with either a line
image=pathname
(to indicate a file or device containing the boot image of a Linux kernel), or a line
other=pathname
to indicate an arbitrary system to boot.
In the former case, if an image line specifies booting from a device, then one has to indicate the range of sectors to be mapped using
- range=start-end
In the latter case (booting another system) there are the three options
- loader=chain-loader
- This specifies the chain loader that should be used. By default /boot/chain.b is used. The chain loader must be specified if booting from a device other than the first hard or floppy disk.
- table=device
- This specifies the device that contains the partition table. The boot loader will 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.
In both cases the following options apply.
- label=name
- The boot loader uses the main file name (without its path) of each image specification to identify that image. A different name can be used by setting the variable `label'.
- alias=name
- A second name for the same entry can be used by specifying an alias.
- lock
- (See above.)
- optional
- Omit the image if it is not available at map creation time. This is useful to specify test kernels that are not always present.
- password=password
- Protect the image by a password.
- restricted
- A password is only required to boot the image if parameters are specified on the command line (e.g. single).
KERNEL OPTIONS
If the booted image is a Linux kernel, then one may pass command line parameters to this kernel.
- append=string
- Appends the options specified to the parameter line passed to the kernel. This is typically used to specify parameters of hardware that can't be entirely auto-detected or for which probing may be dangerous. Example:
append = "hd=64,32,202"
- literal=string
- Like `append', but removes all other options (e.g. setting of the root device). Because vital options can be removed unintentionally with `literal', this option cannot be set in the global options section.
- ramdisk=size
- This specifies the size of the optional RAM disk. A value of zero indicates that no RAM disk should be created. If this variable is omitted, the RAM disk size configured into the boot image is used.
- read-only
- This specifies that the root file system should be mounted read-only. Typically, the system startup procedure re-mounts the root file system read-write later (e.g. after fsck'ing it).
- read-write
- This specifies that the root file system should be mounted read-write.
- root=root-device
- This specifies the device that should be mounted as root. If the special name current is used, the root device is set to the device on which the root file system is currently mounted. If the root has been changed with -r , the respective device is used. If the variable `root' is omitted, the root device setting contained in the kernel image is used. (And that is set at compile time using the ROOT_DEV variable in the kernel Makefile, and can later be changed with the rdev(8) program.)
- vga=mode
- This specifies the VGA text mode that should be selected when booting. The following values are recognized (case is ignored):
normal: select normal 80x25 text mode.
extended (or ext): select 80x50 text mode.
ask: stop and ask for user input (at boot time).
<number>: use the corresponding text mode. A list of available modes can be obtained by booting with vga=ask and pressing [Enter].
If this variable is omitted, the VGA mode setting contained in the kernel image is used. (And that is set at compile time using the SVGA_MODE variable in the kernel Makefile, and can later be changed with the rdev(8) program.)
SEE ALSO
lilo(8), rdev(8).
The lilo distribution comes with very extensive documentation of which the above is an extract.