lilo.conf 中文man頁面
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.