The Hearthwright’s Primer

A Propædeutic Enchiridion for the Keeping of One’s Own Machine, Kindled from a Single Ember

The Hearthwright's Primer

This book ends with you running two machines you wrote. One is ward: a jailer plus a Linux-KVM VMM you can leave on the NixOS hosts you already have, launching jailed microVMs whose device model you understand because you implemented the rings. The other is hearth: a type-1 hypervisor that is itself a unikernel — one address space, no host kernel, no syscall table — booting on the machine and entering a unikernel guest. That second object is not for sale. The first is how you learn virtio and guest bring-up against a host that already has files, TAP, and a clock. hearth is the same VMM idea after Linux is deleted.

The sibling course is The Artificer’s Primer. That book builds an intelligence. This one houses it. An optional later joint lets aecd tool runs go through ward. That coupling does not block this book, and hearth is not an agent sandbox until it has a control plane you trust.

Four trees, same contract as tinygpt / aec:

  • ember (C, RISC-V in QEMU) is a teaching kernel. Literacy. It may die.
  • wick (Rust, Linux KVM) is a Firecracker-shaped one-process VMM. You keep this.
  • hearth (C, RISC-V H-extension, later AArch64 EL2) is the unikernel hypervisor.
  • ward (Go unless a later decision collapses it into wick) supervises the KVM path only. It does not supervise hearth; hearth is the machine.

This is not an undergraduate OS course. You are assumed to already be fluent in Unix, C, Go, NixOS, and building tools from scratch. What is not assumed is privilege and page tables from the CPU’s side, nested paging, virtio as a protocol, why Firecracker is small, what a unikernel deleted, and what a hypervisor still has to be once there is no /dev/kvm.

Each chapter follows the same shape: why the layer exists, the mechanism, a walkthrough of the reference implementation, exercises, and a lab that boots — QEMU for ember / hearth, KVM_RUN for wick / ward. A chapter that only prints listings is not done. If the hearth image has a syscall table, it is wick.

The book is also available offline, rebuilt on every update: a 6×9 PDF and an EPUB.

The ten parts:

  • Part 0 — Orientation. How to use this book. The four trees and which may die. Two capstones.
  • Part I — The machine. C, a linker script, QEMU RISC-V virt. Bytes, privilege, Sv39, traps, time. Every chapter boots. No OS yet.
  • Part II — A kernel (ember). S-mode, two user programs, a heap, pipes, virtio-blk as guest, a small file system, a shell. The guest hearth will run, written by you.
  • Part III — The shapes of an operating system. Isolation budgets, Linux as the host wick stands on, xv6, seL4. Read and extend; do not rewrite Linux.
  • Part IV — Virtualization as hardware. Trap-and-emulate, then the H-extension; nested paging before /dev/kvm; virtio as a protocol implemented once.
  • Part V — MicroVMs on a host kernel (wick). The Tuesday path, and the device-backend test rig for rings hearth will steal.
  • Part VI — Unikernels. The guest you will host twice. The contract hearth will honour is frozen here.
  • Part VII — A unikernel hypervisor (hearth). The image that owns the machine, enter a guest, virtio without a host kernel, several guests, interrupt injection, the AArch64 dialect.
  • Part VIII — Isolation as a menu. The ladder from process to confidential VM. Kata is not a VMM. Policy on two floors.
  • Part IX — Supervisors and capstones. ward on NixOS; hearth on QEMU-as-metal with no Linux in the TCB.

results matching ""

    No results matching ""