Handbook:PPC/Installation/Kernel/it

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Handbook:PPC/Installation/Kernel and the translation is 100% complete.
Manuale PPC
Installazione
Riguardo l'installazione
Il mezzo d'installazione
Configurare la rete
Preparare i dischi
Installare lo stage3
Installare il sistema base
Configurare il kernel
Configurare il sistema
Strumenti di sistema
Configurare l'avviatore
Ultimare l'installazione
Lavorare con Gentoo
Introduzione a Portage
Opzioni USE
Funzionalità di Portage
Sistema script di init
Variabili d'ambiente
Lavorare con Portage
File e cartelle
Variabili
Mixare i rami del software
Strumenti aggiuntivi
Repositorio pacchetti personalizzato
Funzionalità avanzate
Configurare la rete
Come iniziare
Configurazione avanzata
Networking modulare
Wireless
Aggiungere funzionalità
Gestione dinamica

Firmware

Alcuni driver richiedono firmware addizionali da installare nel sistema affinché funzioni. Questo caso riguarda spesso le interfacce di rete, specialmente le interfacce di rete wireless. La maggior parte dei firmware si trovano su 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
Nota
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.

Microcode

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.

Kernel configuration and compilation

Adesso è ora di configurare e compilare i sorgenti del kernel. Ci sono due approcci per farlo:

Ranked from least involved to most involved:

  1. Il kernel sarà configurato e compilato manualmente.
  2. Un programma di nome genkernel sarà usato per compilare ed installare il kernel automaticamente.

Il nucleo su cui tutte le distribuzioni si basano è il kernel Linux, che fa da intermediario tra i programmi dell'utente ed il sistema fisico (hardware). Gentoo offre ai suoi utenti numerosi possibili sorgenti per il kernel. Una lista completa con descrizioni è disponibile alla pagina panoramica sui kernel.

Installare i sorgenti

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

When installing and compiling the kernel for ppc-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

Questo comando installerà i sorgenti del kernel Linux in /usr/src/ in cui un collegamento simbolico chiamato linux punterà ai sorgenti appena installati:

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

Alternativa: Usare genkernel

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

Se la configurazione manuale risulta troppo difficoltosa, allora è raccomandato usare genkernel. Esso configurerà e costruirà il kernel in modo automatico.

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

Installation

Vediamo ora come usare genkernel. Prima di tutto, installare sys-kernel/genkernel:

root #emerge --ask sys-kernel/genkernel

Generation

Ora, compilare i sorgenti del kernel eseguendo genkernel all. Attenzione, genkernel compila un kernel che supporta quasi tutto l'hardware possibile, questa compilazione richiederà molto tempo prima di arrivare alla fine!

Nota
Se la partizione di boot non usa ext2 o ext3 come filesystem potrebbe essere necessario configurare manualmente il kernel usando genkernel --menuconfig all e aggiungere il supporto a questo tipo particolare di filesystem nel kernel (ovvero, non come modulo). Gli utenti di LVM2 dovranno probabilmente aggiungere anche --lvm come argomento.
Nota
Users of LVM2 should add --lvm as an argument to the genkernel command below.
root #genkernel all

Quando genkernel conclude, vengono creati un kernel, un insieme completo di moduli e un disco RAM iniziale (initramfs). Useremo il kernel e l'initrd per configurare un boot loader più avanti in questo documento. Annotarsi i nomi del kernel e dell'initrd, in quanto queste informazioni verranno usate quando verrà modificato il file di configurazione del boot loader. L'initrd verrà avviato immediatamente dopo che il processo di avvio avrà effettuato l'autorilevamento dell'hardware (proprio come fa il CD di installazione) prima che il sistema "reale" si avvii.

root #ls /boot/kernel* /boot/initramfs*

Predefinito: Configurazione manuale

Introduzione

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

Configurare manualmente un kernel è spesso considerata la procedura più difficile che un utente Linux debba compiere. Niente di più falso - dopo aver configurato un paio di kernel nessuno nemmeno ricorda che fosse difficile ;)

Comunque, una cosa è vera: è di vitale importanza conoscere il sistema quando si configura il kernel manualmente. La maggior parte delle informazioni si possono raccogliere installando sys-apps/pciutils che contiene il comando lspci:

root #emerge --ask sys-apps/pciutils
Nota
Dentro la chroot (radice cambiata), si possono ignorare con sicurezza gli avvisi pcilib (come pcilib: cannot open /sys/bus/pci/devices) che lspci potrebbere tirar fuori.

Un'altra fonte di informazioni è lsmod per vedere quali moduli del kernel il CD di installazione usa, poiché ciò potrebbe dare buone idee su cosa abilitare.

Adesso bisogna spostarsi nella directory del sorgente del kernel ed eseguire make menuconfig. Questo farà apparire il menù di configurazione.

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

La configurazione del kernel Linux ha molte, molte sezioni. Per prima cosa saranno elencate le opzioni che devono essere attivate (altrimenti Gentoo non funzionerà, o non funzionerà correttamente senza modifiche aggiuntive). Esiste anche una guida alla configurazione del kernel Gentoo nel wiki di Gentoo che potrebbe aiutare ulteriormente.

Abilitare le opzioni richieste

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

Assicurarsi che ogni driver vitale per l'avvio del sistema (come un controller SCSI, ecc.) sia compilato nel kernel e non come modulo, altrimenti il sistema non sarà in grado di avviarsi completamente.

Proseguire selezionando l'esatto tipo di processore. È anche raccomandato abilitare le funzionalità MCE (se disponibili) così che gli utenti possano ricevere notifiche su eventuali problemi hardware. Su alcune architetture (come x86_64), questi errori non sono scritti su dmesg, ma su /dev/mcelog. Ciò richiede il pacchetto app-admin/mcelog.

Selezionare anche Maintain a devtmpfs file system to mount at /dev (Mantenere un file system devtmpfs da montare su /dev) così che i file dei dispositivi critici siano già presenti durante il processo di avvio (CONFIG_DEVTMPFS e CONFIG_DEVTMPFS_MOUNT):

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

Verificare che il supporto dischi SCSI sia stato attivato (CONFIG_BLK_DEV_SD):

KERNEL Abilitare il supporto dischi 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

Adesso andare su File Systems e selezionare il supporto ai file system desiderati. Non si compili il file system usato per la radice (root) come modulo, altrimenti Gentoo non sarà in grado di montare questa partizione. Selezionare anche Virtual memory e /proc file system. Selezionare una o più delle seguenti opzioni come richiesto dal sistema (CONFIG_EXT2_FS, CONFIG_EXT3_FS, CONFIG_EXT4_FS, CONFIG_MSDOS_FS, CONFIG_VFAT_FS, CONFIG_PROC_FS, e CONFIG_TMPFS):

KERNEL Selezionare i file system necessari
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 PPPoE è usato per connettersi ad Internet, o un modem dial-up, allora abilitare le seguenti opzioni (CONFIG_PPP, CONFIG_PPP_ASYNC, e CONFIG_PPP_SYNC_TTY):

KERNEL Selezionare i driver necessari per PPPoE
Device Drivers --->
  Network device support --->
    <*> PPP (point-to-point protocol) support
    <*>   PPP support for async serial ports
    <*>   PPP support for sync tty ports

Le due opzioni di compressione non causaranno danni, ma non sono assolutamente necessarie, né lo è l'opzione PPP attraverso Ethernet, che potrebbe essere utilizzata solo da ppp quando configurata per eseguire PPPoE in modalità kernel.

Non si dimentichi di includere il supporto nel kernel per le schede di rete (Ethernet o wireless).

La maggior parte dei sistemi dispone di più core, quindi è importante attivare Symmetric multi-processing support (CONFIG_SMP):

KERNEL Abilitare il supporto SMP
Processor type and features  --->
  [*] Symmetric multi-processing support
Nota
Nei sistemi multi-core, ogni core conta come un processore.

Se verranno utilizzati dispositivi di input USB (come tastiera o mouse) o altri dispositivi USB, non si dimentichi di abilitare anche quelli (CONFIG_HID_GENERIC e CONFIG_USB_HID, CONFIG_USB_SUPPORT, CONFIG_USB_XHCI_HCD, CONFIG_USB_EHCI_HCD, CONFIG_USB_OHCI_HCD):

KERNEL Abilitare supporto USB per dispositivi di input
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

Handbook:PPC/Blocks/Kernel/it

Opzionale: Creare un'immagine initramfs

In alcuni casi è necessario costruire un initramfs - un file system iniziale basato sulla RAM. Il motivo più frequente per esso è quando posizioni di importanti file system (come /usr/ o /var/) sono su partizioni separate. Con un initramfs, queste partizioni possono essere montate usando gli strumenti disponibili all'interno di initramfs.

Senza un initramfs, c'è un alto rischio che il sistema non si avvii correttamente, in quanto gli strumenti che sono responsabili del montaggio dei file system hanno bisogno di informazioni che risiedono sui file system stessi. Un initramfs caricherà i file necessari in un archivio che sarà usato subito appena il kernel si avvia, ma prima che il controllo passi allo strumento di init. Gli script sull'initramfs faranno sì che le partizioni siano montate correttamente prima che il sistema prosegua il suo avvio.

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

Per installare un'immagine initramfs, installare prima sys-kernel/genkernel, poi fargli generare un'immagine initramfs:

root #emerge --ask sys-kernel/genkernel
root #genkernel --install initramfs

L'initramfs verrà conservato dentro /boot/. Il file risultante può essere trovato elencando semplicemente i file che iniziano con initramfs:

root #ls /boot/initramfs*

Adesso si continui con i Moduli del kernel.

Moduli del kernel

Configurazione dei moduli

Nota
Hardware modules are optional to be listed manually. udev will normally load all hardware modules that are detected to be connected in most cases. However, it is not harmful for modules that will be automatically loaded to be listed. Modules cannot be loaded twice; they are either loaded or unloaded. Sometimes exotic hardware requires help to load their drivers.

Elencare i moduli, che serve caricare automaticamente, su /etc/conf.d/modules. Anche le opzioni extra possono essere aggiunte ai moduli se necessario.

Per visualizzare tutti i moduli disponibili, eseguire il seguente comando find. Non dimenticarsi di sostituire "<versione del kernel>" con la versione del kernel appena compilata:

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

Force loading particular kernel modules

Per esempio, per caricare automaticamente il modulo 3c59x.ko (che è il driver per una famiglia specifica di schede di rete 3Com), modificare il file /etc/conf.d/modules ed inserirvi il nome del modulo.

root #nano -w /etc/conf.d/modules
modules="3c59x"

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.confForce loading 3c59x module
3c59x

Continuare l'installazione con la Configurazione del sistema.