Documentation
¶
Overview ¶
Command build-initfs assembles the guest initfs as an UNCOMPRESSED newc cpio archive — the kernel unpacks it as the initramfs root, in RAM, with no block device involved. That deviceless root is load-bearing: virtio-blk names (vdX) follow probe-completion order, so a block-rooted kernel under async device probing raced its own root name and panic-looped; an initramfs root removes the race class entirely (and one virtio device with it).
The archive holds exactly one payload — the guest binary at protocol.InitPath (the kernel boots it via rdinit=) — plus the mountpoint directories PID 1 mounts over and the /dev/console node the kernel needs to give init its stdio (the kernel does NOT automount devtmpfs for an initramfs root, and a console that races async probing is reattached later by vminitd's ensureConsole). The container's own userland comes from its image at runtime, never from here.
Uncompressed on purpose: the cpio is //go:embed'ed into ossein and handed to Virtualization.framework verbatim, so kernel decompression support (CONFIG_RD_*) would buy image size at boot-time CPU cost — and the binary inside is the only content, which barely compresses anyway. The newc writer is ~80 lines of stdlib; no dependency earns its keep here.