BIOS, UEFI, and the EFI System Partition

Updated

October 30, 2026

BIOS, UEFI, and the EFI System Partition

Before operating systems run, firmware governs the machine. Understanding firmware architecture is essential when designing bootable installation media.

Legacy BIOS (Basic Input/Output System)

For over thirty years, IBM PC-compatible machines booted via Legacy BIOS: - 16-bit Real Mode: The CPU started in 16-bit real mode with access to only 1 MB of RAM. - Master Boot Record (MBR): The BIOS read the first 512-byte sector of the boot drive into memory address 0x7C00. - Constraint: The MBR contained partition table definitions and machine code. Because 512 bytes is too small for a modern filesystem driver, bootloaders required multi-stage hacks (Stage 1 in MBR sector 0, Stage 1.5 in post-MBR gap, Stage 2 in /boot). - Disk Limit: MBR partition tables cannot address disks larger than 2.2 Terabytes (32-bit sector addressing).

Modern UEFI (Unified Extensible Firmware Interface)

Modern systems boot using UEFI: - Native 64-bit Architecture: Runs in 64-bit protected mode from the first instruction with full access to system RAM. - GPT (GUID Partition Table): Supports disks up to 9.4 Zettabytes and up to 128 primary partitions with unique 128-bit GUIDs. - Built-in Filesystem Driver: UEFI firmware natively understands the FAT32 filesystem!

The EFI System Partition (ESP)

Under UEFI, the firmware does not execute raw binary sectors from disk blocks. Instead, it inspects GPT partition headers to find a partition with the specific GUID C12A7328-F81F-11D2-BA4B-00A0C93EC93B (the EFI System Partition, or ESP), formatted as FAT32 (or FAT16).

ESP Partition (Mounted at /boot/efi or /boot)
└── EFI/
    ├── BOOT/
    │   └── BOOTX64.EFI        # Default fallback EFI binary
    ├── byol/
    │   └── grubx64.efi        # Custom distro bootloader
    └── Linux/
        └── vmlinuz.efi        # EFISTUB direct kernel binary

The Default Fallback Path

When a removable USB stick or DVD is inserted, the firmware does not know which OS is installed. The UEFI specification mandates a standard fallback path for x86_64 machines:

/EFI/BOOT/BOOTX64.EFI

On aarch64 (ARM64), this file is /EFI/BOOT/BOOTAA64.EFI. When authoring an ISO or USB installer in Chapter 10, placing your bootloader at this exact path ensures it boots seamlessly on any UEFI hardware.

NVRAM Boot Entries and efibootmgr

UEFI motherboards maintain non-volatile RAM (NVRAM) storing boot priority entries. You can inspect and modify these from Linux using efibootmgr:

# Listing boot entries:
$ efibootmgr -v
BootCurrent: 0001
BootOrder: 0001,0002,0000
Boot0001* BYOL Linux   HD(1,GPT,a48f...)/File(\EFI\byol\grubx64.efi)

# Creating a new boot entry for BYOL:
$ efibootmgr --create --disk /dev/nvme0n1 --part 1 \
    --label "BYOL Linux" \
    --loader '\EFI\byol\grubx64.efi'