This document preserves the full subsystem feature overview, directory layout, toolchain/host prerequisites, build/test commands, interactive shell commands, and roadmap details for milo.
arch/, kernel/hal/, kernel/core/):
_start), VBAR_EL1 vector table dispatch, FP/SIMD enablement, and kernel/user context switching (cpu_switch_context, enter_user_mode, enter_user_context, return_to_kernel, kernel_thread_trampoline).TTBR0_EL1 / TTBR1_EL1) with hybrid 2 MiB block / 4 KiB page RAM mapping, W^X and PXN/UXN enforcement, lazy demand-zero paging, and Copy-on-Write (CoW) page fault resolution./memreserve/, linux,initrd-*, and virtio,mmio discovery, GICv2 interrupt controller (gicv2), ARM Generic Timer (100 Hz preemptive tick), PL011 MMIO UART console driver, SplitVirtqueue, VirtioMmioTransport, and virtio_blk block driver.Kernel::Traits::is_bool / is_bool_v).kernel/runtime/, kernel/sync/):
-std=c++20 -ffreestanding -fno-exceptions -fno-rtti and strict warning/static-analysis gates (clang-format, clang-tidy).Kernel::Sync::IrqGuard: zero-overhead RAII interrupt-masking guard.kernel/mm/):
MM::Page & MM::PageFrameAllocator: FDT-driven physical memory discovery (with /memreserve/ carveouts and discontiguous bank gaps) and atomic reference counting (page_get / page_put) for CoW sharing.MM::KernelHeap: 8-class slab allocator (16 B - 2048 B) paired with a compound multi-page allocator backing kmalloc/kzalloc/krealloc/kfree and operator new/delete.MM::AddressSpace: isolated user page tables, clone(), map_demand_zero(), and validated copy_from_user/copy_to_user transfers.kernel/process/):
Process class with preemptive round-robin Scheduler and intrusive WaitQueues.FdTable & FileDescriptor: RAII file descriptor table with geometric growth bounded by RLIMIT_NOFILE, RLIMIT_NPROC dynamic scaling, and O_CLOEXEC support.SignalTable: per-process signal masks, SigAction handlers, unmaskable SIGKILL/SIGSTOP invariant enforcement, and EL0 rt_sigframe delivery/unwinding (rt_sigreturn).UserStackBuilder: System V AArch64 ABI initial stack layout (argc, argv, envp, auxv including AT_RANDOM).kernel/uapi/, kernel/syscalls/, kernel/time/):
kernel/uapi/ headers verified at compile time with sizeof, offsetof, std::is_trivial_v, and std::is_standard_layout_v static_asserts.Time::Duration domain wrapper isolating internal timer/nanosecond logic from linux_timespec/linux_timeval.clone, execve with #! shebangs, wait4, exit/exit_group, job control, prlimit64), memory (brk, mmap, munmap, mprotect), VFS/IO (openat, read, write, writev, pipe2, dup/dup3, fcntl, ioctl, getdents64, ppoll, pselect6, ftruncate/truncate, utimensat, fsync/fdatasync, fchmod/fchmodat, fchown/fchownat, newfstatat/fstat, faccessat/faccessat2, readlinkat, mkdirat, unlinkat, renameat/renameat2, getcwd, chdir, lseek, close), sockets (socket, socketpair, bind, listen, accept/accept4, connect, getsockname, getpeername, sendto, recvfrom, setsockopt, getsockopt, shutdown, sendmsg, recvmsg), signals (rt_sigaction, rt_sigprocmask, rt_sigreturn, kill), and time/system info (clock_gettime, nanosleep, times, getrusage, sysinfo, getrandom, uname).kernel/fs/, kernel/ipc/, kernel/loader/, kernel/drivers/):
rootfs (CPIO newc archive loading), tmpfs (page-backed writable filesystem), ext2 (block-backed filesystem with direct, singly indirect, and doubly indirect blocks, directory entry creation/coalescing, and fsync), and devfs (/dev/console, /dev/tty, /dev/null with termios/winsize ioctls, canonical/non-canonical line discipline, and foreground PGID job control, plus /dev/fb0 and /dev/input/event<N>).Kernel::IPC::Pipe ring buffer with blocking/non-blocking I/O, SIGPIPE generation, and poll() support.Elf64View, load_elf, load_elf_interpreter) with OOM rollback and W^X segment mapping.VirtioMmioTransport), SplitVirtqueue, VirtioMmioBus, and drivers (virtio_blk, virtio_gpu, virtio_input, virtio_net).user/, tests/host/, kernel/shell/):
user/hello.s, user/hello_musl.c, user/hello_dyn.c, user/fb_test.c, user/evdev_smoke.c, user/unix_echo_server.c, user/unix_echo_client.c, user/unix_sock_smoke.c) and optional musl, BusyBox, and GNU Bash initrd images (initrds/busybox.cpio, initrds/bash.cpio).snitch unit tests (HOST_TEST) with ASan/UBSan and gcovr coverage.milo>) with hardware diagnostics and EL0/syscall/scheduler/lazy-memory verification suites..
├── arch/
│ └── aarch64-linux-gnu/ # AArch64 boot, vectors, MMU/CoW, trap handling, PL011 UART, linker script, EL0 tests
├── docs/ # Architecture, onboarding, ADRs, and full reference docs
├── kernel/
│ ├── boot/ # Flattened Device Tree (FDT) parser & memory/initrd/virtio discovery
│ ├── core/ # Freestanding type traits & logging (traits.hpp, log.hpp)
│ ├── drivers/ # In-tree hardware drivers (GICv2, PL011, fw_cfg, framebuffer/ramfb, VirtIO)
│ ├── fs/ # VFS core, cpio, PageCache, rootfs, tmpfs, devfs (TTY/FB/evdev), and ext2
│ ├── hal/ # Architecture-agnostic HAL traits & target backends (qemu_virt)
│ ├── input/ # InputEvent & InputQueue
│ ├── ipc/ # Encapsulated Pipe implementation (Pipe.hpp / Pipe.cpp)
│ ├── loader/ # ELF64 parser & executable/interpreter loader (elf64, elf_loader)
│ ├── mm/ # Page, PageFrameAllocator, KernelHeap, AddressSpace
│ ├── net/ # NetworkDevice & AF_UNIX socket implementation
│ ├── process/ # Process, FdTable, FileDescriptor, SignalTable, Scheduler, WaitQueue, StackBuilder, resource
│ ├── runtime/ # Freestanding C++ ABI support (cxx_abi.cpp)
│ ├── shell/ # Interactive kernel shell (milo>) & runtime test suite
│ ├── sync/ # RAII synchronization primitives (IrqGuard.hpp)
│ ├── syscalls/ # Modular Linux AArch64 syscall handlers & dispatcher
│ ├── time/ # Time::Duration domain wrapper
│ ├── uapi/ # Compile-time verified Linux AArch64 UAPI structs & constants
│ ├── kernel.mk # Kernel build rules
│ └── main.cpp # Kernel entry point (kmain)
├── scripts/ # Build, quality report, license check, LOC, and dump helpers
├── tests/
│ └── host/ # Host-compiled snitch unit tests, HAL mocks & .clang-tidy
├── user/ # Sample EL0 user programs
├── LICENSE # GNU General Public License v3.0
└── Makefile # Top-level build, QEMU runner, initrd packaging, host tests, and quality gates
To build, test, and run Milo locally:
aarch64-linux-gnu-g++, aarch64-linux-gnu-as, aarch64-linux-gnu-ld, aarch64-linux-gnu-objcopyHOST_TEST): g++ (C++20) with snitch and gcovrqemu-system-aarch64clang-format, clang-tidygdb-multiarchThe aarch64-linux-gnu triplet is used to match the Linux AArch64 user-space ABI/syscall convention while compiling bare-metal freestanding code.
The .devcontainer/devcontainer.json configuration provisions the cross-toolchain, QEMU, snitch, gcovr, and lint tools automatically.
To allow namespace creation inside the container without --privileged or CAP_SYS_ADMIN, runArgs configures:
--security-opt=seccomp=unconfined — permits clone/unshare namespace syscalls blocked by Docker’s default seccomp profile.--security-opt=apparmor=unconfined — permits mount-namespace setup blocked by Docker’s docker-default AppArmor profile (and required on Ubuntu 24.04+ / Pop!_OS 24.04 hosts with AppArmor userns restrictions).Linux host prerequisites:
sysctl user.max_user_namespaces > 0, and sysctl kernel.unprivileged_userns_clone=1 on distributions that expose it).kernel.apparmor_restrict_unprivileged_userns=1, keep --security-opt=apparmor=unconfined enabled in runArgs (and rebuild/reopen the devcontainer after changing devcontainer.json).make all
Boots build/kernel.bin (with initrds/busybox.cpio and disk.img) on QEMU virt:
make run
To exit QEMU, press Ctrl+A then X.
make test-host
musl, BusyBox, Bash)make setup-musl
make setup-busybox
make setup-bash
make format # Format codebase with clang-format
make license-check # Verify SPDX and copyright headers
make quality # Verify formatting, license headers, clang-tidy, and host tests
1234:make debug
make gdb
make clean
milo>)Once booted, the milo> shell provides built-in diagnostics and verification commands, including:
help / info / clear / halt — System info (EL, MMU/cache status, PFA frames), terminal control, and CPU halt (wfi).ls initrd / cat initrd <path> / elf initrd <path> — Inspect CPIO initrd entries, file contents, and ELF64 headers/segments.sh / bash — Launch an interactive /bin/sh or /bin/bash session from the initrd.test cpu, test mmu, test el0, test cpp, test svc, test abort, test pfa, test ro, test nx, test sys, test cpio, test elf, test elf_interp, test dyn_exec, test vmm, test vma_mmap, test file_vma, test page_cache, test loader, test user, test user_echo, test uxn_fault, test syscall, test tty_echo, test user_mm, test proc_exit, test fork_exec, test musl, test sched, test heap, test dynamic_io, test refcount, test cow, test demand_paging, test lazy_mm, test virtio, test gpu, test fb, test input, test net, test af_unix, test unix_sock, test blk, test stack_abi).test all — Run the full integrated in-kernel verification suite.include/ddk/ interfaces (Driver, PlatformServices, and RAII MmioRegion/DmaBuffer/IrqHandle) and a top-level drivers/ tree isolated from private kernel/ headers, with out-of-tree build support.virtio_blk to the DDK, expand persistent filesystem support (ext2), and add additional peripheral/networking drivers.x86_64, riscv64) under arch/.Distributed under the GNU General Public License v3.0 (GPL-3.0). See LICENSE for details.