The Big Picture: UEFI as a Mini Operating System

Under the hood, UEFI behaves like a tiny operating system. It stores its code in organised volumes, runs applications, offers protocols (standard ways to use devices), reads files from a special partition, and keeps a boot menu. This section looks at each of those five ideas.

5.1 UEFI Firmware Volumes

What it is: The firmware chip is not one blob. It is divided into firmware volumes (FVs). A firmware volume is like a mini file system inside the flash chip. It holds files, and each file holds code or data.

Analogy: The flash chip is a filing cabinet. Each firmware volume is a drawer. Each file is a folder with one module or one block of data in it.

SPI flash chip (for example 16 MB)
├── Descriptor / ME region   (chipset and vendor data, on some Intel PCs)
├── BIOS region
│    ├── Firmware Volume 1: early boot code (SEC, PEI modules)
│    ├── Firmware Volume 2: drivers and applications (DXE modules)
│    └── NVRAM area: stored UEFI variables (boot entries, settings)
└── Other regions (for example vendor data)

What a file in a volume can be:

File typeWhat it holds
PEI moduleEarly code that starts RAM
DXE driverA driver for a device or a service
UEFI applicationA program (for example the setup screen)
Raw dataImages (the logo), fonts, settings defaults

Why it matters:

  • This is the modular design from Section 4.4 stored on the chip.
  • A firmware update replaces the contents of the volumes.
  • Security: firmware volumes can be signed and checked, so tampering can be found.

File names are GUIDs. Every module has a 128-bit GUID (Globally Unique IDentifier), written like 12345678-ABCD-4EF0-9876-0123456789AB (an example). A GUID is a number so big that two people picking one at random will practically never pick the same.

5.2 UEFI Applications

What it is: A UEFI application is a program that runs inside UEFI, before and without an operating system. It is a file ending in .efi, in the PE format (the same file format as Windows .exe files).

Types of .efi programs:

KindExamples
OS boot loadersbootmgfw.efi (Windows Boot Manager), GRUB, systemd-boot
The UEFI ShellA text command line (like a tiny Command Prompt) inside the firmware
DiagnosticsMemory test programs, manufacturer test tools
Firmware update toolsMaker tools that flash the chip
Setup screenThe setup menu itself is often a UEFI application

UEFI drivers are different from applications. A UEFI driver stays in memory and gives a service (for example "read NTFS files"). An application runs, finishes and exits. A boot loader is special: it runs and never returns (because it starts the OS).

Bootloader hand-off. The boot loader asks UEFI to load the kernel, then calls ExitBootServices(). This tells the firmware: "I'm the OS now. Stop your drivers and services." After that, only a few runtime services (reading the clock, reading and writing UEFI variables) stay available.

Firmware running (Boot Services on)
        │
        ▼ loads and starts bootmgfw.efi
Boot loader runs
        │ loads Windows kernel and drivers
        ▼ calls ExitBootServices()
Windows takes over (only Runtime Services remain)
Boot ServicesRuntime Services
AvailableOnly before the OS startsAlso after the OS starts
What forMemory, drivers, loading files, eventsClock, variables, firmware update capsules, reset
Ended byExitBootServices()They remain

5.3 UEFI Protocols

What it is: A protocol is UEFI's way of describing a service. A protocol is a set of function pointers (a "menu of actions") with a GUID as its name. A driver "installs" a protocol on a handle (a handle is just a token that stands for a device or an image). Any program can then ask "who offers protocol X?" and use it.

Analogy: A phone book. Each service (printing, reading files, drawing) has a name (a GUID). A driver registers its service in the book. A program looks up the name and calls the number.

Examples of protocols:

ProtocolWhat it lets you do
Simple Text OutputPrint text on the screen
Simple Text InputRead key presses
Graphics Output Protocol (GOP)Draw pixels on the screen (replaces VGA / INT 10h)
Block I/ORead and write raw disk sectors
Simple File SystemRead files from a FAT partition
Disk I/O / Partition infoLook at partitions
USB, PCI I/OTalk to devices
Network protocols (TCP/IP, HTTP, PXE)Use the network
Load ImageLoad another .efi program

How a disk becomes a file system. A stack of drivers builds on each other:

Disk hardware (NVMe, SATA)
   │ driver installs ► Block I/O protocol  (raw sectors)
   ▼
Partition driver
   │ installs ► Block I/O per partition
   ▼
FAT driver
   │ installs ► Simple File System protocol  (folders and files)
   ▼
Boot loader reads  \EFI\Microsoft\Boot\bootmgfw.efi

Why protocols are better than interrupts. BIOS used numbered INT calls on one fixed table. Protocols are named, discoverable and replaceable. A new driver can offer a better version of the same service.

Graphics at boot. The GOP gives the OS a simple framebuffer (a block of memory whose bytes are the pixels). Windows uses it to show the logo before its own graphics driver loads.

5.4 EFI System Partition (ESP)

What it is: The EFI System Partition (ESP) is a small partition on the disk that holds the boot loaders and boot files. UEFI cannot boot from just any partition. It reads files from the ESP, which is formatted as FAT32 (the simple, widely supported file system that UEFI firmware understands built-in).

ItemDetail
File systemFAT32
Typical sizeOften about 100 to 500 MB (about)
Partition typeA special GPT type ("EFI System")
Visible to the user?Hidden in Windows, no drive letter
ContentsFolders for each OS's loader, drivers, tools

Diagram of a GPT disk showing the partition entries and where the partitions are placed

Figure 5.6 — Look again at the GPT disk. The partitions (Partition 1, Partition 2 and more) start at LBA 34. On a typical UEFI PC, one of these early partitions is the ESP. The firmware finds it by reading the partition entries in the table. Diagram: Kbolino, CC BY-SA 2.5, via Wikimedia Commons.

A typical Windows disk (UEFI/GPT):

PartitionPurpose
EFI System Partition (FAT32)Boot loader and boot files
Microsoft Reserved (MSR)A small reserved area used by Windows
C: (Primary) (NTFS)Windows itself and your files
Recovery (NTFS)Windows recovery tools

What is inside the ESP:

EFI System Partition (FAT32)
└── EFI
    ├── BOOT
    │   └── BOOTX64.EFI          ← fallback loader (removable disks use this)
    ├── Microsoft
    │   └── Boot
    │       ├── bootmgfw.efi      ← Windows Boot Manager
    │       └── BCD               ← Boot Configuration Data (the boot menu list)
    └── (other OSes, e.g. ubuntu, with their own folders)

Look at it (Windows, as Administrator):

mountvol S: /s
dir S:\EFI
mountvol S: /d

mountvol S: /s gives the ESP a temporary drive letter S:. mountvol S: /d removes it again. Look, do not delete. Deleting files here can make the PC unbootable.

You can also see it with diskpart then list disk (a * in the Gpt column means GPT) or in PowerShell with Get-Partition (the type shows "System").

5.5 UEFI Boot Manager

What it is: The UEFI Boot Manager is the part of the firmware that decides what to start. It reads a list of boot entries stored in NVRAM (non-volatile memory in the flash chip, Section 7).

The main variables:

VariableMeaning
BootOrderThe list of entries in the order to try (for example 0001, 0000, 0003)
Boot0001, Boot0002 ...One entry each: a name and the path of an .efi file
BootNextBoot this entry once next time, then forget it
BootCurrentThe entry that started the current boot

An entry looks like this: a name ("Windows Boot Manager") plus a path (which disk, which partition, which file: \EFI\Microsoft\Boot\bootmgfw.efi).

How it chooses:

  1. Try the first entry in BootOrder.
  2. If it works, run it. If the file is missing, try the next.
  3. If all fail, try the fallback path on each disk, such as \EFI\BOOT\BOOTX64.EFI.
  4. If nothing works, show a message or open the setup screen.
BootOrder: 0001, 0000, 0002
   │
   ▼
Try Boot0001 "Windows Boot Manager" ─► run \EFI\Microsoft\Boot\bootmgfw.efi ─► Windows
   │ (if fails)
   ▼
Try Boot0000 "USB Flash" ─► ... ─► (if all fail) fallback BOOTX64.EFI ─► error message

Look at the entries (Windows, Administrator Command Prompt):

bcdedit /enum firmware

This prints the firmware boot entries, including the Windows Boot Manager and the display order. (Do not use /set unless you know what you are doing.)

Why the entry list is better than BIOS: The old BIOS simply tried disks in a fixed order and ran the first sector. UEFI knows named programs. You can have several OSes, each with its own loader and entry, and pick from a boot menu (often F12 or F8 at start-up).

Windows reboot to firmware: shutdown /r /fw restarts the PC straight into the firmware setup screen.

Summary

TermPlain meaning
Firmware volume (FV)A mini file system inside the firmware chip
GUIDA 128-bit unique name
UEFI applicationA .efi program run by UEFI (a boot loader, a shell)
Boot ServicesUEFI services that exist only before the OS starts
ExitBootServices()The call that hands the machine to the OS
Runtime ServicesThe few services that stay (clock, variables)
ProtocolA named set of actions that a driver offers
HandleA token that stands for a device or image
GOPGraphics Output Protocol: draw on screen at boot
ESPEFI System Partition: small FAT32 partition with boot files
bootmgfw.efiThe Windows Boot Manager program
BootOrder / Boot####The stored boot menu in NVRAM
Fallback loader\EFI\BOOT\BOOTX64.EFI, used when no entry works