LILO

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page LILO and the translation is 55% complete.
Outdated translations are marked like this.
Other languages:


LILO (LInux LOader) is a simple boot loader to load Linux and other operating systems.

安装

LILO's installation is two-fold. One is the installation of the software itself on the system (but does not activate LILO), the second one is the installation (activation) of the LILO bootloader on the disk's MBR.

USE 标记

USE flags for sys-boot/lilo LInux LOader, the original Linux bootloader

device-mapper Enable support for device-mapper from sys-fs/lvm2
minimal Do not install the dolilo helper script
pxeserial Avoid character echo on PXE serial console
static !!do not set this during bootstrap!! Causes binaries to be statically linked instead of dynamically

Emerge

The software installation will only deploy the software on the file system, but will not install LILO in the MBR.

root #emerge --ask sys-boot/lilo

在 MBR 安装 LILO

In order to install LILO on the MBR or update LILO, invoke lilo. However, before doing that, the /etc/lilo.conf file must be set up, which is covered in the Configuration section below.

root #lilo

配置

An example lilo.conf file is provided at /etc/lilo.conf.example. To start configuring LILO, copy over the example file.

root #cp /etc/lilo.conf.example /etc/lilo.conf

相应地,更新 /etc/lilo.conf 文件。

生成配置

First configure LILO to be deployed on the system. The boot parameter tells LILO where to install the LILO bootloader in. Usually, this is the block device that represents the first disk (the disk that the system will boot), such as /dev/sda. Be aware that the lilo.conf.example file still uses /dev/hda so make sure that references to /dev/hda are changed to /dev/sda.

文件 /etc/lilo.conf定义在哪里安装 LILO
boot=/dev/sda
map=/boot/.map

Next, tell LILO what to boot as default (if the user does not select any other option at the boot menu). The name used here is the label value of the operating system blocks defined later in the file.

文件 /etc/lilo.confBooting the block labeled as Gentoo by default
default=Gentoo

LILO will show the available options for a short while before continuing to boot the default selected operating system. How long it waits is defined by the timeout parameter and is measured in tenths of a second (so the value 10 is one second):

文件 /etc/lilo.conf设置在继续启动默认操作系统之前有 5 秒超时
timeout=50

Configuring the Gentoo OS block

An example configuration block for Gentoo is shown below. It is given the "Gentoo" label to match the default parameter declared earlier.

文件 /etc/lilo.confExample Gentoo Linux configuration in lilo.conf
image=/boot/kernel-3.11.2-gentoo
	label=Gentoo
	read-only
	root=/dev/sda4

This will boot the Linux kernel /boot/kernel-3.11.2-gentoo with root file system /dev/sda4.

添加内核参数

To add additional kernel parameters to the OS block, use the append parameter. For instance, to boot the Linux kernel silently (so it does not show any kernel messages unless critical):

文件 /etc/lilo.confShowing the use of the append parameter with the quiet option
image=/boot/kernel-3.11.2-gentoo
	label=Gentoo
	read-only
	root=/dev/sda4
	append="quiet"

systemd users for instance would want to set init=/usr/lib/systemd/systemd so that the systemd init is used:

文件 /etc/lilo.confUsing systemd with LILO
	append="quiet init=/usr/lib/systemd/systemd"

As can be seen, additional kernel parameters are just appended to the same append parameter.

Multiple block definitions

It is a good idea to keep old definitions available in case the new kernel doesn't boot successfully. This is accomplished by creating another block:

文件 /etc/lilo.confDefining a second OS block
image=/boot/kernel-3.9.2-gentoo
        root=/dev/sda4
        label=OldGentoo
        read-only

使用

在 MBR 更新LILO

As mentioned earlier, lilo has to be executed in order to install LILO in the MBR. This step has to be repeated every time /etc/lilo.conf is modified or when the Linux kernel(s) that the /etc/lilo.conf file points to are updated!

root #lilo

多次运行 lilo 不会有影响。

双启动 Gentoo 和 FreeBSD

要 Gentoo 和 FreeBSD们,像下面这样编辑 /etc/lilo.conf

文件 /etc/lilo.conf双启动:Gentoo 和 FreeBSD
large-memory
lba32
boot=/dev/sda
install=menu
map=/boot/map
prompt
default=Gentoo
 
image=/boot/vmlinuz-2.6.26
	label="Gentoo"
	root=/dev/sda1
	append=""
	read-only
	optional
 
other=/dev/sda3
	label="FreeBSD"

请确保调整示例配置文件以匹配所使用的设置。

移除

Unmerge

警告
Be sure there's another bootloader installed and properly configured before uninstalling lilo! Failing to do so will most likely result in the system failing to bootstrap.

很简单就能卸载 lilo:

root #emerge --ask --depclean --verbose sys-boot/lilo

另请参阅

  • GRUB — 是一个多引导辅助引导加载程序,能够从大多数系统架构上的多种文件系统中加载内核。