Handbook:AMD64/Blocks/Bootloader/pt-br

Selecting a boot loader
With the Linux kernel configured, system tools installed and configuration files edited, it is time to install the last important piece of a Linux installation: the boot loader.

The boot loader is responsible for firing up the Linux kernel upon boot - without it, the system would not know how to proceed when the power button has been pressed.

For, we document how to configure either GRUB2 or LILO for BIOS based systems, and GRUB2 or efibootmgr for UEFI systems.

Default: Using GRUB2
Previously, Gentoo Linux used what is now called GRUB Legacy as the recommended boot loader. As the name implies, the older GRUB package is no longer actively maintained and has been superseded by GRUB2. For more information about the legacy GRUB, please refer to its GRUB article on the Gentoo Wiki.

Installing GRUB2
GRUB2 is provided through the package.


 * When using 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.

Configuring GRUB2
Next, install the necessary GRUB2 files in. Assuming the first disk (the one where the system boots from) is, the following command will do this:


 * When using BIOS:


 * When using 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.

Installing 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.

Configuring 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  needs to be executed every time a new kernel is installed or a change has been made to the  file.

Alternative: Using 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.