UEFI: Difference between revisions
Guest09248 (talk | contribs) |
Prabuanand (talk | contribs) (moved Tip from introduction section) |
||
| (35 intermediate revisions by 7 users not shown) | |||
| Line 1: | Line 1: | ||
{{TOC right}} | {{TOC right}} | ||
[https://en.wikipedia.org/wiki/UEFI Unified Extensible Firmware Interface(UEFI)] is a specification for the firmware architecture of a computing platform. This page documents how Alpine Linux works with devices using UEFI firmware. | |||
= | == EFI system partition == | ||
UEFI requires a partition called "EFI System Partition" (ESP) - a FAT32 partition where the OS [[Bootloaders|bootloader]] apps get installed to. This is also commonly known as ESP partition. | |||
UEFI | The UEFI specification defines a standard boot path for systems without NVRAM entries as follows: | ||
<EFI_SYSTEM_PARTITION>\EFI\BOOT\BOOT<MACHINE_TYPE_SHORT_NAME>.EFI | |||
Most of the programs that are expected to run in the UEFI environment are bootloaders, but other utilities might exist too. There are also programs to deal with firmware updates from motherboard manufacturers which can run before operating system startup like <Code>fwupdate/fwupd</Code>. | |||
=== EFI bootloaders === | |||
When installing Alpine linux in [[System Disk Mode]], the [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/db542902/setup-disk.in#L319-L334 setup-disk script] creates both a named bootloader (in \EFI\alpine\) and a copy at the | |||
standard boot path (in \EFI\boot\) for all architectures as shown in the below table. The installation script does not create NVRAM boot entries. | |||
{| class="wikitable" | |||
! Architecture | |||
! Named Bootloader | |||
! Fallback Bootloader | |||
|- | |||
| x86_64 | |||
| {{Path|\EFI\alpine\grubx64.efi}} | |||
| {{Path|\EFI\boot\bootx64.efi}} | |||
|- | |||
| x86 (32-bit) | |||
| {{Path|\EFI\alpine\grubia32.efi}} | |||
| {{Path|\EFI\boot\bootia32.efi}} | |||
|- | |||
| arm* | |||
| {{Path|\EFI\alpine\grubarm.efi}} | |||
| {{Path|\EFI\boot\bootarm.efi}} | |||
|- | |||
| aarch64 (ARM64) | |||
| {{Path|\EFI\alpine\grubaa64.efi}} | |||
| {{Path|\EFI\boot\bootaa64.efi}} | |||
|- | |||
| riscv64 | |||
| {{Path|\EFI\alpine\grubriscv64.efi}} | |||
| {{Path|\EFI\boot\bootriscv64.efi}} | |||
|- | |||
| loongarch64 | |||
| {{Path|\EFI\alpine\grubloongarch64.efi}} | |||
| {{Path|\EFI\boot\bootloongarch64.efi}} | |||
|} | |||
== UEFI boot process == | |||
UEFI has list of possible boot entries, stored in UEFI config variables (normally in NVRAM), and boot order config variables stored alongside them. UEFI firmware can read ESP partition, a UDF or FAT32-formatted USB drive or DVD, and look for OS boot loaders and runs it. | |||
These boot entries in NVRAM can be viewed and edited with [[Bootloaders#efibootmgr|efibootmgr]] utility. | |||
== BIOS boot process == | |||
BIOS mainly supports two methods of booting - loading approximately 448 bytes of 8088 machine code from the start of a floppy disk, or the same from the start of a fixed disk. BIOS can only assume one boot loader occupying the start of hard drive. So each OS overwrites it with its own boot loader. | |||
MBR cannot handle disks larger than 2 TiB (2<sup>32</sup> × 512 bytes). Therefore, it is impossible to use any drive space beyond 2 TiB using MBR layout. | |||
''' | BIOS is '''deprecated''' since approximately 2011 onwards and modern motherboards are using UEFI. | ||
== Secure boot process == | |||
{{Main|UEFI Secure Boot}} | |||
When the device is powered ON, secure boot checks the digital signatures of the bootloader and operating system. If the signatures are valid and match the trusted keys stored in the system, the boot process continues. If not, secure boot halts the process to protect against tampering. | |||
Almost all X86 based motherboard has a small list of pre-trusted certificates which includes Microsoft's certificates, which they currently let anyone use for a small fee as a Certification Authority (CA). | |||
Alpine Linux does not have a certificate which some other Linux distributions (mostly enterprise-related) have. | |||
{{Tip| To install Alpine Linux ''' Disable''' Secure boot in the UEFI firmware. It can be enabled after Alpine Linux is installed.}} | |||
[[UEFI Secure Boot]] page explains how to generate your own UEFI keys and enrolling those UEFI keys to be used with a Unified Kernel Image. | |||
== | == Disk layout and UEFI == | ||
[[#UEFI-GPT layout|UEFI-GPT layout]] is the recommended layout for UEFI. UEFI relies on the boot entries in NVRAM and looks for OS bootloaders and runs it. | |||
=== UEFI-GPT layout === | |||
Booting UEFI systems from GPT-partitioned disks is commonly called UEFI-GPT booting. On GPT disks, the EFI System Partition is identified by its partition type GUID (C12A7328-F81F-11D2-BA4B-00A0C93EC93B). | |||
On UEFI systems, Alpine Linux requires an EFI System Partition(ESP) in addition to the (/) root partition. A minimal UEFI-GPT layout is given below: | |||
{| class="wikitable" | {| class="wikitable" | ||
| Line 54: | Line 89: | ||
! Recommended minimum size | ! Recommended minimum size | ||
|- | |- | ||
| /boot or / | | /efi or /boot/efi or /boot | ||
| /dev/sda1 | | /dev/sda1 | ||
| | | EFI system partition | ||
| 260 MiB | | 260 MiB | ||
|- | |- | ||
| Line 63: | Line 98: | ||
| Alpine Linux root system OS | | Alpine Linux root system OS | ||
| 1–32 GiB | | 1–32 GiB | ||
|} | |} | ||
=== BIOS-MBR layout === | |||
BIOS-style booting from MBR-partitioned disks is called BIOS-MBR, regardless of it being performed on UEFI or legacy BIOS-based systems. Such a boot scheme is commonly called UEFI-MBR. | |||
Despite the fact that the UEFI specification requires MBR partition tables to be fully supported, some UEFI firmware implementations may immediately switch to BIOS-based Compatibility Support Module (CSM) booting depending on the type of boot disk's partition table, effectively preventing UEFI booting to be performed from EFI System Partition on MBR-partitioned disks. CSM is a deprecated feature as of late 2020's. | |||
'''Use this only on legacy motherboards using [[#BIOS boot process|BIOS boot process ]]'''. A BIOS boot partition with "boot" flag is required when using this layout. | |||
{| class="wikitable" | {| class="wikitable" | ||
| Line 87: | Line 123: | ||
| Alpine Linux root system OS | | Alpine Linux root system OS | ||
| 1–32 GiB | | 1–32 GiB | ||
|} | |} | ||
=== BIOS-GPT layout === | |||
Booting legacy BIOS-based systems from GPT disks is also possible, and such a boot scheme is commonly called BIOS-GPT. A BIOS boot partition with "boot" flag is required when using this layout. This partition must '''not''' be formatted with a file system or mounted. | |||
{| class="wikitable" | {| class="wikitable" | ||
| Line 111: | Line 144: | ||
| Alpine Linux root system OS | | Alpine Linux root system OS | ||
| 1–32 GiB | | 1–32 GiB | ||
|} | |} | ||
= | == See also == | ||
* [[UEFI_Secure_Boot|How to enable secure boot]] | |||
* [[Bootloaders]] | |||
* [[ | |||
* [[Create UEFI secureboot USB]] | * [[Create UEFI secureboot USB]] | ||
* [[Setting_up_disks_manually#Manual_partitioning | Manual partitioning]] | |||
[[Category: | * [https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface UEFI - Archwiki] | ||
[[Category: | * [https://en.wikipedia.org/wiki/EFI_system_partition EFI System Partition - Wikipedia] | ||
[[Category:Installation]][[Category:UEFI]] | |||
Latest revision as of 16:58, 1 November 2025
Unified Extensible Firmware Interface(UEFI) is a specification for the firmware architecture of a computing platform. This page documents how Alpine Linux works with devices using UEFI firmware.
EFI system partition
UEFI requires a partition called "EFI System Partition" (ESP) - a FAT32 partition where the OS bootloader apps get installed to. This is also commonly known as ESP partition.
The UEFI specification defines a standard boot path for systems without NVRAM entries as follows:
<EFI_SYSTEM_PARTITION>\EFI\BOOT\BOOT<MACHINE_TYPE_SHORT_NAME>.EFI
Most of the programs that are expected to run in the UEFI environment are bootloaders, but other utilities might exist too. There are also programs to deal with firmware updates from motherboard manufacturers which can run before operating system startup like fwupdate/fwupd.
EFI bootloaders
When installing Alpine linux in System Disk Mode, the setup-disk script creates both a named bootloader (in \EFI\alpine\) and a copy at the standard boot path (in \EFI\boot\) for all architectures as shown in the below table. The installation script does not create NVRAM boot entries.
| Architecture | Named Bootloader | Fallback Bootloader |
|---|---|---|
| x86_64 | \EFI\alpine\grubx64.efi | \EFI\boot\bootx64.efi |
| x86 (32-bit) | \EFI\alpine\grubia32.efi | \EFI\boot\bootia32.efi |
| arm* | \EFI\alpine\grubarm.efi | \EFI\boot\bootarm.efi |
| aarch64 (ARM64) | \EFI\alpine\grubaa64.efi | \EFI\boot\bootaa64.efi |
| riscv64 | \EFI\alpine\grubriscv64.efi | \EFI\boot\bootriscv64.efi |
| loongarch64 | \EFI\alpine\grubloongarch64.efi | \EFI\boot\bootloongarch64.efi |
UEFI boot process
UEFI has list of possible boot entries, stored in UEFI config variables (normally in NVRAM), and boot order config variables stored alongside them. UEFI firmware can read ESP partition, a UDF or FAT32-formatted USB drive or DVD, and look for OS boot loaders and runs it.
These boot entries in NVRAM can be viewed and edited with efibootmgr utility.
BIOS boot process
BIOS mainly supports two methods of booting - loading approximately 448 bytes of 8088 machine code from the start of a floppy disk, or the same from the start of a fixed disk. BIOS can only assume one boot loader occupying the start of hard drive. So each OS overwrites it with its own boot loader.
MBR cannot handle disks larger than 2 TiB (232 × 512 bytes). Therefore, it is impossible to use any drive space beyond 2 TiB using MBR layout.
BIOS is deprecated since approximately 2011 onwards and modern motherboards are using UEFI.
Secure boot process
When the device is powered ON, secure boot checks the digital signatures of the bootloader and operating system. If the signatures are valid and match the trusted keys stored in the system, the boot process continues. If not, secure boot halts the process to protect against tampering.
Almost all X86 based motherboard has a small list of pre-trusted certificates which includes Microsoft's certificates, which they currently let anyone use for a small fee as a Certification Authority (CA).
Alpine Linux does not have a certificate which some other Linux distributions (mostly enterprise-related) have.
UEFI Secure Boot page explains how to generate your own UEFI keys and enrolling those UEFI keys to be used with a Unified Kernel Image.
Disk layout and UEFI
UEFI-GPT layout is the recommended layout for UEFI. UEFI relies on the boot entries in NVRAM and looks for OS bootloaders and runs it.
UEFI-GPT layout
Booting UEFI systems from GPT-partitioned disks is commonly called UEFI-GPT booting. On GPT disks, the EFI System Partition is identified by its partition type GUID (C12A7328-F81F-11D2-BA4B-00A0C93EC93B).
On UEFI systems, Alpine Linux requires an EFI System Partition(ESP) in addition to the (/) root partition. A minimal UEFI-GPT layout is given below:
| Mount point | Partition | Partition type Purpose | Recommended minimum size |
|---|---|---|---|
| /efi or /boot/efi or /boot | /dev/sda1 | EFI system partition | 260 MiB |
| / | /dev/sda2 | Alpine Linux root system OS | 1–32 GiB |
BIOS-MBR layout
BIOS-style booting from MBR-partitioned disks is called BIOS-MBR, regardless of it being performed on UEFI or legacy BIOS-based systems. Such a boot scheme is commonly called UEFI-MBR.
Despite the fact that the UEFI specification requires MBR partition tables to be fully supported, some UEFI firmware implementations may immediately switch to BIOS-based Compatibility Support Module (CSM) booting depending on the type of boot disk's partition table, effectively preventing UEFI booting to be performed from EFI System Partition on MBR-partitioned disks. CSM is a deprecated feature as of late 2020's.
Use this only on legacy motherboards using BIOS boot process . A BIOS boot partition with "boot" flag is required when using this layout.
| Mount point | Partition | Partition type Purpose | Recommended minimum size |
|---|---|---|---|
| /boot | /dev/sda1 | Boot grub partition (optional) | 100 MiB |
| / | /dev/sda2 | Alpine Linux root system OS | 1–32 GiB |
BIOS-GPT layout
Booting legacy BIOS-based systems from GPT disks is also possible, and such a boot scheme is commonly called BIOS-GPT. A BIOS boot partition with "boot" flag is required when using this layout. This partition must not be formatted with a file system or mounted.
| Mount point | Partition | Partition type Purpose | Recommended minimum size |
|---|---|---|---|
| None | /dev/sda1 | BIOS boot partition | 8 MiB |
| / | /dev/sda2 | Alpine Linux root system OS | 1–32 GiB |