Handbook:AMD64/Blocks/Bootloader/ru

Выбор загрузчика
Когда ядро Linux настроено, системные утилиты установлены и конфигурационные файлы отредактированы настало время для установки последней важной части Linux системы: загрузчика.

Загрузчик отвечает за загрузку ядра Linux во время загрузки - без него система не будет знать, как действовать, если нажата кнопка питания.

Для, мы написали как настроить либо GRUB2, либо LILO для систем на базе BIOS, и GRUB2 или efibootmgr для UEFI систем.

По умолчанию: Использование GRUB2
Ранее, Gentoo Linux использовал то, что теперь называется GRUB Legacy(наследство) в качестве рекомендуемого загрузчика. Но, как следует из названия, старый пакет GRUB больше не поддерживается и его быстро сменили на GRUB2. Для получения более подробной информации о GRUB Legacy, пожалуйста, обратитесь к статье GRUB на Gentoo Wiki.

Установка GRUB2
GRUB2 is provided through the package.


 * Когда используется BIOS:




 * When using UEFI, UEFI users will need to add  to  first.





The GRUB2 software is now installed on the system, but not activated yet.

Настройка GRUB2
Next, install the necessary GRUB2 files to the directory via. Assuming the first disk (the one where the system boots from) is, the following command will do this:


 * Когда используется BIOS:


 * Когда используется UEFI:







Next, we can generate the GRUB2 configuration based on the user configuration specified in the file and  scripts. In most cases, no configuration is needed by users as GRUB2 will automatically detect which kernel to boot (the highest one available in ) and what the root file system is.

To generate the final GRUB2 configuration, run the command:

The output of the command must mention that at least one Linux image is found, as those are needed to boot the system. If an initramfs is used or was used to build the kernel, the correct initrd image should be detected as well. If this is not the case, go to and check the contents using the  command. If the files are indeed missing, go back to the kernel configuration and installation instructions.

Установка LILO
LILO, the LInuxLOader, is the tried and true workhorse of Linux boot loaders. However, it lacks some features that GRUB has. The reason why LILO is still used is that, on some systems, GRUB doesn't work and LILO does. Of course, it is also used because some people know LILO and want to stick with it. Either way, Gentoo supports both.

Installing LILO is a breeze; just use emerge.

Настройка LILO
To configure LILO, first create :

In the configuration file, sections are used to refer to the bootable kernel. Make sure that the kernel files (with kernel version) and initramfs files are known, as they need to be referred to in this configuration file.

If an initramfs is necessary, then change the configuration by referring to this initramfs file and telling the initramfs where the real root device is at:

If additional options need to be passed to the kernel, use an  statement. For instance, to add the  statement to enable framebuffer:

Users that used should know that their kernels use the same boot options as is used for the installation CD. For instance, if SCSI device support needs to be enabled, add  as kernel option.

Now save the file and exit.

To finish up, run so LILO can apply the  settings to the system (I.E. install itself on the disk). Keep in mind that must be executed each time a new kernel is installed or a change has been made to the  file in order for the system to boot if the filename of the kernel has changed.

Альтернатива: Использование efibootmgr
On UEFI based systems, the boot loader itself is the UEFI firmware of the system. Such systems do not need additional boot loaders to help boot the system, although EFI-based bootloaders do exist to extend the functionality of UEFI systems during boot.

The application is not a boot loader, but a tool to interact with the UEFI firmware and update its settings, so that the Linux kernel that was previously installed can be booted with additional options (if necessary), or to allow multiple boot entries. This interaction is done through the EFI variables (hence the need for the support of EFI vars in the past).

First install the software:

Next, tell the UEFI firmware that a boot entry called "Gentoo" is to be created, which has the freshly installed Linux kernel booted:

If an initial ram file system (initramfs) is used, add the proper boot option to it:

With these changes done, when the system reboots, a boot entry called "Gentoo" will be available.