me

/

vinix-ports Public
382 commits 0 issues 0 pull requests 1 contributor Discussions Projects Snippets LOC history Platform CI

Package vpac from pinned sources and verify the AArch64 runtime root

diviocity committed 5 days ago · 7225c24983dbc3e90a158f419956a160512c862b View patch
Unverified signature 4 files changed +99 -0
BOOTSTRAP.md +4 -0

@@ -58,6 +58,8 @@ The aarch64 rebuilds of attr, ISL, libpng, libseccomp and Nettle require the 16

5858

5959The 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`.

6060

61+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`.

62+

6163## Verified x86_64 bootstrap

6264

6365A 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.

@@ -76,6 +78,8 @@ The GnuPG 2.4.9-1 recipe uses the SDK's `gpgrt-config` to locate libksba. Its bu

7678

7779The 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`.

7880

81+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`.

82+

7983For 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.

8084

8185```sh

vpac/PKGBUILD.vile new file +48 -0

@@ -0,0 +1,48 @@

1+selected := get-environment-variable("VPAC_TARGET_ARCH")

2+arch := if string?(selected) { selected } else if memq(string->symbol("aarch64"), features()) { "aarch64" } else { "x86_64" }

3+v-arch := if string=?("aarch64", arch) { "arm64" } else { "x64" }

4+

5+defpkgbuild(vpac,

6+ #:pkgname, "vpac",

7+ #:pkgver, "1.0.0",

8+ #:pkgrel, 1,

9+ #:pkgdesc, "Vinix package manager and native Vile package builder",

10+ #:arch, [#:x86-64, #:aarch64],

11+ #:url, "https://gitly.divio.city/me/vpac",

12+ #:license, "GPL-3.0-only",

13+ #:depends, ["musl", "gc", "curl", "libarchive", "libgpg-error", "gpgme", "gnupg", "libseccomp", "vinix-accounts>=0.1.0-2"],

14+ #:makedepends, ["linux-headers"],

15+ #:backup, ["etc/vpac.d/config.vile"],

16+ ; Native makepkg checks out each full commit after cloning its public repository.

17+ #:source, ["vpac-src::git+https://gitly.divio.city/me/vpac.git#commit=e7147c7fac0dc130fe03c7accf07c75a88188d3d",

18+ "nspkg::git+https://gitly.divio.city/me/nspkg.git#commit=c01b0795d1db56c7bce2539b2c46b110637fdc1a",

19+ "stutter::git+https://gitly.divio.city/me/stutter.git#commit=29b47cb4b818f95a5308d3c086bd7933b7c176bd",

20+ "vile::git+https://git.vorelabs.dev/diviocity/vile.git#commit=76646891b77a3d5c6af4a1e42b122cd61dc1654b",

21+ "config.vile.in", "check-config.py"],

22+ #:sha256sums, ["SKIP", "SKIP", "SKIP", "SKIP", "da473de43c4b1232145dee708df4762a1b26f930bb5693053b19a763df462bf4",

23+ "eb72a7f3ce972cfe0b653984324332cf119d778e723d7e659b3a49494cc883ea"],

24+ #:prepare, fn() {

25+ run("mkdir", "modules")

26+ run("mv", "nspkg", "stutter", "vile", "modules/")

27+ run("cp", "config.vile.in", "config.vile")

28+ run("sed", "-i", string-append("s/@ARCH@/", arch, "/g"), "config.vile")

29+ },

30+ #:build, fn() {

31+ paths := string-append(srcdir(), "/vpac-src|", srcdir(), "/modules|", srcdir(), "/modules/vile|@vlib")

32+ ; Embed the Vile assets while keeping the generated C inside the bootstrap build budget.

33+ ; The V driver runs on the build host. Match the target libc even when the host uses glibc.

34+ run("v", "-prod", "-no-prod-options", "-cflags", "-O0", "-no-parallel", "-no-retry-compilation",

35+ "-os", "linux", "-arch", v-arch, "-cc", "vinix-cc",

36+ "-gc", "boehm", "-d", "musl", "-d", "dynamic_boehm", "-d", "nspkg_libcurl",

37+ "-path", paths, "-o", "vpac-target", "vpac-src/src")

38+ },

39+ #:check, fn() {

40+ run("python3", "check-config.py")

41+ },

42+ #:package, fn() {

43+ run("install", "-Dm755", "vpac-target", string-append(pkgdir(), "/usr/bin/vpac"))

44+ run("install", "-Dm644", "config.vile", string-append(pkgdir(), "/etc/vpac.d/config.vile"))

45+ run("install", "-d", string-append(pkgdir(), "/var/lib/vpac"), string-append(pkgdir(), "/var/cache/vpac/pkg"),

46+ string-append(pkgdir(), "/etc/vpac.d/hooks"), string-append(pkgdir(), "/var/log"))

47+ run("install", "-d", "-m700", string-append(pkgdir(), "/etc/vpac.d/gnupg"))

48+ })

vpac/check-config.py new file +35 -0

@@ -0,0 +1,35 @@

1+"""Exercise the target binary's bundled Vile resources and real installed database queries."""

2+import os

3+from pathlib import Path

4+import json

5+import subprocess

6+import tempfile

7+

8+root = Path(os.environ["VPAC_MAKEPKG_ROOT"])

9+db = Path(os.environ["VPAC_MAKEPKG_DB"])

10+exe = Path("vpac-target").resolve()

11+with tempfile.TemporaryDirectory() as directory:

12+ work = Path(directory)

13+ # Debug V builds read Scheme files from the compiler checkout. Temporarily move

14+ # those build inputs so only a self-contained release executable can pass.

15+ moved = []

16+ try:

17+ for resource in (Path("vpac-src/src/config_objects.scm"), Path("modules/vile/scheme/goops_protocol.scm")):

18+ hidden = resource.with_suffix(".scm.hidden")

19+ resource.rename(hidden)

20+ moved.append((hidden, resource))

21+ contents = Path("config.vile").read_text()

22+ contents = contents.replace('path-root = "/"', "path-root = " + json.dumps(str(root) + "/"))

23+ contents = contents.replace('path-db = "/var/lib/vpac/"', "path-db = " + json.dumps(str(db) + "/"))

24+ config = work / "config.vile"

25+ config.write_text(contents)

26+ env = os.environ.copy()

27+ env.pop("V_RESOURCE_PATH", None)

28+ result = subprocess.check_output(["vinix-run", exe, "--config", config, "q", "-F",

29+ "name,version,validation", "local/musl"], env=env, text=True)

30+ fields = dict(line.split(None, 1) for line in result.splitlines() if len(line.split(None, 1)) == 2)

31+ if fields.get("name") != "musl" or fields.get("validation") != "signature":

32+ raise RuntimeError(f"target vpac did not query signed musl: {result!r}")

33+ finally:

34+ for hidden, resource in moved:

35+ hidden.rename(resource)

vpac/config.vile.in new file +12 -0

@@ -0,0 +1,12 @@

1+; The image supplies the signed seed repository and the trusted public key.

2+path-root = "/"

3+path-db = "/var/lib/vpac/"

4+path-log = "/var/log/vpac.log"

5+path-cache = ["/var/cache/vpac/pkg/"]

6+path-gpg = "/etc/vpac.d/gnupg/"

7+path-hook = ["/etc/vpac.d/hooks/"]

8+pkg-arch = "@ARCH@"

9+network-connections = 2

10+network-user = "nobody"

11+network-siglevel = ["package", "database"]

12+repositories = list(sync-repo("vinix", ["file:///var/lib/vinix/repository/@ARCH@"]))