Unified Kernel Images (UKI)

Linux
Published

February 15, 2024

Modified

February 15, 2024

Unified Kernel Images

UKI 1 2 …Linux kernel + initrd + kernel command line

  • …packed as UEFI PE binary
  • systemd-stub glued in front
  • …includes boot splash, DeviceTree image, OS information
  • …single file …self-contained …signed as a whole
  • …enumerable in ESP/XBOOTLDR boot menu implementation

Why use UKIs?

  • …fully-signed and fully-measured execution path for the system boot
  • …rollback protections …more simple and robust updates

Components used to boot UKI

flowchart LR
    A[EFI] --> B
    B[shim] --> C
    C[systemd-stub] --> D
    D[UKI]

systemd-boot

Not a bootloader …boot menu …chain loads other UEFI binaries

  • …configured by drop-in files …sorted by version
  • …list items in menu …boots latest
  • UEFI only…
    • …implements UAPI bootloader specifications 3
    • …can be signed by shim …can include UKI menu items
    • …supports APIs to user-space (boot selection, etc)

bootctl …CLI to interact with systemd-boot:

  • …select & list menu entries
  • …update random seed and bootloader in ESP

systemd-stub

UEFI binary …invoked by UEFI firmware

  • …transitions into the payload Linux kernel
  • …runs first in UEFI mode …hands control to Linux kernel
  • …measures UKI components …reads credentials …system extensions
    • …passed to kernel by on-the-fly generated initrd cpio archive
    • …random seed management (always after boot)

Portable Executable (PE) …standard executable format in EFI environments:

Section Description
.linux ELF Linux kernel images
.osrel OS release information
.initrd init root file-system
.cmdline Linux kernel command line

Built around TPM 2.0 functionality

  • …supports TPM measurement & signatures
  • …stores to PCR 11-13 4 …signature embedded in UKI
  • …results in a reasonably safe unattended disk encryption
  • systemd-measure …generates PCR signatures