docs: catch the docs up with the finished package split

The plan doc's status records completion (all waves + phase 3) and its
execution notes describe the finished shape; the fresh-session pointer
names build-support's userBinary instead of the deleted
addUserBinaryImpl, and the size-check carry-along note is discharged.
README gains the build/ directory in the layout tree and splits the
source-map row across root build.zig / build/images.zig /
build/qemu.zig. testing.md points at the distributed per-package test
steps; threading.md, threading-plan.md, driver-model.md, efi.md,
display.md, system-requirements.md, and devices-csv.md's adding-a-
driver checklist stop describing the pre-package build.
This commit is contained in:
Daniel Samson
2026-07-30 04:24:34 +01:00
parent 3f9b6813f7
commit d03942b543
10 changed files with 73 additions and 53 deletions
+40 -32
View File
@@ -1,13 +1,15 @@
# Plan: packages — hierarchical builds for libraries and binaries
**Status: in progress.** Implemented on branch `claude/build-packages-plan-174144`:
phase 0 (`build-support`), phase 1 (all six library domains as packages, root as
the pilot consumer), and the first phase-2 binary package — `pci-bus`, a
deliberate deviation from wave A's two-small-services opener, because a driver
with per-binary extras (device-manager-protocol, pci-class) exercises the
template harder than a plain service. Every phase landed green (unit tests, the
QEMU suite at parity with main, boot-image file list unchanged). Remaining:
waves B–D of phase 2, then phase 3.
**Status: complete** (branch `claude/build-packages-plan-174144`). Phase 0
(`build-support`), phase 1 (all six library domains), phase 2 (every binary —
the pci-bus pilot first, then services, drivers, and test fixtures in waves;
multi-binary directories like ps2-bus and usb-hid are one package exporting
several artifacts, and the acpi/fdt discovery pair each export an artifact
named "discovery" that the root's -Ddiscovery picks between), and phase 3 (the
root split into `build/images.zig` + `build/qemu.zig`; the root `build.zig` is
~460 lines of orchestration, down from ~1,250). Every phase landed green: unit
tests, the QEMU suite at parity with main, boot-image file list unchanged.
Still future: `lazyDependency` for image-specific builds (What-this-buys #4).
## Why
@@ -99,36 +101,40 @@ every domain's test step). The root build swaps its `createModule` calls for
touching 30 binaries.
**Phase 2 — binaries become packages, in waves.** The template was shaken out
by the pci-bus pilot (see Status). Wave A: services. Wave B: the remaining
drivers. Wave C: test fixtures. Root build shrinks to orchestration per wave.
by the pci-bus pilot (see Status). Wave A: services (done). Wave B: the
remaining drivers (done). Wave C: test fixtures (done). Root build shrank to
orchestration per wave. init's `-Dserial` heartbeat flag rides a dependency
option; a directory with several binaries (ps2-bus, usb-hid) is one package
exporting several artifacts.
**Phase 3 — root cleanup.** Split what remains of the root build into
`build/images.zig`, `build/qemu.zig`, imported by a short root `build.zig`.
**Phase 3 — root cleanup (done).** What remained of the root build split into
`build/images.zig` (the FHS install tree, boot manifest + capsule, FAT32
images, release ISO, check steps) and `build/qemu.zig` (the run steps + OVMF
probing), imported by a short root `build.zig`.
**Afterwards** (outside this plan): the intel-uhd-graphics-750 driver is
(re)created as a greenfield package — the "Adding a driver" checklist's build
step (docs/device-driver-development/devices-csv.md, step 1) gets rewritten
against the package template at that point.
## Execution notes (for whichever session runs the remaining waves)
## Execution notes (the finished shape)
Anchors in the root `build.zig` as it stands after the pilot:
- The shared recipe lives in `build-support/build.zig`: `userBinary` (domains
form, what binary packages call), `userBinaryFromImports` (the underlying
recipe root's stanzas still use), and `defaultImports` — the ONE list of
default modules; root and the packages both draw from it. The `start` root
shim and `user.ld` are named through the kernel package (Dependency.path).
- `programModule(<exe>).addImport(...)` calls in root (search `programModule`)
are the per-binary extra imports — the data for each binary's future
build.zig. `system/drivers/pci-bus/build.zig` is the template to copy.
- The boot-tree array (search `"etc/init.csv"` or `.getEmittedBin()`) is the
image file list — the authoritative before/after comparison target. A
converted binary's stanza becomes
`b.dependency("<name>", .{}).artifact("<name>")` plus a zon entry.
- The QEMU size-check tests hardcode source paths (search
`virtio-gpu-protocol.zig` in the root test list) — they move with their
binaries' waves.
- The shared recipe lives in `build-support/build.zig`: `userBinary` (what
every binary package calls), `userBinaryFromImports` (the underlying
recipe), and `defaultImports` — the ONE list of default modules. The `start`
root shim and `user.ld` are named through the kernel package
(Dependency.path).
- Adding a binary = adding a directory with source + a ~15-line build.zig +
zon (copy any existing binary package, e.g.
`system/drivers/pci-bus/build.zig`), then one dependency + one bundled
entry in the root build.zig and one zon line. Per-binary extras go through
`build_support.programModule(exe).addImport(...)` inside the package.
- The boot-tree array in the root (search `"etc/init.csv"` or
`.getEmittedBin()`) is the image file list — the authoritative comparison
target for any future build change.
- Package unit tests live in each package's own `test` step; the root
aggregate depends on every test-bearing package's step, so `zig build test`
at the root still runs everything.
Verification per phase:
@@ -141,7 +147,8 @@ Verification per phase:
Context a fresh session should read first: this doc, docs/testing.md,
docs/coding-standards.md (kebab-case names, no abbreviations), and the
`addUserBinaryImpl` body. Commit style: no Co-Authored-By trailers.
`userBinary`/`userBinaryFromImports` bodies in build-support/build.zig. Commit
style: no Co-Authored-By trailers.
## Risks / notes
@@ -149,7 +156,8 @@ docs/coding-standards.md (kebab-case names, no abbreviations), and the
between releases; the work pins against the repo's current Zig and any
upgrade lands separately, never mid-phase.
- The QEMU size-check tests hardcode source paths (e.g. virtio-gpu protocol
struct sizes in the root build) — phase 2 wave C must carry those along.
struct sizes) — they moved into their binaries' packages with their waves,
discharging the carry-along obligation.
- Doc updates ride each phase: docs/README.md (repo layout + source map),
docs/device-driver-development/devices-csv.md ("Adding a driver", step 1),
and the docs that cite the build recipe (driver-model.md, threading.md,