Projects / Quern -- AArch64 OS Toolkit

Quern -- AArch64 OS Toolkit

wipRust32 · QEMU test scenarios

A Rust toolkit for building your own kernel or operating system for ARM hardware, developed from a macOS or Linux host. It boots on three emulated QEMU boards and has booted on a physical Raspberry Pi 4. Hardware bring-up is ongoing, and the MMU and interrupt controller are still to come.

STATUSwip
LANGUAGERust
METRIC32 · QEMU test scenarios
STACKRust · AArch64 · Bare Metal · QEMU · Raspberry Pi 4 · Semihosting · DHCP / TFTP
OVERVIEW

Quern provides the pieces rather than a finished design: a boot path, an AArch64 architecture layer, a board interface, drivers written against traits, and a test harness that boots the kernel and asserts on what it prints. It is AArch64-only, targets application-class Cortex-A cores with an MMU, and treats macOS on ARM as a first-class development platform, with Linux next. It is not a Linux replacement and has no POSIX layer. Maintained crates for paging and interrupt control exist, but Quern uses them as reference specs and writes its own, as a way to learn the material by building it.

ARCHITECTURE
  • Layered Cargo workspace: a hal crate of hardware-abstraction traits, arch/aarch64 (exception-level convergence, MPIDR decoding, semihosting), drivers/* (UART and BCM2711 GPIO implemented), board crates, and a shared kernel crate generic over a hal::Board.
  • Four working board crates (plus a reserved Pixel 10 crate): QEMU virt (EL1 entry, PL011), QEMU npcm845-evb (EL2 entry, DesignWare/16550 UART), QEMU raspi4b (EL3 entry, PL011) and a physical Raspberry Pi 4 (EL2 entry). Each prints a banner naming the level it converged on and the level it was handed.
  • Builds for aarch64-unknown-none-softfloat, so the compiler rejects FP/SIMD instructions in kernel code before FP is explicitly enabled.
  • An umbrella crate exposes each layer behind opt-in feature flags. Nothing is enabled by default.
TESTING
  • cargo xtask test boots 32 QEMU scenarios across the four boards (8 per board), and CI runs all 32 again as a release (LTO) build. The eight scenario kinds include clean boot, panic, panic before the console exists, a deliberate data abort, the same abort recovered from, and an interactive serial monitor.
  • EL1 exception vectors report the exception class, ESR, FAR, ELR and SPSR. They replaced silent hangs into firmware leftovers.
  • cargo xtask netboot is a std-only DHCP + TFTP server with no external crates, covered by nearly 90 host tests, including a loopback replay of a recorded boot sequence.
HARDWARE BRING-UP

Progress is kept in a dated bring-up log that also records what did not work.

  • First boot on a real Raspberry Pi 4 from SD on 2026-09-12. The banner, the EL2 entry, the delay calibration and an EL1 fault report were all read off the board.
  • Boots over TFTP since 2026-09-13, about 25 s from power-on to banner, using a dnsmasq-based setup.
  • A logic analyser measured the uncached ISB spin loop at 212–406 cycles per iteration, with the spread traced to code alignment.
  • Not yet verified on silicon: the generic timer and the native cargo xtask netboot server. Both are tested only on the host and under QEMU.
  • Next on the roadmap: the MMU and GIC to complete the bare-metal tier, then a Raspberry Pi 5, then threads and a scheduler.