UEFI

From Gentoo Wiki
Jump to:navigation Jump to:search
Resources

UEFI, short for Unified Extensible Firmware Interface, is a firmware standard for boot ROM designed to provide a stable API for interacting with system hardware. On x86 it replaced the legacy BIOS.

It was developed by Intel as Extensible Firmware Interface, short EFI, for the Itanium architecture ("IA-64" or Intel Architecture 64-bit). Like Open Firmware it is designed to be an architecture independent platform available to different CPU instruction sets. It was ported to 32-bit x86 "IA-32" (also i386 and x86-32), 64-bit x86 "x86-64" (also x64, AMD64 and Intel 64), ARM, RISC-V, and LoongArch.

Any boot ROM that conforms to the UEFI specification is a UEFI ROM. There are multiple implementations, including the open source TianoCore EDK II which serves as the UEFI reference implementation. It is sometimes also called UEFI-BIOS, which is due to it being the BIOS successor on x86, even when it is not BIOS compatible (i.e. in native EFI mode, and after ~2020 missing the BIOS compatibility mode "CSM" entirely).

Introduction

The UEFI architecture defines a system initialization process which differs from the classic BIOS one. The main difference happens after a successful self-check and device initialization—on internal drives UEFI then selects one of its stored boot entries (see efibootmgr), determines the location of the corresponding EFI application (EFI bootloaders or EFI stubs) on the EFI System Partition (ESP) and launches it. This process is very different to the BIOS approach, which simply reads the first 512-byte sector, like the Master Boot Record (MBR), of the first in the list of available devices (Boot Drive) and runs it. Instead, (U)EFI has to load the bootloader from the ESP, making the GPT partitioning scheme as well as the FAT file system of the ESP part of the firmware specification. The EFI application's binary formats have to correspond with the architecture from which is being booted. On removable media bootloaders for various platforms may be included, see removable media boot path on the ESP.

UEFI also brings support for features like:

Kernel configuration

In order to support native (U)EFI, the kernel needs to be configured with EFI support.

KERNEL Enable basic (U)EFI boot support
Processor type and features  --->
   [*] EFI runtime service support Search for <code>CONFIG_EFI</code> to find this item.
   [ ]   EFI stub support Search for <code>CONFIG_EFI_STUB</code> to find this item.
   [ ]     EFI mixed-mode support Search for <code>CONFIG_EFI_MIXED</code> to find this item.


The EFI stub support is required to boot the kernel directly as an EFI executable, as is the EFI mixed-mode support in case a 64-bit kernel is to be booted directly from a 32-bit EFI implementation.

In order to provide access to the EFI functions from a booted system, additional kernel features must be enabled.

KERNEL (U)EFI kernel features
File systems  --->
   Pseudo filesystems  --->
       <M/*> EFI Variable filesystem Search for <code>CONFIG_EFIVAR_FS</code> to find this item.
Device Drivers  --->
   Firmware Drivers  --->
       EFI (Extensible Firmware Interface) Support  --->
           <M/*> Register efivars backend for pstore Search for <code>CONFIG_EFI_VARS_PSTORE</code> to find this item.
             [*]   Disable using efivars as a pstore backend by default Search for <code>CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE</code> to find this item.
           <*> Export efi runtime maps to sysfs Search for <code>CONFIG_EFI_RUNTIME_MAP</code> to find this item.
           [*] Reserve EFI Specific Purpose Memory Search for <code>CONFIG_EFI_SOFT_RESERVE</code> to find this item.


Note
CONFIG_EFI_VARS was removed in 2023.[1]

Especially efivarfs must be loaded in order for efibootmgr to work. See efibootmgr for further details.

Tip
All (U)EFI functions can be disabled with the kernel parameter efi=noruntime, or activated with efi=runtime. A kernel booted without EFI runtime functions will not be able to alter any EFI settings and variables, including the boot configuration.

Alternatives

The open source hardware initializer ROM Coreboot can deploy UEFI, BIOS, and Open Firmware boot ROMs among others.

See Also

  • BIOS — the standard firmware of IBM-PC-compatible computers until it was phased out in 2020.
  • Coreboot — a free and opensource hardware initializing firmware which supports multiple boot ROM payloads.
  • Open Firmware — an IEEE 1275-1994 standard for hardware independent firmware built on top of a Forth machine.

External resources

References