Translations:Handbook:PPC/Installation/Kernel/2/pt-br

From Gentoo Wiki
Jump to:navigation Jump to:search
Handbook:PPC Manual
Installation
Sobre a instalação
Escolhendo a mídia
Configurando a rede
Preparando os discos
Instalando o stage3
Instalando o sistema base
Configurando o kernel
Configurando o sistema
Instalando as ferramentas
Configurando o gerenciador de boot
Finalizando
Trabalhando com o Gentoo
Introdução ao Portage
USE flags
Recursos do Portage
Sistema initscript
Variáveis de ambiente
Trabalhando com o portage
Arquivos e diretórios
Variáveis
Misturando ramos de software
Ferramentas adicionais
Árvore customizada do Portage
Recursos avançados
Configuração de rede
Iniciando
Configuração avançada
Uso de rede modular
Rede sem fio
Adicionando funcionalidade
Gerenciamento dinâmico

Firmware

Suggested: Linux Firmware

On many systems, non-FOSS firmware is required for certain hardware to function. The sys-kernel/linux-firmware package contains firmware for many, but not all, devices.

Tip
Most wireless cards and GPUs require firmware to function.
root #emerge --ask sys-kernel/linux-firmware
Note
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.
Firmware Loading

Firmware files are typically loaded when the associated kernel module is loaded. This means the firmware must be built into the kernel using CONFIG_EXTRA_FIRMWARE if the kernel module is set to Y instead of M. In most cases, building-in a module which required firmware can complicate or break loading.

Architecture specific firmware

Note
Placeholder for architecture-specific firmware information

sys-kernel/installkernel

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.

Bootloader

Now is the time to think about which bootloader the user wants for the system, if unsure, follow the 'Traditional layout' subsection below.

GRUB

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

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

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

Initramfs

An initial ram-based file system, or initramfs, may be required for a system to boot. A wide of variety of cases may necessitate one, but common cases include:

  • Kernels where storage/filesystem drivers are modules.
  • Layouts with /usr/ or /var/ on separate partitions.
  • Encrypted root filesystems.
Tip
Distribution kernels are designed to be used with an initramfs, as many storage and filesystem drivers are built as modules.

In addition to mounting the root filesystem, an initramfs may also perform other tasks such as:

  • Running file system consistency check fsck, a tool to check and repair consistency of a file system in such events of uncleanly shutdown a system.
  • Providing a recovery environment in the event of late-boot failures.

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

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

Kernel configuration and compilation

Tip
It can be a wise move to use the dist-kernel on the first boot as it provides a very simple method to rule out system issues and kernel config issues. Always having a known working kernel to fallback on can speed up debugging and alleviate anxiety when updating that your system will no longer boot.

É chegada a hora de configurar e compilar os fontes do kernel. Há duas formas de se fazer isso:

Note
During the installation phase of Gentoo, only one kernel type should be installed i.e. either the sys-kernel/gentoo-kernel-bin or sys-kernel/gentoo-sources.

Ranked from least involved to most involved:

  1. O kernel é manualmente configurado e compilado, ou
  2. é usada uma ferramenta chamada genkernel para automaticamente compilar e instalar o kernel Linux

O núcleo em torno do qual todas as distribuições são criadas é o kernel Linux. Ele é a camada entre os programas de usuários e o hardware do sistema. O Gentoo provê aos seus usuários diversos possíveis fontes do kernel. Uma listagem completa está disponível na Página de visão geral do kernel.

Tip
Kernel installation tasks such as copying the kernel image to /boot or the EFI System Partition, generating an initramfs and/or Unified Kernel Image, updating bootloader configuration, can be automated with installkernel. Users may wish to configure and install sys-kernel/installkernel before proceeding. See the Kernel installation section below for more more information.

Instalando os fontes

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

Choose an appropriate kernel source and install it using emerge:

root #emerge --ask sys-kernel/

Isso irá instalar os fontes do kernel Linux em /usr/src/ no qual um link simbólico chamado linux estará apontando para o fonte do kernel instalado:

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-

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-

Padrão: Configuração manual

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

Manually configuring a kernel is commonly seen as one of the most difficult procedures a system administrator has to perform. Nothing is less true - after configuring a few kernels no one remembers that it was difficult! There are two ways for a Gentoo user to manage a manual kernel system, both of which are listed below:

Modprobed-db process

A very easy way to manage the kernel is to first install sys-kernel/gentoo-kernel-bin and use the sys-kernel/modprobed-db to collect information about what the system requires. modprobed-db is a tool which monitors the system via crontab to add all modules of all devices over the system's life to make sure it everything a user needs is supported. For example, if an Xbox controller is added after installation, then modprobed-db will add the modules to be built next time the kernel is rebuilt. More on this topic can be found in the Modprobed-db article.

Manual process

This method allows a user to have full control of how their kernel is built with as minimal help from outside tools as they wish. Some could consider this as making it hard for the sake of it.

Porém, uma coisa é verdade: é vital conhecer o sistema quando um kernel é configurado manualmente. A maioria das informações pode ser coletada fazendo emerge no sys-apps/pciutils que contém o comando lspci:

root #emerge --ask sys-apps/pciutils
Note
Dentro do chroot, é seguro ignorar qualquer aviso da pcilib (como pcilib: cannot open /sys/bus/pci/devices) que o lspci possa emitir.

Uma outra fonte de informação do sistema é executar o lsmod para ver quais módulos do kernel o CD de instalação usa pois isso pode dar dicas sobre o que habilitar.

Agora vá para o diretório dos fontes do kernel e execute make menuconfig. Isso irá mostrar uma tela de configuração baseada em menus.

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

The kernel has a method of autodetecting the modules currently being used on the installcd which will give a great starting point to allow a user to configure their own. This can be called by using:

root #make localmodconfig

It's now time to configure using nconfig:

root #make nconfig

A configuração do kernel do Linux tem muitas, muitas seções. Vamos primeiro mostrar algumas opções que devem ser ativadas (ou senão o Gentoo não irá funcionar, ou não funcionar adequadamente sem alguns ajustes). Existe também o Guia de configuração do kernel do Gentoo no wiki do Gentoo que poderá também ajudar.

Enabling required options

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 --->
    [*] 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

Certifique-se de que todos os drivers que forem vitais para a inicialização do sistema (tais como controladores SCSI etc) são compilados no kernel e não como módulos, ou senão o sistema não será capaz de inicializar completamente.

Em seguida selecione o tipo exato do processador. É também recomendado habilitar os recursos MCE (se disponíveis) de modo que os usuários possam ser notificados sobre quaisquer problemas de hardware. Em algumas arquiteturas (tais como a x86_64), esses erros não são impressos pelo dmesg, mas em /dev/mcelog. Isso requer o pacote app-admin/mcelog.

Selecione também Maintain a devtmpfs file system to mount at /dev assim os arquivos de dispositivos críticos estarão disponíveis logo durante o processo de inicialização (CONFIG_DEVTMPFS and CONFIG_DEVTMPFS_MOUNT):

KERNEL Habilitando suporte ao devtmpfs
Device Drivers --->
  Generic Driver Options --->
    [*] Maintain a devtmpfs filesystem to mount at /dev
    [ ]   Automount devtmpfs at /dev, after the kernel mounted the rootfs

Verifique se o suporte a discos SCSI foi ativado (CONFIG_BLK_DEV_SD):

KERNEL Habilitando suporte a discos SCSI
Device Drivers --->
   SCSI device support  --->
      <*> SCSI disk support
KERNEL Enabling basic SATA and PATA support (CONFIG_ATA_ACPI, CONFIG_SATA_PMP, CONFIG_SATA_AHCI, CONFIG_ATA_BMDMA, CONFIG_ATA_SFF, CONFIG_ATA_PIIX)
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:

KERNEL Enabling additional NVMe support (CONFIG_NVME_MULTIPATH, CONFIG_NVME_MULTIPATH, CONFIG_NVME_HWMON, CONFIG_NVME_FC, CONFIG_NVME_TCP, CONFIG_NVME_TARGET, CONFIG_NVME_TARGET_PASSTHRU, CONFIG_NVME_TARGET_LOOP, CONFIG_NVME_TARGET_FC, CONFIG_NVME_TARGET_FCLOOP, CONFIG_NVME_TARGET_TCP
[*] 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

Vá agora para File Systems (Sistemas de Arquivos) e selecione suporte para os sistemas de arquivos que você usa. Não compile o sistema de arquivo que é usado como sistema de arquivo raiz como módulo, ou senão o sistema Gentoo não será capaz de montar a partição. Selecione também "Virtual memory" (Memória virtual) e "/proc file system" (sistema de arquivo /proc). Selecione uma ou mais das seguintes opções segundo as necessidades do sistema: (CONFIG_EXT2_FS, CONFIG_EXT3_FS, CONFIG_EXT4_FS, CONFIG_MSDOS_FS, CONFIG_VFAT_FS, CONFIG_PROC_FS, and CONFIG_TMPFS):

KERNEL Selecionando os sistemas de arquivos necessários
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)

Se for usado PPPoE para conectar à Internet, ou um modem com discagem foi usado, então habilite as seguintes opções (CONFIG_PPP, CONFIG_PPP_ASYNC, e CONFIG_PPP_SYNC_TTY):

KERNEL Selecionando os drivers PPPoE necessários
Device Drivers --->
  Network device support --->
    <*> PPP (point-to-point protocol) support
    <*>   PPP support for async serial ports
    <*>   PPP support for sync tty ports

As duas opções de compactação não vão atrapalhar mas definitivamente não são necessárias, assim como a opção de PPP sobre Ethernet (PPP over Ethernet), que pode apenas ser usada pelo ppp quando configurado para usar PPPoE em modo kernel.

Não se esqueça de incluir suporte no kernel para as placas de rede (ethernet ou sem fio).

A maioria dos sistemas tem múltiplos núcleos à disposição, então é importante ativar a opção "Symmetric multi-processing support" (suporte a multi-processamento simétrico) (CONFIG_SMP):

KERNEL Ativando suporte a SMP
Processor type and features  --->
  [*] Symmetric multi-processing support
Note
Em sistemas com vários núcleos, cada núcleo conta como um processador.

Se forem usados dispositivos de entrada USB (como teclado ou mouse) ou outros dispositivos USB, não se esqueça de habilitá-los também (CONFIG_HID_GENERIC and CONFIG_USB_HID, CONFIG_USB_SUPPORT, CONFIG_USB_XHCI_HCD, CONFIG_USB_EHCI_HCD, CONFIG_USB_OHCI_HCD):

KERNEL Ativando suporte a dispositivos de entrada 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:

KERNEL Sign kernel modules 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
KERNEL Specify signing key CONFIG_MODULE_SIG_KEY
-*- 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
USE="modules-sign"
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
# Optionally, when using custom signing keys.
MODULES_SIGN_KEY="/path/to/kernel_key.pem"
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
Note
MODULES_SIGN_KEY and MODULES_SIGN_CERT may point to 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.

Architecture specific kernel configurations

Note
Placeholder for architecture-specific kernel build information

Compiling and installing

Note
Placeholder for instructions for building and installing the kernel sources

Deprecated: Genkernel

Genkernel should only be considered by users with a required need that only Genkernel can meet. For others, it is recommended to use the Distribution kernel or manually compile their own as it will make maintaining a Gentoo system a lot more simple. An example of why genkernel is more difficult to manage is the lack of integration with sys-kernel/installkernel. This means a user will not get the same level of automation as provided by the other methods; for example, Unified Kernel Images will need to be created manually when using Genkernel.

Users still wishing to use Genkernel should see the Genkernel article for more information.

Módulos do kernel

Configurando os módulos

Note
É opcional listar manualmente os módulos de hardware. udev irá normalmente carregar todos os módulos de hardware que forem detectados ou conectados na maioria dos casos. Entretanto, não causa problema que módulos carregados automaticamente sejam listados. As vezes, algum hardware mais exótico requer alguma ajuda para carregar seus drivers.

Liste os módulos que precisem ser carregados no arquivo /etc/modules-load.d/*.conf, um módulo por linha. Opções extra para os módulos, se necessárias, devem ser configuradas nos arquivos /etc/modprobe.d/*.conf.

Para visualizar todos os módulos disponíveis, execute o seguinte comando find. Não se esqueça de substituir "<kernel version>" pela versão do kernel recém compilada:

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

Force loading particular kernel modules

Por exemplo, para carregar automaticamente o módulo 3c59x.ko (que é o driver para uma placa de rede específica da família 3Com), edite o arquivo /etc/modules-load.d/network.conf e entre com o nome do módulo nele. O nome real do arquivo não é significativo para o carregador.

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.confForçar o carregamento do módulo 3c59x
3c59x

Continue a instalação em Configurando o sistema.