This project builds the 9front VM image for the cross-platform-actions/action GitHub action. The image contains a standard 9front installation configured as a standalone cpu and auth server, serving rcpu on tcp port 17019 and the auth server on tcp port 567. 9front has no SSH server; connect with drawterm instead.
Except for the hostowner (glenda), there's one additional user, runner,
which is the user that will run commands inside the GitHub action.
9front releases are identified by their fqid (a monotonically increasing integer derived from the commit date). The following are supported:
| Version | x86-64 |
|---|---|
| 11952 | ✓ |
- Packer 1.15.1 or later
- QEMU
- A C toolchain and
git, to build drawterm (on Linux also the X11 headers,libx11-devandlibxt-dev) - GNU tar (
gtaron macOS) and zstd, to bundle the resulting image
-
Clone the repository:
git clone https://github.com/cross-platform-actions/9front-builder cd 9front-builder -
Run
build.shto build the image:./build.sh <version> <architecture>Where
<version>and<architecture>are any of the versions or architectures available in the above table.
The above command will build the VM image and the resulting disk image will be
at the path: output/9front-<version>-<architecture>.tar.zst.
Every image is distributed as a single artifact,
9front-<version>-<architecture>.tar.zst, holding the RAW disk as disk.img,
the same layout as the other cross-platform-actions builders. The builder is
asked for RAW directly, so nothing has to be converted afterwards. qcow2 is not
used: its own compression has to keep the image writable, so it compresses
worse than a solid stream does, and a consumer pays that difference on every
job.
The disk is 256 GB. Its zero ranges are turned into holes before it is archived, and the tar records the holes rather than the zeroes, so neither end reads or writes the full 256 GB, only the blocks the installation uses. The unpacked image is a sparse file that grows as the guest writes to it. The compression window is kept at zstd's default decompression limit, so no extra flags are needed to unpack it:
curl -sL <url>/9front-<version>-<architecture>.tar.zst | zstd -dc | tar -x
9front has no scripted installer analogous to FreeBSD's bsdinstall; the
installation is driven entirely by the interactive inst/start rc script.
The build walks through each prompt by feeding keystrokes to the QEMU
console via Packer's boot_steps. This sequence is fqid-specific: when the
9front installer layout changes, boot_steps in main.pkr.hcl must be
re-validated against the new release.
Packer has no communicator for 9front, so the build runs with
communicator = "none". Once the installed system has booted, the
shell-local provisioners run the rc scripts in resources/ inside the
guest with rcpu.sh, which connects with drawterm over the forwarded rcpu
and auth ports. drawterm exports the host's file system at /mnt/term, so
the scripts are read in place. build.sh builds a pinned drawterm into
packer_cache/.