Handbook:AMD64/Blocks/Bootloader/it

Scegliere un avviatore
Con il kernel Linux configurato, gli strumenti di sistema installati ed i file di configurazione modificati, è tempo di installare l'ultimo importante pezzo di un'installazione Linux: l'avviatore (bootloader).

L'avviatore è responsabile del lancio del kernel Linux al momento dell'avvio - senza di esso, il sistema non saprebbe come procedere quando il pulsante di accensione (power) viene premuto.

Per, documenteremo come configurare sia GRUB2 che LILO per sistemi basati su BIOS, e GRUB2 o efibootmgr per sistemi UEFI.

In questa sezione del Manuale, viene fatta una delineazione tra emergere un pacchetto per l'avviatore (boot loader) ed installare un avviatore nel disco di sistema. Qui il termine emergere sarà usato per chiedere a Portage di compilare un pacchetto software che sia disponibile per il sistema. Il termine installare significherà che l'avviatore copia i file o modifica fisicamente le sezioni appropriate dell'unità del disco di sistema affinché l'avviatore sia attivo e pronto ad operare dalla prossima accensione della macchina.

Default: 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.

By default, the majority of Gentoo systems now rely upon GRUB2 (found in the package), which is the direct successor to GRUB Legacy. With no additional configuration, GRUB2 gladly supports older BIOS ("pc") systems. With a small amount of configuration, necessary before build time, GRUB2 can support more than a half a dozen additional platforms. For more information, consult the Prerequisites section of the GRUB2 article.

Emerge
When using an older BIOS system supporting only MBR partition tables, no additional configuration is needed in order to emerge GRUB:



A note for UEFI users: running the above command will output the enabled GRUB_PLATFORMS values before emerging. When using UEFI capable systems, users will need to ensure  is enabled (as it is the case by default). If that is not the case for the setup,  will need to be added to the  file before emerging GRUB2 so that the package will be built with EFI functionality:






 * If GRUB2 was somehow emerged without enabling, the line (as shown above) can be added to  then and dependencies for the world package set re-calculated by passing the   options to :



The GRUB2 software has now been merged to the system, but not yet installed.

Install
Next, install the necessary GRUB2 files to the directory via the  command. Presuming the first disk (the one where the system boots from) is, one of the following commands will do:


 * When using BIOS:


 * When using UEFI:







Some motherboard manufacturers seem to only support the directory location for the .EFI file in the EFI System Partition (ESP). The GRUB installer can perform this operation automatically with the  option. Verify the ESP is mounted before running the following commands. Presuming the ESP is mounted at (as suggested earlier), execute:

This creates the default directory defined by the UEFI specification, and then copies the file to the 'default' EFI file location defined by the same specification.

Configure
Next, 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. It is also possible to append kernel parameters in using the GRUB_CMDLINE_LINUX variable.

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.

Emerge
LILO, the LInuxLOader, is the tried and true workhorse of Linux boot loaders. However, it lacks features when compared to GRUB. LILO is still used because, on some systems, GRUB does not 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 bootloaders.

Installing LILO is a breeze; just use emerge.

Configure
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 root device is located:

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.

Install
To finish up, run the executable 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.

Alternative 2: efibootmgr
On UEFI based systems, the UEFI firmware on the system (in other words the primary bootloader), can be directly manipulated to look for UEFI boot entries. Such systems do not need to have additional (also known as secondary) bootloaders like GRUB2 in order to help boot the system. With that being said, the reason EFI-based bootloaders such as GRUB2 exist is to extend the functionality of UEFI systems during the boot process. Using is really for those who desire to take a minimalist (although more rigid) approach to booting their system; using GRUB2 (see above) is easier for the majority of users because it offers a flexible approach when booting UEFI systems.

Remember application is not a bootloader; it is 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 kernel support of EFI vars).

Be sure to read through the EFI stub kernel article before continuing. The kernel must have specific options enabled to be directly bootable by the system's UEFI firmware. It might be necessary to recompile the kernel. It is also a good idea to take a look at the article.

Those that have decided to take this approach must install the software:

Then, create the location, and then copy the kernel into this location, calling it :

Next, tell the UEFI firmware that a boot entry called "Gentoo" is to be created, which has the freshly compiled EFI stub kernel:

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.

Alternative 3: Syslinux
Syslinux is yet another bootloader alternative for the architecture. It supports MBR and, as of version 6.00, it supports EFI boot. PXE (network) boot and lesser-known options are also supported. Although Syslinux is a popular bootloader for many it is unsupported by the Handbook. Readers can find information on emerging and then installing this bootloader in the Syslinux article.