From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Handbook:Alpha/Installation/Kernel and the translation is 100% complete.
Sommaire du manuel
‎À propos de l'installation
Choix du support
Configurer le réseau
Préparer les disques
Installer l'archive stage3
Installer le système de base
Configurer le noyau
Configurer le système
Installer les outils
Configurer le système d'amorçage
Utiliser Gentoo
Introduction à Portage
Les options de la variable USE
Les fonctionnalités de Portage
Scripts d'initialisation systèmes
Variables d'environnement
Utiliser Portage
Fichiers et répertoires
Les variables
Mélanger plusieurs branches logicielles
Outils supplémentaires
Dépôt personnalisé
Fonctionnalités avancées
Configuration du réseau
Bien démarrer
Configuration avancée
Les modules réseau
Sans fil
Ajouter des fonctionnalités
Gestion dynamique


Linux Firmware

Certains pilotes nécessite l'installation de micrologiciels supplémentaires sur le système pour fonctionner. C'est souvent le cas pour les interfaces réseau, notamment les interfaces réseau sans fil. Aussi, les cartes vidéos récentes, de vendeurs tels que AMD, NVidia, et Intel, nécessitent souvent des micrologiciels supplémentaires lors de l'utilisation du pilote libre. La plupart des micrologiciels se trouvent dans le paquet sys-kernel/linux-firmware :

It is recommended to have the sys-kernel/linux-firmware package installed before the initial system reboot in order to have the firmware available in the event that it is necessary:

root #emerge --ask sys-kernel/linux-firmware
Installing certain firmware packages often requires accepting the associated firmware licenses. If necessary, visit the license handling section of the Handbook for help on accepting licenses.

It is important to note that kernel symbols that are built as modules (M) will load their associated firmware files from the filesystem when they are loaded by the kernel. It is not necessary to include the device's firmware files into the kernel's binary image for symbols loaded as modules.

SOF Firmware

Use of this firmware requires enabling certain Kernel options and is only supported on AMD64 currently. Enabling these options are only necessary if a manual configuration is planned, as the Distribution Kernels have them enabled already. The necessary options are covered in architecture specific kernel configuration.

Sound Open Firmware (SOF) is a new open source audio driver meant to replace the proprietary Smart Sound Technology (SST) audio driver from Intel. 10th gen+ and Apollo Lake (Atom E3900, Celeron N3350, and Pentium N4200) Intel CPUs require this firmware for certain features and certain AMD APUs also have support for this firmware. SOF's supported platforms matrix can be found here for more information.

root #emerge --ask sys-firmware/sof-firmware


In addition to discrete graphics hardware and network interfaces, CPUs also can require firmware updates. Typically this kind of firmware is referred to as microcode. Newer revisions of microcode are sometimes necessary to patch instability, security concerns, or other miscellaneous bugs in CPU hardware.

Microcode updates for AMD CPUs are distributed within the aforementioned sys-kernel/linux-firmware package. Microcode for Intel CPUs can be found within the sys-firmware/intel-microcode package, which will need to be installed separately. See the Microcode article for more information on how to apply microcode updates.

Configuration et compilation du noyau

Il est maintenant temps de configurer et de compiler les sources du noyau. Il y a trois façons de faire :

Ranked from least involved to most involved:

  1. Le noyau est configuré et compilé manuellement.
  2. Un outil appelé genkernel est utilisé afin de configurer, compiler et installer automatiquement le noyau Linux.

Le cœur de toute distribution est le noyau Linux. C'est la couche située entre les programmes utilisateurs et le matériel du système. Gentoo propose à ses utilisateurs plusieurs sources du noyau possibles. Une liste complète des sources, avec description, est disponible sur la page Noyau - Vue d'ensemble.

Installer les sources

This section is only relevant when using the following genkernel (hybrid) or manual kernel management approach.

When installing and compiling the kernel for alpha-based systems, Gentoo recommends the sys-kernel/gentoo-sources package.

Choose an appropriate kernel source and install it using emerge:

root #emerge --ask sys-kernel/gentoo-sources

Cela installera les sources du noyau Linux dans le répertoire /usr/src/, dans lequel un lien symbolique appelé linux pointera vers les sources du noyau installées :

It is conventional for a /usr/src/linux symlink to be maintained, such that it refers to whichever sources correspond with the currently running kernel. However, this symbolic link will not be created by default. An easy way to create the symbolic link is to utilize eselect's kernel module.

For further information regarding the purpose of the symlink, and how to manage it, please refer to Kernel/Upgrade.

First, list all installed kernels:

root #eselect kernel list
Available kernel symlink targets:
  [1]   linux-3.16.5-gentoo

In order to create a symbolic link called linux, use:

root #eselect kernel set 1
root #ls -l /usr/src/linux
lrwxrwxrwx    1 root   root    12 Oct 13 11:04 /usr/src/linux -> linux-3.16.5-gentoo

Alternative : Utiliser genkernel

In case it was missed, this section requires the kernel sources to be installed. Be sure to obtain the relevant kernel sources, then return here for the rest of section.

Si une configuration manuelle semble trop intimidante, utiliser gernkernel est recommandé. Il se chargera de configurer, compiler et installer le noyau automatiquement.

Genkernel provides a generic kernel configuration file and will compile the kernel and initramfs, then install the resulting binaries to the appropriate locations. This results in minimal and generic hardware support for the system's first boot, and allows for additional update control and customization of the kernel's configuration in the future.

Be informed: while using genkernel to maintain the kernel provides system administrators with more update control over the system's kernel, initramfs, and other options, it will require a time and effort commitment to perform future kernel updates as new sources are released. Those looking for a hands-off approach to kernel maintenance should use a distribution kernel.

For additional clarity, it is a misconception to believe genkernel automatically generates a custom kernel configuration for the hardware on which it is run; it uses a predetermined kernel configuration that supports most generic hardware and automatically handles the make commands necessary to assemble and install the kernel, the associate modules, and the initramfs file.

Binary redistributable software license group

If the linux-firmware package has been previously installed, then skip onward to the to the installation section.

As a prerequisite, due to the firwmare USE flag being enabled by default for the sys-kernel/genkernel package, the package manager will also attempt to pull in the sys-kernel/linux-firmware package. The binary redistributable software licenses are required to be accepted before the linux-firmware will install.

This license group can be accepted system-wide for any package by adding the @BINARY-REDISTRIBUTABLE as an ACCEPT_LICENSE value in the /etc/portage/make.conf file. It can be exclusively accepted for the linux-firmware package by adding a specific inclusion via a /etc/portage/package.license/linux-firmware file.

If necessary, review the methods of accepting software licenses available in the Installing the base system chapter of the handbook, then make some changes for acceptable software licenses.

If in analysis paralysis, the following will do the trick:

root #mkdir /etc/portage/package.license
FILE /etc/portage/package.license/linux-firmwareAccept binary redistributable licenses for the linux-firmware package
sys-kernel/linux-firmware @BINARY-REDISTRIBUTABLE


Il est maintenant temps de voir comment utiliser genkernel. D'abord, installer sys-kernel/genkernel :

root #emerge --ask sys-kernel/genkernel


Maintenant, compiler les sources du noyau en exécutant genkernel all. Attention, vu que genkernel compile un noyau qui supporte presque tout type de matériel, la compilation prendra un bon bout de temps avant de finir !

SI la partition boot n'utilise pas le système de fichiers ext2 ou ext3, il peut être nécessaire de configurer le noyau en utilisant genkernel --menuconfig all et d'ajouter le support pour un système de fichiers spécifique dans le noyau (et non en tant que module). Les utilisateurs de LVM2 voudront probablement aussi ajouter l'argument --lvm.
Users of LVM2 should add --lvm as an argument to the genkernel command below.
root #genkernel all

Une fois que gernkernel est terminé, un noyau, en ensemble complet de modules et une image initramfs seront créés. Le noyau et l'image initramfs seront utilisés plus tard lors de la configuration d'un système d'amorçage, il est donc bon de noter les noms du noyau et de l'image initramfs. L'image initramfs sera lancée immédiatement après le démarrage pour effectuer une détection automatique du matériel (comme pour le média d'installation) avant le démarrage réel du système.

root #ls /boot/vmlinu* /boot/initramfs*

Configuration manuelle


In case it was missed, this section requires the kernel sources to be installed. Be sure to obtain the relevant kernel sources, then return here for the rest of section.

Configurer manuellement un noyau est souvent considéré comme l'une des procédures des plus difficiles qu'un utilisateur de Linux ait à réaliser. Rien n'est moins vrai - après avoir configuré quelques noyaux, plus personne ne se souviens que c'était difficile.

Cependant, une chose est vraie : c'est vital de connaître le système quand un noyau est configuré manuellement. La plupart des informations nécessaires peuvent être recueillies en installant le paquet sys-apps/pciutils qui contient la commande lspci :

root #emerge --ask sys-apps/pciutils
À l'intérieur d'un chroot, il est possible d'ignorer sans risque toutes les mises en garde (du genrepcilib: cannot open /sys/bus/pci/devices) que lspci pourrait afficher.

Un autre source d'information est d'exécuter la commande lsmod pour voir quels modules du noyau sont utilisés par le média d'installation afin de savoir quoi activer plus tard.

Il est maintenant temps d'accéder au répertoire source du noyau et d'exécuter make menuconfig. Cela lancera un menu de configuration.

root #cd /usr/src/linux
root #make menuconfig

La configuration du noyau Linux comporte beaucoup, beaucoup de sections. Voici une liste des options qui doivent être activées (sinon Gentoo ne fonctionnera pas, ou incorrectement, sans modifications supplémentaires). Il existe également un guide de configuration du noyau Gentoo sur le wiki pouvant apporter plus d'informations.

Activation des options indispensables

When using sys-kernel/gentoo-sources, it is strongly recommend the Gentoo-specific configuration options be enabled. These ensure that a minimum of kernel features required for proper functioning is available:

KERNEL Enabling Gentoo-specific options
Gentoo Linux --->
  Generic Driver Options --->
    [*] Gentoo Linux support
    [*]   Linux dynamic and persistent device naming (userspace devfs) support
    [*]   Select options required by Portage features
        Support for init systems, system and service managers  --->
          [*] OpenRC, runit and other script based systems and managers
          [*] systemd

Naturally the choice in the last two lines depends on the selected init system (OpenRC vs. systemd). It does not hurt to have support for both init systems enabled.

When using sys-kernel/vanilla-sources, the additional selections for init systems will be unavailable. Enabling support is possible, but goes beyond the scope of the handbook.

Enabling support for typical system components

Bien s'assurer que tous les pilotes indispensables au démarrage du système (comme le contrôleur SCSI, etc.) soient compilés dans le noyau et non en tant que module, sinon le système de pourra pas démarrer correctement.

Ensuite, sélectionner le type exact du processeur. Il est également recommandé d'active les fonctionnalités MCE (si disponibles) afin que les utilisateurs puissent être notifiés de tout problème matériel. Sur certaines architectures (telles que x86_64), ces erreurs se sont pas affichées dans dmesg, mais dans /dev/mcelog. Cela nécessite le paquet app-admin/mcelog.

Aussi, sélectionner Maintain a devtmpfs file system to mount at /dev afin que le fichiers critiques des périphériques soient disponible au début du processus de démarrage. (CONFIG_DEVTMPFS and CONFIG_DEVTMPFS_MOUNT) :

KERNEL Activer le support pour devtmpfs
Device Drivers --->
  Generic Driver Options --->
    [*] Maintain a devtmpfs filesystem to mount at /dev
    [*]   Automount devtmpfs at /dev, after the kernel mounted the rootfs

Vérifier que le support pour les disques SCSI soit activé (CONFIG_BLK_DEV_SD):

KERNEL Activer le support pour les disques SCSI
Device Drivers --->
   SCSI device support  --->
      <*> SCSI disk support
Device Drivers --->
  <*> Serial ATA and Parallel ATA drivers (libata)  --->
    [*] ATA ACPI Support
    [*] SATA Port Multiplier support
    <*> AHCI SATA support (ahci)
    [*] ATA BMDMA support
    [*] ATA SFF support (for legacy IDE and PATA)
    <*> Intel ESB, ICH, PIIX3, PIIX4 PATA/SATA support (ata_piix)

Verify basic NVMe support has been enabled:

KERNEL Enable basic NVMe support for Linux 4.4.x (CONFIG_BLK_DEV_NVME)
Device Drivers  --->
  <*> NVM Express block device
KERNEL Enable basic NVMe support for Linux 5.x.x (CONFIG_DEVTMPFS)
Device Drivers --->
  NVME Support --->
    <*> NVM Express block device

It does not hurt to enable the following additional NVMe support:

[*] NVMe multipath support
[*] NVMe hardware monitoring
<M> NVM Express over Fabrics FC host driver
<M> NVM Express over Fabrics TCP host driver
<M> NVMe Target support
  [*]   NVMe Target Passthrough support
  <M>   NVMe loopback device support
  <M>   NVMe over Fabrics FC target driver
  < >     NVMe over Fabrics FC Transport Loopback Test driver (NEW)
  <M>   NVMe over Fabrics TCP target support

Maintenant, aller dans File Systems et sélectionner la prise en charge des systèmes de fichiers qui seront utilisés. Attention, ne pas compiler le système de fichier utilisé par le système de fichier racine an tant que module, sinon Gentoo sera incapable de monter la partition. Aussi, sélectionner Virtual memory et /proc file system. Sélectionner également une ou plusieurs des options suivantes selon le système (CONFIG_EXT2_FS, CONFIG_EXT3_FS, CONFIG_EXT4_FS, CONFIG_MSDOS_FS, CONFIG_VFAT_FS, CONFIG_PROC_FS, and CONFIG_TMPFS) :

KERNEL Sélectionner les systèmes de fichiers nécessaires
File systems --->
  <*> Second extended fs support
  <*> The Extended 3 (ext3) filesystem
  <*> The Extended 4 (ext4) filesystem
  <*> Reiserfs support
  <*> JFS filesystem support
  <*> XFS filesystem support
  <*> Btrfs filesystem support
  DOS/FAT/NT Filesystems  --->
    <*> MSDOS fs support
    <*> VFAT (Windows-95) fs support
  Pseudo Filesystems --->
    [*] /proc file system support
    [*] Tmpfs virtual memory file system support (former shm fs)

Si PPPoE, ou un modem analogique, est utilisé pour se connecter à Internet, activer les options suivantes(CONFIG_PPP, CONFIG_PPP_ASYNC, and CONFIG_PPP_SYNC_TTY) :

KERNEL Sélectionner les pilotes PPPoE nécessaires
Device Drivers --->
  Network device support --->
    <*> PPP (point-to-point protocol) support
    <*>   PPP support for async serial ports
    <*>   PPP support for sync tty ports

Les deux options de compression ne poseront pas de problème mais elle ne sont définitivement pas indispensables, pas plus que l'option de PPP sur Ethernet qui ne sera probablement utilisée que si configurée pour faire du mode PPPoE via le noyau.

Ne pas oublier d'inclure dans le noyau le support pour les cartes réseau (Ethernet ou sans fil).

La plupart des système possèdent également plusieurs cœurs à leur disposition, il est donc important d'activer l'option Symmetric multi-processing support (CONFIG_SMP) :

KERNEL Activer le support pour SMP
Processor type and features  --->
  [*] Symmetric multi-processing support
Dans les systèmes multi-cœur, chaque cœur compte comme un processeur.

Si des périphériques d'entrée USB (comme un clavier ou une souris), ou d'autres périphériques USB seront utilisés, ne pas oublier d'en activer le support (CONFIG_HID_GENERIC and CONFIG_USB_HID, CONFIG_USB_SUPPORT, CONFIG_USB_XHCI_HCD, CONFIG_USB_EHCI_HCD, CONFIG_USB_OHCI_HCD) :

KERNEL Activation du support pour les périphériques USB
Device Drivers --->
  HID support  --->
    -*- HID bus support
    <*>   Generic HID driver
    [*]   Battery level reporting for HID devices
      USB HID support  --->
        <*> USB HID transport layer
  [*] USB support  --->
    <*>     xHCI HCD (USB 3.0) support
    <*>     EHCI HCD (USB 2.0) support
    <*>     OHCI HCD (USB 1.1) support

Optional: Signed kernel modules

To automatically sign the kernel modules enable CONFIG_MODULE_SIG_ALL:

[*] Enable loadable module support  
  -*-   Module signature verification    
    [*]     Automatically sign all modules    
    Which hash algorithm should modules be signed with? (Sign modules with SHA-512) --->

Optionally change the hash algorithm if desired.

To enforce that all modules are signed with a valid signature, enable CONFIG_MODULE_SIG_FORCE as well:

KERNEL Enforce signed kernel modules CONFIG_MODULE_SIG_FORCE
[*] Enable loadable module support  
  -*-   Module signature verification    
    [*]     Require modules to be validly signed
    [*]     Automatically sign all modules
    Which hash algorithm should modules be signed with? (Sign modules with SHA-512) --->

To use a custom key, specify the location of this key in CONFIG_MODULE_SIG_KEY, if unspecified the kernel build system will generate a key. It is recommended to generate one manually instead. This can be done with:

root #openssl req -new -nodes -utf8 -sha256 -x509 -outform PEM -out kernel_key.pem -keyout kernel_key.pem

OpenSSL will ask some questions about the user generating the key, it is recommended to fill in these questions as detailed as possible.

Store the key in a safe location, at the very least the key should be readable only by the root user. Verify this with:

root #ls -l kernel_key.pem
 -r-------- 1 root root 3164 Jan  4 10:38 kernel_key.pem 

If this outputs anything other then the above, correct the permissions with:

root #chown root:root kernel_key.pem
root #chmod 400 kernel_key.pem
-*- Cryptographic API  ---> 
  Certificates for signature checking  --->  
    (/path/to/kernel_key.pem) File name or PKCS#11 URI of module signing key

To also sign external kernel modules installed by other packages via linux-mod-r1.eclass, enable the modules-sign USE flag globally:

FILE /etc/portage/make.confEnable module signing

<div lang="en" dir="ltr" class="mw-content-ltr">
# Optionally, when using custom signing keys.
MODULES_SIGN_CERT="/path/to/kernel_key.pem" # Only required if the MODULES_SIGN_KEY does not also contain the certificate
MODULES_SIGN_HASH="sha512" # Defaults to sha512
The MODULES_SIGN_KEY and MODULES_SIGN_CERT may be different files. For this example the pem file generated by OpenSSL includes both the key and the accompanying certificate, and thus both variables are set to the same value.

Optional: Signing the kernel image (Secure Boot)

When signing the kernel image (for use on systems with Secure Boot enabled) it is recommended to set the following kernel config options:

KERNEL Lockdown for secureboot
General setup  --->
  Kexec and crash features  --->   
    [*] Enable kexec system call                                                                                          
    [*] Enable kexec file based system call                                                                               
    [*]   Verify kernel signature during kexec_file_load() syscall                                                        
    [*]     Require a valid signature in kexec_file_load() syscall                                                        
    [*]     Enable ""image"" signature verification support

<div lang="en" dir="ltr" class="mw-content-ltr">
[*] Enable loadable module support  
  -*-   Module signature verification    
    [*]     Require modules to be validly signed
    [*]     Automatically sign all modules
    Which hash algorithm should modules be signed with? (Sign modules with SHA-512) --->

<div lang="en" dir="ltr" class="mw-content-ltr">
Security options  ---> 
[*] Integrity subsystem   
  [*] Basic module for enforcing kernel lockdown                                                                       
  [*]   Enable lockdown LSM early in init                                                                       
        Kernel default lockdown mode (Integrity)  --->

  <div lang="en" dir="ltr" class="mw-content-ltr">
[*]   Digital signature verification using multiple keyrings                                                            
  [*]     Enable asymmetric keys support                                                                                     
  -*-       Require all keys on the integrity keyrings be signed                                                              
  [*]       Provide keyring for platform/firmware trusted keys                                                                
  [*]       Provide a keyring to which Machine Owner Keys may be added                                                        
  [ ]         Enforce Machine Keyring CA Restrictions

Where ""image"" is a placeholder for the architecture specific image name. These options, from the top to the bottom: enforces that the kernel image in a kexec call must be signed (kexec allows replacing the kernel in-place), enforces that kernel modules are signed, enables lockdown integrity mode (prevents modifying the kernel at runtime), and enables various keychains.

On arches that do not natively support decompressing the kernel (e.g. arm64 and riscv), the kernel must be built with its own decompressor (zboot):

Device Drivers --->                                                                                                                           
  Firmware Drivers --->                                                                                                                       
    EFI (Extensible Firmware Interface) Support --->                                                                                               
      [*] Enable the generic EFI decompressor

After compilation of the kernel, as explained in the next section, the kernel image must be signed. First install app-crypt/sbsigntools and then sign the kernel image:

root #emerge --ask app-crypt/sbsigntools
root #sbsign /usr/src/linux-x.y.z/path/to/kernel-image --cert /path/to/kernel_key.pem --key /path/to/kernel_key.pem --out /usr/src/linux-x.y.z/path/to/kernel-image
For this example the same key that was generated to sign the modules is used to sign the kernel image. It is also possible to generate and use a second sperate key for signing the kernel image. The same OpenSSL command as in the previous section may be used again.

Then proceed with the installation.

To automatically sign EFI executables installed by other packages, enable the secureboot USE flag globally:

FILE /etc/portage/make.confEnable Secure Boot
USE="modules-sign secureboot"

<div lang="en" dir="ltr" class="mw-content-ltr">
# Optionally, to use custom signing keys.
MODULES_SIGN_CERT="/path/to/kernel_key.pem" # Only required if the MODULES_SIGN_KEY does not also contain the certificate.
MODULES_SIGN_HASH="sha512" # Defaults to sha512

<div lang="en" dir="ltr" class="mw-content-ltr">
# Optionally, to boot with secureboot enabled, may be the same or different signing key.
The SECUREBOOT_SIGN_KEY and SECUREBOOT_SIGN_CERT may be different files. For this example the pem file generated by OpenSSL includes both the key and the accompanying certificate, and thus both variables are set to the same value.
When generating an Unified Kernel Image with systemd's ukify the kernel image will be signed automatically before inclusion in the unified kernel image and it is not necessary to sign it manually.

Architecture specific kernel configuration

The following options are recommended as well:

KERNEL Recommended Alpha options
General setup --->
  <*> SRM environment through procfs
  <*> Configure uac policy via sysctl
Plug and Play configuration --->
  <*> Plug and Play support
  <M>   ISA Plug and Play support
SCSI support --->
  SCSI low-level drivers --->
    <*> SYM53C8XX Version 2 SCSI support (NEW)
    <*> Qlogic ISP SCSI support
Network device support --->
  Ethernet (10 or 100 Mbit) --->
    <M> DECchip Tulip (dc21x4x) PCI support
    <M> Generic DECchip & DIGITAL EtherWORKS PCI/EISA
    <M> EtherExpressPro/100 support (eepro100)
    <M> EtherExpressPro/100 support (e100)
  Ethernet (1000 Mbit) --->
    <M> Alteon AceNIC
      [*] Omit support for old Tigon I
    <M> Broadcom Tigon3
  [*] FDDI driver support
  <M> Digital DEFEA and DEFPA
  <*> PPP support
    <*> PPP Deflate compression
Character devices --->
  [*] Support for console on serial port
  [*] Direct Rendering Manager
File systems --->
  <*> Kernel automounter version 4 support
  Network File Systems --->
    <*> NFS
      [*] NFSv3 client
      <*> NFS server
      [*] NFSv3 server
  Partition Types --->
    [*] Advanced partition selection
    [*] Alpha OSF partition support
  Native Language Support
    <*> NLS ISO 8859-1
Sound --->
  <M> Sound card support
    <M> OSS sound modules
      [*] Verbose initialisation
      [*] Persistent DMA buffers
      <M> 100% Sound Blaster compatibles

Compiler et installer

With the kernel configured, it is time to compile and install it. Exit the configuration and start the compilation process:

root #make && make modules_install
root #make boot
It is possible to enable parallel builds using make -jX with X being the number of parallel tasks that the build process is allowed to launch. This is similar to the instructions about /etc/portage/make.conf earlier, with the MAKEOPTS variable.

When the kernel has finished compiling, copy the kernel image to /boot/. Recent kernels might create vmlinux instead of vmlinux.gz. Keep this in mind when copying the kernel image.

root #cp arch/alpha/boot/vmlinux.gz /boot/

Kernel installation


Installkernel may be used to automate, the kernel installation, initramfs generation, unified kernel image generation and/or bootloader configuration among other things. sys-kernel/installkernel implements two paths of achieving this: the traditional installkernel originating from Debian and systemd's kernel-install. Which one to choose depends, among other things, on the system's bootloader. By default systemd's kernel-install is used on systemd profiles, while the traditional installkernel is the default for other profiles.

If unsure, follow the 'Traditional layout' subsection below.


When using systemd-boot (formerly gummiboot) as the bootloader, systemd's kernel-install must be used. Therefore ensure the systemd and the systemd-boot USE flags are enabled on sys-kernel/installkernel, and then install the relevant package for systemd-boot.

On OpenRC systems:

FILE /etc/portage/package.use/systemd-boot
sys-apps/systemd-utils boot kernel-install
sys-kernel/installkernel systemd systemd-boot
root #emerge --ask sys-apps/systemd-utils

On systemd systems:

FILE /etc/portage/package.use/systemd
sys-apps/systemd boot
sys-kernel/installkernel systemd-boot
# Needed for <systemd-254
sys-apps/systemd gnuefi
root #emerge --ask sys-apps/systemd


Users of GRUB can use either systemd's kernel-install or the traditional Debian installkernel. The systemd USE flag switches between these implementations. To automatically run grub-mkconfig when installing the kernel, enable the grub USE flag.

FILE /etc/portage/package.use/installkernel
sys-kernel/installkernel grub
root #emerge --ask sys-kernel/installkernel

When systemd's kernel-install is used, it should be configured to use the grub layout, this is the default if the grub USE flag is enabled:

FILE /etc/kernel/install.conf

Traditional layout, other bootloaders (e.g. lilo, etc.)

The traditional /boot layout (for e.g. LILO, etc.) is used by default if the grub, systemd-boot and uki USE flags are not enabled. No further action is required.

Building an initramfs

In certain cases it is necessary to build an initramfs - an initial ram-based file system. The most common reason is when important file system locations (like /usr/ or /var/) are on separate partitions. With an initramfs, these partitions can be mounted using the tools available inside the initramfs. The default configuration of the Project:Distribution Kernel requires an initramfs.

Without an initramfs, there is a risk that the system will not boot properly as the tools that are responsible for mounting the file systems require information that resides on unmounted file systems. An initramfs will pull in the necessary files into an archive which is used right after the kernel boots, but before the control is handed over to the init tool. Scripts on the initramfs will then make sure that the partitions are properly mounted before the system continues booting.

If using genkernel, it should be used for both building the kernel and the initramfs. When using genkernel only for generating an initramfs, it is crucial to pass --kernel-config=/path/to/kernel.config to genkernel or the generated initramfs may not work with a manually built kernel. Note that manually built kernels go beyond the scope of support for the handbook. See the kernel configuration article for more information.

Installkernel can automatically generate an initramfs when installing the kernel if the dracut USE flag is enabled:

FILE /etc/portage/package.use/installkernel
sys-kernel/installkernel dracut

Alternatively, dracut may be called manually to generate an initramfs. Install sys-kernel/dracut first, then have it generate an initramfs:

root #emerge --ask sys-kernel/dracut
root #dracut --kver=3.16.5-gentoo

The initramfs will be stored in /boot/. The resulting file can be found by simply listing the files starting with initramfs:

root #ls /boot/initramfs*

Optional: Building an Unified Kernel Image

An Unified Kernel Image (UKI) combines, among other things, the kernel, the initramfs and the kernel command line into a single executable. Since the kernel command line is embedded into the unified kernel image it should be specified before generating the unified kernel image (see below). Note that any kernel command line arguments supplied by the bootloader or firmware at boot are ignored when booting with secure boot enabled.

An unified kernel image requires a stub loader, currently the only one available is systemd-stub. To enable it:

For systemd systems:

FILE /etc/portage/package.use/systemd
sys-apps/systemd boot

For OpenRC systems:

FILE /etc/portage/package.use/systemd-utils
sys-apps/systemd-utils boot

Installkernel can automatically generate an unified kernel image using either dracut or ukify, by enabling the respective flag. The uki USE flag should be enabled as well to install the generated unified kernel image to the $ESP/EFI/Linux directory on the EFI system partition (ESP).

For dracut:

FILE /etc/portage/package.use/installkernel
sys-kernel/installkernel dracut uki
FILE /etc/dracut.conf

For ukify:

FILE /etc/portage/package.use/installkernel
sys-kernel/installkernel dracut ukify uki
FILE /etc/kernel/cmdline

Note that while dracut can generate both an initramfs and an unified kernel image, ukify can only generate the latter and therefore the initramfs must be generated separately with dracut.

Generic Unified Kernel Image

The prebuilt sys-kernel/gentoo-kernel-bin can optionally install a prebuilt generic unified kernel image containing a generic initramfs that is able to boot most systemd based systems. It can be installed by enabling the generic-uki USE flag, and configuring installkernel to not generate a custom initramfs or unified kernel image:

FILE /etc/portage/package.use/generic-uki
sys-kernel/gentoo-kernel-bin generic-uki
sys-kernel/installkernel -dracut -ukify uki

Secure Boot

The generic Unified Kernel Image optionally distributed by sys-kernel/gentoo-kernel-bin is already pre-signed. How to sign a locally generated unified kernel image depends on whether dracut or ukify is used. Note that the location of the key and certificate should be the same as the SECUREBOOT_SIGN_KEY and SECUREBOOT_SIGN_CERT as specified in /etc/portage/make.conf.

For dracut:

FILE /etc/dracut.conf

For ukify:

FILE /etc/kernel/uki.conf

Rebuilding external kernel modules

External kernel modules installed by other packages via linux-mod-r1.eclass must be rebuilt for each new kernel version. When the distribution kernels are used this may be automated by enabling the dist-kernel flag globally.

FILE /etc/portage/package.use/module-rebuild
*/* dist-kernel

External kernel modules may also be rebuilt manually with:

root #emerge --ask @module-rebuild

Les modules du noyau

Configurer les modules

Il est facultatif de lister manuellement les modules matériels. udev chargera normalement tous les modules pour les matériels détectés comme étant connectés dans la plupart des cas. Cependant, il n'est pas préjudiciable que les modules automatiquement détectés soient listés. Quelquefois, un matériel exotique nécessite de l'aide pour charger ses pilotes.

Listez les modules qui doivent être chargés automatiquement dans les fichiers /etc/modules-load.d/*.conf, un module par ligne. Des options supplémentaires peuvent être ajoutées, si besoin, dans les fichiers /etc/modprobe.d/*.conf.

Pour voir tous les modules disponibles, exécuter la commande find suivante. Ne pas oublier de remplacer "<version noyau>" par la version du noyau venant d'être compilé.

root #find /lib/modules/<version noyau>/ -type f -iname '*.o' -or -iname '*.ko' | less

Force loading particular kernel modules

Par exemple, pour charger automatiquement le module 3c59x.ko (correspondant au pilote pour une carte réseau de la famille 3Com), éditez le fichier /etc/modules-load.d/network.conf et ajoutez-y le nom du module. Le nom du fichier n'a pas d'importance.

root #mkdir -p /etc/modules-load.d
root #nano -w /etc/modules-load.d/network.conf

Note that the module's .ko file suffix is insignificant to the loading mechanism and left out of the configuration file:

FILE /etc/modules-load.d/network.confForcer le chargement du module 3c59x

Continuer l'installation avec Configuration du système.