EFI system partition

From HandWiki
Short description: Partition used by Unified Extensible Firmware Interface
Example of an EFI system partition as shown by KDE Partition Manager

The EFI (Extensible Firmware Interface) system partition or ESP is a partition on a data storage device (usually a hard disk drive or solid-state drive) that is used by computers that have the Unified Extensible Firmware Interface (UEFI). When a computer is booted, UEFI firmware loads files stored on the ESP to start operating systems and various utilities.

An ESP contains the boot loaders or kernel images of installed operating systems (which are typically contained in other partitions), device driver files for hardware devices present in a computer and used by the firmware at boot time, system utility programs that are intended to be run before an operating system is booted, and data files such as error logs.[1]

Overview

The EFI system partition is formatted with a file system whose specification is based on the FAT file system and maintained as part of the UEFI specification; therefore, the file system specification is independent from the original FAT specification. The actual extent of divergence is unknown:[2] Apple maintains a separate tool that should be used,[3] while other systems use FAT utilities just fine.[4] The globally unique identifier (GUID) for the EFI system partition in the GUID Partition Table (GPT) scheme is C12A7328-F81F-11D2-BA4B-00A0C93EC93B, while its ID in the master boot record (MBR) partition-table scheme is 0xEF. Both GPT- and MBR-partitioned disks can contain an EFI system partition, as UEFI firmware is required to support both partitioning schemes. Also, El Torito bootable format for CD-ROMs and DVDs is supported.[1]

UEFI provides backward compatibility with legacy systems by reserving the first block (sector) of the partition for compatibility code, effectively creating a legacy boot sector. On legacy BIOS-based systems, the first sector of a partition is loaded into memory, and execution is transferred to this code. UEFI firmware does not execute the code in the MBR, except when booting in legacy BIOS mode through the Compatibility Support Module (CSM).[1]

The UEFI specification requires MBR partition tables to be fully supported.[1] However, some UEFI implementations immediately switch to the BIOS-based CSM booting upon detecting certain types of partition table on the boot disk, effectively preventing UEFI booting from being performed from EFI system partitions contained on MBR-partitioned disks.[5]

UEFI firmware supports booting from removable storage devices such as USB flash drives. For that purpose, a removable device is formatted with a FAT12, FAT16 or FAT32 file system, while a boot loader needs to be stored according to the standard ESP file hierarchy, or by providing a complete path of a boot loader to the system's boot manager. On the other hand, FAT32 is always expected on fixed drives.[1]

Usage

Linux

GRUB 2 and elilo serve as conventional, full-fledged standalone UEFI boot loaders for Linux. Once loaded by a UEFI firmware, they both can access and boot kernel images from all devices, partitions and file systems they support, without being limited to the EFI system partition.

EFI Boot Stub makes it possible to boot a Linux kernel image without the use of a conventional UEFI boot loader. By masquerading as a PE/COFF image and appearing to the firmware as a UEFI application, an x86 kernel image with EFI Boot Stub enabled can be directly loaded and executed by a UEFI firmware. Such kernel images can still be loaded and run by BIOS-based boot loaders; thus, EFI Boot Stub allows a single kernel image to work in any boot environment.[6]

Linux kernel's support for the EFI Boot Stub is enabled by turning on option CONFIG_EFI_STUB (EFI stub support) during the kernel configuration.[7] It was merged into version 3.3 of the Linux kernel mainline, released on March 18, 2012.[8] Systemd-boot is a simple UEFI boot manager that loads and runs configured UEFI images, accessing only the EFI system partition. Configuration file fragments, kernel images and initrd images are required to reside on the EFI system partition, as Gummiboot does not provide support for accessing files on other partitions or file systems. Linux kernels need to be built with CONFIG_EFI_STUB enabled so they can be directly executed as UEFI images.[9]

The historical mount point for the EFI system partition has usually been /boot/efi, however other mount points (such as /efi or /boot, both preferred over /boot/efi by systemd and systemd-boot[10]) may also be used. Regardless of mount point, its content is accessible after Linux is booted.[11]

macOS

On macOS computers based on the x64 hardware architecture, the EFI system partition is initially left blank and unused for booting.[12] However, the EFI system partition is used as a staging area for firmware updates.[13] The logic usually goes as follows: the EFI first looks for a bootloader in ESP, and if there isn't one it will continue to the macOS file system.[citation needed]

The pre-UEFI Apple–Intel architecture (mactel) EFI subsystem used to require the EFI system partition to be formatted in HFS+. Any third-party bootloader also needs to be "blessed" by a special ioctl command before becoming bootable by the firmware, a relic of the system folder blessing from classic Mac OS. There are otherwise no limitations to what kinds of EFI operating system or bootloader a mactel machine can run.[14][15]

Windows

On Windows XP 64-Bit Edition and later, access to the EFI system partition is obtained by running the mountvol command.

The Windows boot manager is located at the \EFI\MICROSOFT\BOOT\ subfolder of the EFI system partition.

See also

References

  1. 1.0 1.1 1.2 1.3 1.4 "Unified Extensible Firmware Interface (UEFI) Specification (versions 2.10 and older)" (PDF). August 2022. https://www.uefi.org/specifications. 
  2. "UEFI Specification Version 2.5, Section 12.3 File System Format" (PDF). April 2015. pp. 536, 537. http://www.uefi.org/sites/default/files/resources/UEFI%202_5.pdf#page=536. "The file system supported by the Extensible Firmware Interface is based on the FAT file system. EFI defines a specific version of FAT that is explicitly documented and testable. Conformance to the EFI specification and its associate reference documents is the only definition of FAT that needs to be implemented to support EFI. To differentiate the EFI file system from pure FAT, a new partition file system type has been defined." 
  3. "Technical Note TN2166: Secrets of the GPT". 2006-11-06. https://developer.apple.com/library/mac/technotes/tn2166/_index.html#//apple_ref/doc/uid/DTS10003927-CH1-SUBSECTION6. 
  4. "EFI system partition". https://wiki.archlinux.org/index.php/EFI_system_partition. 
  5. "UEFI system booting from MBR partition table and GRUB legacy". June 2012. https://bbs.archlinux.org/viewtopic.php?id=142637. 
  6. "Linux kernel documentation: Documentation/efi-stub.txt". 2014-06-16. https://www.kernel.org/doc/Documentation/efi-stub.txt. 
  7. "Linux kernel 3.11.1 arch/x86/Kconfig: CONFIG_EFI_STUB (line #1575)". https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/arch/x86/Kconfig?id=refs/tags/v3.11.1#n1575. 
  8. "Linux kernel 3.3: 1.10. EFI boot support". 2012-03-18. http://kernelnewbies.org/Linux_3.3#head-b8360946e9fb561ee77f807ced5396e64aabeca4. 
  9. "gummiboot: Simple UEFI Boot Manager". http://freedesktop.org/wiki/Software/gummiboot/. 
  10. "gpt-generator, bootctl, nspawn: EFI mount point handling updates by poettering · Pull Request #3757 · systemd/systemd" (in en). https://github.com/systemd/systemd/pull/3757. 
  11. "UEFI - Community Ubuntu Documentation". 2013-12-21. https://help.ubuntu.com/community/UEFI. 
  12. "rEFIt: Myths and Facts About Intel Macs – Myth: Mac OS X Requires a Hidden EFI System Partition". http://refit.sourceforge.net/myths/. 
  13. "Firmware updates for Intel-based Macs require a GUID partition scheme". Apple Knowledgebase. http://support.apple.com/kb/HT2434. 
  14. "Ubuntu + Mac: Pure EFI Boot". http://heeris.id.au/2014/ubuntu-plus-mac-pure-efi-boot. 
  15. "bless(8) Man Page". https://ss64.com/osx/bless.html.  [this is an earlier version that had Mac OS 9-specific flags]

External links