A capability-based multikernel OS for ARMv8, running on real hardware and under QEMU. Built on the Barrelfish research kernel out of ETH Zürich and UBC.
This started as a capstone for a university OS course. What the course hands you is barely a kernel: a bootloader, a syscall table, a capability system with almost nothing built on top of it, and a build system with nothing to build. Everything that makes it an operating system, physical and virtual memory management, process creation, inter-process communication, multicore bring-up, and a working shell, I designed and wrote myself. I kept building after the course ended. Full breakdown below, under "What I built".
kernel/ the privileged core: arch/arm, arch/armv8
lib/aos/ userland runtime, paging, capabilities, IPC, threads
usr/ userspace programs: init, shell, drivers, tests
include/ headers shared across kernel and userland
devices/ Mackerel register descriptions, per-SoC
hake/ the build system (Haskell DSL, generates Makefiles)
tools/ debug scripts, board flashing tools, autograder harness
doc/ design notes, one topic per numbered folder
You need the Nix shell. It pins the cross-compiler, QEMU, and GHC so the build is the same on any machine:
nix-shell shell.nix
Then configure and build out-of-tree:
mkdir build && cd build
../hake/hake.sh -s ../ -a armv8
make -j$(nproc)
make qemu_armv8
Boots init, then the shell, on ARMv8 system emulation. Fastest way to
check you haven't broken anything.
The i.MX8X boots over U-Boot using UUU (tools/imx8x/). Build the image,
then push it to the board:
./tools/serverboot.sh build/armv8_imx8x_aos_autograder_None_img
run.sh wraps this for the default build. UUU needs to be on your $PATH.
If the board isn't enumerating, check tools/imx8x/bf-boot.sh first.
QEMU starts with -S and a GDB stub, so you can break at boot before the
kernel runs a single instruction:
make debugsim
tools/debug.sh wires up the ports and cleans up the QEMU process on exit.
tools/debugsim.sh loads kernel and process symbols so backtraces resolve
across the privilege boundary, kernel and user, in the same GDB session.
The skeleton gave me a capability system with no allocator behind it, a bootloader that brings up exactly one core, and no way to run more than one process. Everything below, I built to close that gap.
Memory management. A buddy allocator that manages every physical page on
the machine down to 4KB, built to survive the fragmentation patterns a real
OS produces under sustained allocation and freeing. On top of it, a virtual memory subsystem I designed from scratch: a
linked-list VMA tracker per address space covering text, data, BSS, stack,
and heap, and a four-level page table walker I wrote by hand, since nothing
in the skeleton touched a page table. The heap grows lazily under real
memory pressure: a fault past the break gets resolved into a live mapping
with no crash and no stall. Kernel-internal allocation runs through a slab
allocator I wrote for exactly this layer, because general-purpose malloc
isn't available yet when the kernel itself needs memory.
Process lifecycle. Spawning a process meant building the entire path from nothing: a fresh VSpace and CSpace per child, an ELF loader I wrote to parse and map executable images section by section into an isolated address space, and dispatcher setup that hands a new process correct initial register state on first run. Suspend, resume, and termination all go through process control logic I built on top of that same foundation.
Inter-process communication. I designed and implemented two IPC paths because one protocol can't serve both cases well. LMP carries short, synchronous calls between processes sharing a core: capability transfer, memory requests, RPC-style calls that need a reply before the caller continues. UMP is my zero-copy channel for anything crossing a core boundary: lock-free circular buffers in shared memory that move messages without invoking the kernel on every send, which keeps cross-core IPC fast under heavy message traffic.
Multicore execution. The skeleton runs one core and stops there. Getting the rest of the machine online meant writing the low-level bring-up sequence by hand for each secondary core: allocate its stack, point it at entry code, signal it to start, and bring its scheduler online once it's running. I then built cross-core process management on top of the UMP layer, so spawning a process on core 3 from code running on core 0 goes through a single call.
Interactive shell. A full user-space shell built from nothing: a line editor, command history, a parser, and built-in commands for driving and inspecting the running system, starting and killing processes, reading memory, watching what every core's scheduler is doing, live.
The baseline (capability model, syscall interface, Hake, the device
register descriptions under devices/) is
Barrelfish, from the Systems Group at ETH Zürich
and the University of British Columbia. Full list in AUTHORS. Everything
under "What I built" was designed and written by me, on top of that
baseline.
MIT. See LICENSE.