OpenBoot
Draft: this page is not reviewed yet.

Architecture overviewDraft

This page describes the parts of OpenBoot and how they relate. The structure is the same for every device; what each device needs is data in its descriptor. Facts that have been verified on one generation only are on the pages of that generation, today the M5 series; see Supported hardware for what works where. Details of each part live in the source tree; this page gives the map.

The idea#

An Apple silicon Mac has no standard firmware that a general-purpose operating system can boot from. It has no UEFI, no standard interrupt controller (Windows expects a GIC; the machine has Apple's own controller), and its storage and USB controllers differ from the PC kind. OpenBoot fills the gap in two layers: a small supervisor at EL2 that owns the hardware, and a standard UEFI environment on top of it. The guest operating system sees a machine it knows, plus drivers for the pieces that remain different.

The parts#

Part Where Role
Boot image openboot/ C, assembly and Rust bare-metal code, linked into one raw image, openboot.bin. Runs at EL2.
EL2 supervisor openboot/src/el2_*.c and related files Starts and supervises one guest at EL1: stage 2 translation, virtual interrupt controller, virtual devices, CPU start.
UEFI firmware uefi/OpenBootPkg, EDK II submodule Standard UEFI services for the guest: boot manager, storage, ACPI tables, graphics output, runtime services.
Device descriptors devices/ Per-machine data: chip and board identity, tier, known-good layout, CPU data, quirks.
Debug monitor and link openboot/src/dbg/, tools/oblink/ A command monitor on the target and OBLink, the link to a host over plain USB.
Windows drivers win/ Drivers for hardware Windows has no driver for on Apple silicon, one directory per driver stream. They are experimental.
Host tools and tests tools/, tests/, efi/tests/ Generators, test harnesses and the debug daemon.

From power-on to a guest#

  1. The machine's own boot firmware loads the OpenBoot image as a custom boot object and starts it at EL2. The image identifies the machine from the device tree and looks it up in the compiled-in descriptor table. A machine without a descriptor is reported as unknown.
  2. The image initialises the hardware it needs: memory layout, display, storage, USB, the internal keyboard and trackpad.
  3. It shows the boot menu. The menu offers the operating systems it finds, the UEFI boot manager menu and a settings page. What boots by default, and whether it boots automatically, are settings stored in the machine's NVRAM under OpenBoot's own ob- variables (ob-autoboot, ob-default, ob-timeout, ob-lastfail, ob-hold). A default build does not read them (OB_STANDALONE=0) and does not write them (OB_SETTINGS_WRITE=0); see Build and host tests. A default that cannot be found never falls back to another entry; the menu opens with the reason.
  4. To start a guest, the supervisor checks the UEFI firmware image that is embedded in the boot image, copies it to its fixed address and passes a versioned handoff descriptor (OpenBootHandoff.h) to the UEFI start code. The descriptor describes the framebuffer, interrupt controller, storage regions, the original device tree, CPUs and runtime memory. The UEFI firmware then enters the standard EDK II DXE core.
  5. The guest, for example Windows, runs at EL1 under the supervisor.

The EL2 supervisor#

The guest runs with stage 2 translation set up as an identity map of the machine's DRAM, so a guest physical address equals the machine address. Addresses outside DRAM are device memory for the guest, and the supervisor traps accesses to the ranges it emulates.

What the supervisor emulates for the guest:

  • Interrupt controller. The machine has no GIC, and Windows expects one. The supervisor presents a GICv3 distributor and redistributors in a synthetic address range and implements them on top of the machine's own interrupt controller.
  • USB host controller. A virtual xHCI delivers the internal keyboard to the guest.
  • NVMe storage. A mediator presents the register file the guest sees in place of the machine's storage coprocessor. The mediator source also contains a write guard; its policy is not described here.
  • CPUs. Secondary CPUs are started for the guest from a spin table of CPU entries in the handoff.

Where hardware can be given to the guest unchanged, the project prefers that over emulation, and writes a driver for the guest instead. The supervisor emulates only what the guest operating system has no model for.

Memory protection of the image itself#

The image has a fixed layout, which the build checks at link time, and with the default EL2_DRAM_XN=1 the build also checks that EL2's own memory map allows execution only for the code range. Both checks are part of make, so a link that violates them fails.

UEFI firmware#

The firmware under uefi/OpenBootPkg uses upstream EDK II for the SEC start, the DXE core, Boot Services and the boot manager. Platform code for the machine consists of DXE drivers for storage, USB, graphics output, ACPI, SMBIOS, the interrupt controller, runtime services, the non-volatile variable store and Secure Boot. EDK II is licensed BSD-2-Clause-Patent; see Legal and licences.

OBLink is the project's debug link: a CDC-ACM serial link over plain USB between the target and a second computer, run by the host daemon in tools/oblink. A monitor on the target answers commands, and the link can push a new image to a target that is held at its start. OBLink is the only debug link of the project.

Some older low-level code for Apple's own debug USB mode is still in the source tree. It is for kernel-level debugging, is not a supported user feature, and is not documented here.

Windows drivers#

Windows drivers live under win/: input devices, storage, USB-C, Wi-Fi, Bluetooth, and the GPU stack. They are experimental. The drivers overview links one status page per stream.

Where the code came from#

Part of the low-level code derives from the m1n1 project of the Asahi Linux Contributors and keeps that credit. The EDK II files are used under their own licence. See Legal and licences.

What is not verified#

This page describes the source tree. The runtime behaviour described in the list above is taken from comments and tests in the code, and from the hardware results, which cover one generation only: see its status page and its platform page for what the code does on that hardware. The page has not been reviewed against a release, so it is a draft.