milo

Milo Features, Repository Layout & Build Reference

This document preserves the full subsystem feature overview, directory layout, toolchain/host prerequisites, build/test commands, interactive shell commands, and roadmap details for milo.

Features

Repository Structure

.
├── 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

Prerequisites & Toolchain

To build, test, and run Milo locally:

The aarch64-linux-gnu triplet is used to match the Linux AArch64 user-space ABI/syscall convention while compiling bare-metal freestanding code.

Devcontainer & Linux Host Prerequisites

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:

Linux host prerequisites:

Building, Testing & Running

Build All Targets (Kernel + Initrd)

make all

Launch in QEMU

Boots build/kernel.bin (with initrds/busybox.cpio and disk.img) on QEMU virt:

make run

To exit QEMU, press Ctrl+A then X.

Host Unit Tests & Coverage

make test-host

Optional Initrd Images (musl, BusyBox, Bash)

make setup-musl
make setup-busybox
make setup-bash

Code Formatting, License & Static Analysis

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

Debugging with GDB

  1. Launch QEMU listening for GDB on port 1234:
make debug
  1. Attach GDB in another terminal:
make gdb

Clean Build Artifacts

make clean

Interactive Kernel Shell (milo>)

Once booted, the milo> shell provides built-in diagnostics and verification commands, including:

Roadmap

License

Distributed under the GNU General Public License v3.0 (GPL-3.0). See LICENSE for details.