vinix-ports / BOOTSTRAP.md
106 lines · 61 sloc · 23.25 KB · 1a5c5fc72dfb376fb3dfad8efe6d8317a4364116
Raw

Building the Vinix release packages

Build the ports outside the source checkout. Keep a separate SDK and package database for each target. Each SDK contains the target headers, startup objects and libraries installed by vpac from a signed test repository. Build tools such as the bootstrap compiler, Make, Python and Meson execute on the Linux worker. Keep their host libraries out of the target include and linker search paths.

Stage Inputs and outputs Check before advancing
C runtime and headers Build patched musl and the architecture-specific Linux UAPI package independently. Install both into the first SDK. Build BusyBox against that SDK. Check the linker map and header inputs. Boot the installed shell and run a dynamically linked program through the packaged loader.
Base libraries and tools Use musl for zlib, bzip2, XZ, Zstandard, Brotli, Expat, libffi, pkgconf, ncurses and GNU Make. libuuid and libcap also use UAPI headers. PCRE2 uses zlib. Vim uses ncurses. Zsh uses ncurses, PCRE2 and libcap. Install each dependency before its consumers. Exercise its library, CLI or loadable modules.
Native compiler Build GMP, then MPFR, then MPC. Build gcc-libs for Vinix with the bootstrap C and C++ compilers. Install that runtime before building binutils with gold and CTF. Build the native GCC with the signed runtime, binutils and arithmetic libraries installed. Compile, link and run C and C++ programs in the installed target root. Inspect the runtime libraries and startup object ownership.
Package installation and networking Build OpenSSL against musl and UAPI. Install the Mozilla CA bundle. Build libarchive with the packaged compression libraries. GPGME requires libgpg-error and libassuan. Its OpenPGP operations require a working GnuPG installation. Build vpac with its pinned nspkg, Stutter and Vile sources and the target libraries. Build the c-ares and nghttp2 libraries needed by curl before the network tools. In Vinix, use the target vpac to install by name, reject a tampered package, upgrade a package and query ownership. Exercise TLS with the installed CA store.
Fonts and X clients Build libpng against zlib. Build FreeType with Brotli, bzip2, libpng and zlib, then fontconfig against FreeType and Expat. Build X protocol data, Xau and Xdmcp before XCB, then Xlib and the extension libraries. Add font and keyboard data before the server smoke test. Exercise font selection and an X client against the packaged server.
Graphics and release assembly Resolve the current Mesa and legacy Mesa/LLVM stack for the sidecar layout in PROFILES.md. Install the package-owned base, compiler and desktop packages into fresh roots on both architectures. Boot both images. Exercise the native compiler, desktop and GLX. Compare the shipped files and their owners to the release inputs.

The order above describes dependencies. The signed feed receipt, clean-install log, file-ownership check and guest transcript record how far a particular build got. Keep these records beside the package archives, outside Git.

For the exact order within a source-built feed, run the following on the worker. The checker verifies each archive against the receipt from feed publish, reads its .PKGINFO, and resolves runtime, build and check dependencies including versioned providers. Its inputs are the feed and the indicated target architecture. The worker supplies bsdtar, ALPM's vercmp and Python 3.11 or later.

python3 tools/build-order.py x86_64 "$signed_feed" "$work/order"

order.tsv groups packages that may be built after earlier stages finish. edges.tsv records every declared dependency and the selected provider. Missing providers, ambiguous virtual names and cycles leave a pending row and cause a nonzero exit. Host tools still follow the bootstrap sequence above.

To plan before the archives exist, point the same command at a trusted ports checkout. It uses vpac to evaluate each native recipe's metadata for the selected architecture. Include a prepared signing-key port with --extra-recipe when it belongs in the build.

python3 tools/build-order.py --recipes aarch64 "$ports" "$work/source-order" \
    --extra-recipe "$work/vinix-keyring/PKGBUILD.vile"

The worker cross-checked the source plan against the signed x86_64 archives for musl, Linux UAPI, zlib and PCRE2. The package versions, stages and dependency edges matched byte for byte. A second check of ports revision c745c03 found an unsatisfied check dependency on xkeyboard-config for xkbcomp on both targets. It ordered the other 100 x86_64 and 99 arm64 packages in that checkout. The worker keeps the results in foundation/source-order-01. Its receipt manifest has SHA-256 d46e8c29cb0404a5dc61489662e41e8999aaea0bb4186d534fea50dea7a15797.

At ports revision 06d5cb5, xkeyboard-config supplies the missing check dependency. The source planner placed all 114 recipes in seven stages independently on each architecture. See foundation/source-order-02, receipt SHA-256 813b33eb878851d7c32bae9a9cd2b05ad6365f034e286183d633f1836e09901c. Signed installation and guest execution have their own receipts.

vinix-release-desktop selects the source-built base, network utilities, compiler tools and desktop init by name. The architecture-specific recipe adds libuuid for the amd64 userland stage. The existing Vinix image builder also supplies the kernel, compositor and native services. Once the complete signed feed is available, a fresh install of this metapackage must resolve all its dependencies. The November 30 development snapshot placed the metapackage in stage 8, with 153 recipes across 15 stages on both targets including the X11 work. The exact recipe hashes and edges are in foundation/full-source-order-01, receipt SHA-256 86a9b1ae365bfe0cfb79f4a98407caf8d0ac92bea37e96eca7472eadaba11624. This snapshot includes recipes awaiting their first successful build.

The worker resolved all 81 packages in foundation/xlib-combined-01/repo into seven stages. For example, BusyBox follows musl and Linux headers, Xlib follows XCB and Xtrans, and the bitmap fonts follow mkfontscale. The order is in foundation/xlib-order-01/order.tsv with SHA-256 51d1464a0a994328c40264105f8b95b7b22a8922cad177daef98e593d4a6930c. The first signed ARM feed puts both musl and Linux headers in stage zero. Its signed, installed root passed the ownership and ELF audit for 1,165 files and links, including six target ELFs. The worker keeps that receipt in arm/common/sdk-01-audit.log with SHA-256 b315f8d20f2d4c7737fd2e5078c33e12b6183d2ee86a22a9ba6db6852d68c59b.

Running the shared worker

The released arm64 kernel uses 16 KiB pages. For every nonempty ELF load segment, the virtual address and file offset must have the same remainder modulo 16384. The x86_64 page size is 4096. Check a package before adding it to the build SDK with python3 tests/archive-pages.py aarch64 "$archive". Add --inventory to survey older archives and record every affected executable or shared object. The released kernel must also execute the installed payload.

The initial arm64 survey covered 22 distinct archive names. Thirteen contained an incompatible load segment, affecting 28 of 53 packaged executables and shared objects. BusyBox 1.38.0-4 and both initial musl releases were affected. The Linux UAPI and fortify headers contained no executable or shared object. Earlier arm64 installation and ownership receipts predate this kernel check. The worker stores the source archive hashes and segment offsets in arm/abi16/previous-02, receipt SHA-256 676679a285a3ccd67bbd85ea2415fbc46e0e79b4f6bfc9bb5e9a12c310bd54f6. The wrong-machine, historical BusyBox, header-only and x86_64 musl controls are in arm/abi16/archive-controls-01, receipt SHA-256 cc8e171dc5febc3ec75a7a3c30a008c9e49bd7bbc8e9d7ace465c576dee762e1.

MPFR needs a cross-compiler with BID decimal support. On aarch64 the worker used the pinned Ubuntu GCC 14.2 cross-compiler as a build tool, Vinix musl headers and a static decimal support archive built from the GCC source used for the Vinix runtime. The compiler inputs and probe are recorded in gnu/arm/decimal-compiler/receipts.sha256. The signed MPFR 4.2.1-5 has SHA-256 e44e82b8761f1bc286c48778be25d227d3081e116f19c68752815f683fabbf82 and retains all 697 published exports. Reproduce the check with mpfr/decimal.c and mpfr/thread-state.c linked against the signed SDK. The released kernel ran both fixtures and round-tripped decimal64 and decimal128 while keeping two threads' floating-point state separate. See gnu/arm/logs/mpfr-decimal-131/receipts.sha256 and gnu/arm/logs/numeric-decimal-guest-132/serial.log, SHA-256 4f5302374bc2f94137fd31ad6c3015fd95fe0282b6f87e7141d06a17edbb5820 and 0a16a54024c57e6751d814eb6f7ab9122aadd4322f145ca1409139dace70c894.

The aarch64 GNU runtime uses inline atomics so its shared libraries resolve against the packaged musl and unwinder. The recipe checks every library for 16 KiB load segments and unresolved outlined atomic helpers. A clean signed installation of gcc-libs 14.2.0-2 booted with the released kernel and ran the C++ exception, OpenMP and 128-bit atomic fixtures in tests/toolchain. The package digest is 796840770f4e2121e2923e727c5469270625b0e9832cea4504e97ea3149460a0. See gnu/arm/logs/runtime-guest-r115/serial.log, SHA-256 61e7f5b0b14295d3b2c1a6156388aa67f6ba21fccb1555ca8a484d410e260dcd.

The binutils recipe uses its signed SDK's Zstd and Jansson metadata in subdirectory configuration. Both source builds exercised split DWARF, CTF and Zstd debug-section compression. The x86_64 check linked PE32 and PE32+ fixtures with the generated scripts. On aarch64, BFD and gold linked executables with 16 KiB load segments, and the package installed into the signed GCC SDK. The archive receipts are gnu/gcc-work/binutils-release-r3/binutils.sha256 and gnu/arm/build/binutils-release-r3/binutils.sha256, manifest SHA-256 b27e492226fdc1987b5973277a3853e0410f488e97da1e1c76605bd50aa2968c and 73a87a0882a369fc245d3f000791a5047a5917d3f0d573395d223e939899c631.

The desktop metapackage requires musl 1.2.6-4 or later on arm64 and 1.2.6-2 or later on x86_64. The test-signed ARM 1.2.6-3 loader itself had 16 KiB load segments. Its GCC specs let the cross toolchain override that setting for a newly linked shared library. The expected ARM minimum excludes this SDK. The worker checked the architecture-specific version constraints with native vpac metadata in foundation/release-musl-floor-02, receipt SHA-256 2d6886c3bc9fdc7ef38945d303c92cb3b877eba9d67c2fa25b49f46d73019e8a.

Run python3 tests/exec-linkage.py x86_64 "$client" "$auditor" --proot "$(command -v proot)" on an x86_64 worker to exercise the installed loader against each dynamic executable in an audited root. For a Vinix guest, use --fixture "$work/linkage.sh" and pass that script to the boot harness. Packaged musl 1.2.6 applies relocations before returning from --list. It resolved all 109 dynamic executables in the signed 106-package x86_64 root. Renaming the exported OPENSSL_init_ssl symbol in an isolated copy of libssl caused the loader to reject /usr/bin/openssl with status 127. See foundation/exec-linkage-01, receipt SHA-256 cb2fdec09f4b9e7c873ec82d672af576e9e0c26484f9496744588323a01ed3a0.

The Ubuntu build worker serializes builds with compile.lock. Each build may use two compiler jobs. Set MAKEFLAGS=-j2 and CMAKE_BUILD_PARALLEL_LEVEL=2, or pass -j2 to Ninja or Meson. On the 12 GiB worker, run build services as a dynamic user with CPUQuota=200%, MemoryHigh=6G, MemoryMax=8G and MemorySwapMax=0. Guest-only checks can keep their 1 GiB service cap. Keep downloads, build directories, emulators and signing tools in private worker state. Store memory.peak and memory.events with each build and record any single-job retry. The worker recorded the live limit change in foundation/worker-memory-8g-01, receipt SHA-256 e8d4771cb2a4ef8f7ea7a32c2d6e483b6a9f105f08486f2750c88d71b1d5e54f.

The aarch64 rebuilds of attr, ISL, libpng, libseccomp and Nettle require the 16 KiB musl SDK. Their clean signed install with musl, GMP and zlib audited eight package records, 514 owned paths and 25 target ELFs. The worker records exact versions and hashes in arm/abi16/common-library-check-01, receipt SHA-256 71890d9f9aa07f33ea13f64dbb3caab5e45505d48779392afe92bc0d89c4f5a3.

The aarch64 ncurses build uses the target strip for installed executables and the host tic for the terminfo database. The recipe ran its target infocmp against the staged xterm-256color entry. The worker checked the package's 16 KiB ELF segments in arm/abi16/logs/ncurses-pages.tsv, SHA-256 48d777d8e44938601cf51d8a63a58b4243b492ed7a455b3ef1c0b0743db0fb06.

The AArch64 release kernel booted a fresh ext2 root from 79 signed packages, including binutils, GCC libraries, OpenSSL and X client libraries. The installed musl loader relocated all 82 dynamic executable paths. The root audit covered 12,011 owned files and links and 204 target ELFs. See arm/abi16/combined-runtime-02, receipt SHA-256 06df2a06013eaaaa18f05482668aab20d3ef0fca2339f2f9116970f5bed34c51.

Verified x86_64 bootstrap

A fresh signed Git 2.47.3 installation pulled in 15 packages and passed the audit for 1,842 paths and 46 ELF files. In the isolated root, Git created a commit, read it back and passed git fsck --full. The installed OpenSSH 9.9p2 client and its five dependencies passed the audit for 4,319 paths and 34 ELFs. Its ssh-keygen generated an Ed25519 key, signed a file and verified it for the named principal. The worker retains those installed-package results in foundation/signed-git-01 and foundation/signed-ssh-01, receipt SHA-256 f43c1f53e159f97b6e5cfb8db542828f5ab055996e7885b2e4b89b044df9ed76 and 6e30b1d67ad5e9740ca28cf76317ef3f4dac4e75c82c78560785a2395ddb2e32 respectively.

The November 2026 worker run installed 24 packages by name into a fresh root from a test-signed repository. The ownership and ELF auditor at ports revision 4cc4c14 checked 8,169 files and links and 67 ELF files, including interpreter and shared library resolution. The package set includes BusyBox 1.38.0-4, musl, Linux headers, GNU Make, GMP, OpenSSL, the CA bundle, libpng, nghttp2 and c-ares. The worker retains the package hashes in foundation/feed-01/packages.tsv and the client in foundation/sdk-01.

A separate client upgraded BusyBox 1.38.0-3 to 1.38.0-4 and installed vinix-release. vpac recorded BusyBox as owner of /bin/uname and the identity package as owner of /usr/bin/uname. The installed OS ID was vinix. Signed upgrade commands

On the operator machine, ~/.local/state/vinix/ports/musl-busybox-CqkBEA/foundation/receipts.sha256 records the transaction and audit logs. The clean-root audit log has SHA-256 328fbb76a322e5e61b572ee9e7d6fdd52a5cb37613fbc8de2b07d0290f075f49. The signed upgrade log has SHA-256 802496df0b3da0f5f66f1a12f293c910ebb43c4d19a781b58f88bd8ccbd303c6. Guest boot and display protocol checks have their own serial transcript. XCB guest run

The x86_64 SQLite 3.48.0-1 build used 724 MiB at peak under the 1 GiB limit. Its recipe creates an FTS5 database with the target shell and reads it through the target shared library. A fresh signed installation of SQLite, musl, readline, ncurses and zlib passed commit, rollback, search and integrity checks. All eight dynamic executables in that root relocated. The worker keeps the install and query logs in foundation/signed-sqlite-02, receipt SHA-256 660aec4a9ed85889b15c79eab19439c8364cb7bc870f6809bdff26dd1732938e.

The installed x86_64 XBPS 0.59.2-1 tools created a package, indexed it, installed it into an empty directory and read its version from the local database. The fixture compared the installed bytes with the input. Its 13-package signed root contained 57 target ELFs. See foundation/signed-xbps-01, receipt SHA-256 c54c52e01e076177f73be1830574c3c256d6af8627679d1b24353f145cf1f078.

The GnuPG 2.4.9-1 recipe uses the SDK's gpgrt-config to locate libksba. Its build check verifies a detached signature with the target gpgv and requires a bad-signature result after changing the signed bytes. The x86_64 archive has SHA-256 05a9da36d6f07114af1a1683690eec0452582b506262c445dde55d1a1b5e07c4. Installing GnuPG, GPGME, the Vinix test keyring and BusyBox init pulled in 22 signed packages with 4,893 owned files and links and 76 target ELFs. See foundation/signature-engine-x86-02/audit.log, SHA-256 9762624c6ba59640955091783d9bea47a6e9859ef3d5a1f45e11cecbc461ef34.

The published x86_64 Vinix kernel booted that 22-package root. Both gpgv and the GPGME OpenPGP engine verified the feed's actual detached database signature against the packaged public key. Both reported a bad signature when the guest appended bytes to the database. To repeat the check, compile tests/userland/verify-index.c with the target SDK and -lgpgme. Stage the executable, the signed vinix.db and its signature as /signature-fixture/{verify-index,index,index.sig}, then boot with tests/userland/signatures.sh. The worker receipt manifest is foundation/signature-engine-guest-03/receipts.sha256, SHA-256 71ce37b04b4e75936bd4082396f3b312ee7b4ef68a05cc9e7338849f6889293e.

The x86_64 vpac recipe uses V at 597b0f6, targets musl explicitly, and embeds the Vile resources. Its configuration check temporarily removes both input Scheme files and queries an installed signed musl record. The recipe uses the locked nobody account from vinix-accounts and keeps package and database signature checks enabled. The build peaked at 2,281,107,456 bytes with zero cgroup OOM events. The resulting vpac-1.0.0-1-x86_64.pkg.tar.zst has SHA-256 f6aa20508a8bc62b5da8b5134657f8d12b1ff5c1609a87e2d7eae02759ea7786. The worker recorded the pinned source trees in foundation/vpac-vcs-pins-01, receipt SHA-256 2124cc24c72459f7274eb4a74c0d1fa4ec30896a35183e31e6786e9060666014.

Release 2 handles the Vinix kernel's ENOSYS response to the Landlock ABI query. Downloads retain the locked account, no-new-privs and seccomp, and the transaction still verifies the signed package. The x86_64 guest refused a same-length modification of the signed netbase archive, installed the authentic archive, and verified its local owner and signature. A separate boot queried the signed repository record by exact name. See foundation/vpac-transaction-08/disk/guest/serial.log and foundation/vpac-remote-query-01/disk/receipts.sha256, receipt SHA-256 0d0569ad76f9828fadac877bf1f67ae505eceab3231546b30a13423826f48891. The combined test still times out during repository lookup after installation. The upgrade fixture reaches package verification and extraction and still needs to pass its post-upgrade checks.

For later builds, tools/build-queue.py uses the source order and a verified bootstrap feed. Place the input archives and a NAME.sha256 receipt for each in $work/artifacts. Configure the host compiler and signing tools as for a single native build, then select the ports to build. The worker uses this command form.

python3 tools/build-queue.py --reserve-mib 6144 "$arch" "$plan/order.tsv" "$ports" "$work" \
    "$test_keys" "$auditor" "$vpac_builder" "$compile_lock" zlib make openssl

Pass --reuse "$previous_work/artifacts" when starting a new queue. The queue can bring in both requested packages and their prerequisites from one or more earlier artifact directories. It checks the exact version, target, archive checksum, embedded recipe hash, and ELF page alignment before reusing an archive. On the same filesystem it hard-links the verified archive so both queues share one copy. Build outputs and their hashes are immutable inputs to later signing, installation and guest tests. When a source, ABI or recipe change changes the output, increment the package release before building it.

Each port gets a fresh, signed SDK containing its transitive prerequisites. The queue records recipe and dependency hashes, compiler logs and ELF page results. A subsequent port consumes an archive after its final checksum is available. Exit status 2 reports outstanding input packages. Rerunning reuses verified outputs and reclaims interrupted scratch directories. The worker built musl-fts, resumed it, and rejected an incorrect input version and a damaged receipt in foundation/queue-test-03, receipt SHA-256 1de747944bd569219494cd127fc1f42cf110f7b0ad2a4e513099249a2e0b3bb1. Two concurrent resumptions passed in foundation/queue-resume-04, receipt SHA-256 a58a80c0050294666d4ecd41ce5c2affc371c5fbeb58fc672e98a9b7c8c3b14b.

An empty queue reused the existing AArch64 musl and musl-fts archives with the compiler path set to a nonexistent executable. Both archives passed the page audit. The worker also rejected a changed recipe with the same package version and an archive with a mismatched checksum. See foundation/queue-shared-reuse-01, receipt SHA-256 bcab78e7e9fd1d0b86800c32870ceea84abcd5ce54781ddb42d1c46e5970d213.

Source plans record the recipe directory for each output package. The queue invokes a split recipe once, validates its complete output list and records each archive separately. The AArch64 fixture requested two split packages, built them in one invocation and reused both in an empty queue with the compiler disabled. See foundation/queue-split-reuse-01, receipt SHA-256 437ce9d0bea7bd7e8409877584c082c32804530217a7b5bb65879b624caba2bc.

The published x86_64 Vinix kernel booted 32 signed network packages. It refreshed the trust store with a local CA, established loopback HTTPS, rejected the wrong hostname, committed and read a Git file, signed and verified that file with the installed SSH tools, then installed and queried a local XBPS package. The fixture and logs are tests/userland/network.sh and foundation/network-guest-03, receipt SHA-256 4e9afac33947b999911a4ff35f218b49f3356b345e47e7b90e7ffce644d0c7b4.

OpenSSH 9.9p2-1 passed its AArch64 recipe checks in QEMU user mode with six packages in the signed SDK. The recipe wraps the emulated commands in fakeroot so the musl process can resolve its test UID in the worker's passwd file. The check lists ciphers, generates and fingerprints an Ed25519 key, and signs a file. The archive and ELF page report are in arm/abi16/openssh-recheck-01, receipt SHA-256 227a4e471322b1c5ada06ed342145bb05b08020e371ab293fb4194500ff97918. The network guest remains the installed-system check.

An eight-package x86_64 guest tested the BusyBox wget applet and its separately packaged TLS helper. It rejected an unknown certificate, retrieved the expected bytes after installing the local CA, and rejected the same certificate for a different hostname. The guest fixture is tests/userland/wget.sh. The worker keeps the install, audit and serial hashes in foundation/wget-guest-x86_64-01/receipts.sha256, SHA-256 5872d1467ee2594b9305bed5fa1ceb084c8c3fde4ebccb0539db25d02b3849f9.

For package roots too large for a test initramfs, use python3 tests/disk-root.py "$arch" "$root" "$fixture" "$iso" "$boot" "$output" on the worker. The root must supply BusyBox init, and the fixture prints VPAC FIXTURE GUEST PASS after its checks. The helper creates a fresh ext2 image file from a private copy and runs QEMU in snapshot mode. The x86_64 release kernel read the matching disk identity and relocated all 109 dynamic executable paths from a 106-package root with 512 MiB of guest RAM. The test retains its ext2 and serial hashes under foundation/disk-exec-x86-02/test, receipt SHA-256 6f600855744d04fa71d916f545e746ed36ba2686a56937c2b4c3cb02e3ec6a58.