scrotwmos

How the dom0 image is built

This note is for a developer who changes what the appliance’s dom0 boots. It says what goes into the dom0 image, the rule the build enforces, and where the check lives. How to run the build is in building.md.

The layers

Applications live in sessions, never in dom0.

What dom0 holds

The package holds:

make kernel-host packs the package’s tree as the initramfs of the dom0 kernel, with swm-wl as /init and two keymaps compiled in: the one for SWM_KEYMAP_LAYOUT, and US. make release signs it as dom0.signed. The stub checks and boots it. It runs whole in RAM. There is no shell, no init system, no udev, and no seat daemon: swm-wl is PID 1, its own privsep monitor, and the seat server.

Three programs, and nothing else

dom0 runs three programs: swm-wl, swm-vmm, and vmm-gfx, which runs a VM’s GPU commands on the display GPU. Nothing else in the image can run. At run time, dom0 execs nothing else.

mk/dom0-payload.mk holds the one check. make pkg runs it on the package, and make kernel-host on the image. It fails closed. A tree passes only when:

At run time the same rule holds:

A container is not dom0. Its programs come from its own root, after the pivot, so a container still runs them.

This check does not cover the firmware that the kernel loads.

The size

The boot partition, the ESP, holds one signed dom0 image for each boot slot. Its twin, the disk’s last partition, holds them again: each change to the ESP copies the whole ESP there (installer/appliance.c appliance_esp_close()). To measure the image and the package after a build:

ls -l build/release/dom0.signed build/pkg/*.xbps

Session roots

make rootfs (mk/rootfs.mk) builds a Void root for a session. make volume turns a root into an XFS volume. A container root the swm-wl-only dom0 mounts by label, with the session daemon in it:

make rootfs ROOTFS=/srv/work ROOTFS_AGENT=build/agent/scrotwmd
make volume ROOTFS=/srv/work VOLUME=work.img VOLUME_LABEL=swm-work

scrotwmos.conf(5), SESSIONS, has the session keys.