This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.
Please visit our production wiki at https://wiki.gentoo.org
Efibootmgr
L'applicazione efibootmgr interagisce con il firmware UEFI nel sistema, ed è uno strumento popolare per manipolare le impostazioni EFI al fine di creare e gestire le voci di avvio che sono in grado di avviare Linux (o ogni altro sistema operativo EFI).
L'applicazione sys-boot/efibootmgr non è un bootloader. E' uno strumento che interagisce con il firmware UEFI del sistema, che a sua volta agisce come un bootloader. Utilizzando efibootmgr le voci di avvio possono essere create, rimescolate, editate e rimosse.
Installazione
Kernel
CONFIG_EFI_VARS support needs to be enabled:
Firmware Drivers ---> EFI (Extensible Firmware Interface) Support ---> <*> EFI Variable Support via sysfs
Emerge
Il pacchetto sys-boot/efibootmgr non ha nessuna USE flags. Quello che è necessario è soltanto installarlo:
root #
emerge --ask sys-boot/efibootmgr
Configurazione
Variabili EFI
Per utilizzare con successo efibootmgr, le variabili del filesystem EFI devono essere accessibili. Questo richiede che il sistema sia stato avviato in modalità EFI (e non attraverso la modalità di firmware MBR) altrimenti le variabili EFI non possono essere accessibili. Se il sistema è in modalità MBR, riavviarlo in modalità EFI. Usualmente questo coinvolge o la modifica di un'opzione nelle impostazioni del firmware o la selezione di una voce di avvio EFI nel menu di avvio del sistema.
When the system is in EFI mode, run the following command to check for the existence of efivarfs:
root #
mount | grep efivars
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
Se non è montato (in realtà dovrebbe essere montato con lo script di init sysfs) è possibile farlo manualmente utilizzando il seguente comando:
root #
mount -t efivarfs efivarfs /sys/firmware/efi/efivars
See OpenRC-0.28 news.
Preconditions
If an EFI System Partition (ESP) does not exist, one needs to be created, see EFI System Partition
Usage
Listing boot entries
Per elencare le voci di avvio correnti utilizzare l'opzione --verbose (-v)
:
root #
efibootmgr -v
BootCurrent: 0002 Timeout: 3 seconds BootOrder: 0003,0003,0002,0000,0004 Boot0000* CD/DVD Drive BIOS(3,0,00) Boot0001* Hard Drive BIOS(2,0,00) Boot0002* Gentoo HD(1,800,61800,6d98f360-cb3e-4727-8fed-5ce0c040365d)File(\EFI\boot\bootx64.efi) Boot0003* Hard Drive BIOS(2,0,00)P0: ST1500DM003-9YN16G
Creating a boot entry
Per creare una voce di avvio EFI, devono essere passati a efibootmgr un paio di argomenti:
--create (-c)
to create a new entry;--part (-p)
followed by the partition number on which the EFI System Partition is hosted;--disk (-d)
followed by the disk on which the EFI System Partition is hosted;--label (-L)
followed by the label to use as the boot entry;--loader (-l)
followed by the path of the EFI image to boot
l percorso dell'immagine EFI da avviare deve utilizzare \ (backslash) invece di / (forward slash) come separatore di percorso.
Per esempio:
root #
efibootmgr -c -d /dev/sda -p 2 -L "Gentoo" -l "\efi\boot\bootx64.efi"
Optionally, additional kernels can be installed and made known to the UEFI firmware. This is especially useful when wanting to test more kernels or to dual-boot with another operating system. These will be shown in the boot selection prompt, normally after a keyboard hotkey is pressed at the right time during system initialization. The latest added entry always gets highest boot priority, so it will be default. If the hotkey combination is unknown, search for official documentation from the computer manufacturer. This information is usually not difficult to find.
Deleting a boot entry
Prima di cancellare una voce, capire qual'è l'ID di tale voce.
Per cancellare una voce di Gentoo come mostrato sopra (che ha Boot0002 come identificatore), chiedere a efibootmgr di cancellare la voce con id 2, passando l'argomento --bootnum (-b)
come identificatore, e --delete-bootnum (-B)
per cancellare la voce:
root #
efibootmgr -b 2 -B
Rimozione
Unmerge
root #
emerge --ask --depclean sys-boot/efibootmgr
Vedere anche
- rEFInd — a boot manager for EFI and UEFI platforms
- EFI stub kernel explains how to configure the Linux kernel to be able to be booted from EFI directly
- Alternative 2: efibootmgr in the Gentoo Handbook