me

/

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

Stage release initramfs archives without duplicating package roots

diviocity committed 5 days ago · 5b0135e9d315dea1b363b81476bc8f88dfef003a View patch
Unverified signature 4 files changed +18 -5
tests/FEED.md +2 -0

@@ -160,6 +160,8 @@ python3 tools/stage-image.py "$arch" "$client" "$repo" "$output" "$work/audit" \

160160

161161Use `$output/initramfs.tar` as `VINIX_AMD64_INITRAMFS` or `VINIX_AARCH64_INITRAMFS` in Vinix's architecture-specific ISO assembly command. Run `python3 tests/native-layer.py` for the layer regression checks.

162162

163+`tools/release-inputs.py` uses `--initramfs-only` for release assembly. The temporary root shares package files when it is on the same filesystem as the cold client, and only the archive and manifests are retained. The worker assembled signed seed archives for both architectures and checked the cold clients' file hashes, ownership, permissions, inodes and link counts before and after. See `foundation/ports-initramfs-only-proof-01`, receipt SHA-256 `bd3c147af90c8237c412f6bc141748144535f92c8e2a6afcc241d9d15a49d23d`.

164+

163165Run `python3 tools/check-iso-initramfs.py "$output/initramfs.tar" "$iso"` against each assembled ISO before accepting its release evidence. The checker compares the embedded tar payload byte for byte with the audited input and verifies the image identity that the ISO builder writes into the gzip header and appends to the tar. Run `python3 tests/iso-initramfs.py` to exercise rejection of altered payloads, wrong identities and added tar entries.

164166

165167Both architecture-specific Vinix builders assembled test ISOs with the small, signed seed fixtures and the candidate kernels. The checker verified both embedded initramfs files and rejected the x86_64 ISO when given the AArch64 input. See `foundation/ports-candidate-iso-payload-proof-01`, receipt SHA-256 `cec4ae5654fe6a4c9967fd4d6e45ccf654c11902a0c16fa81eb3ab616037b2be`.

tests/release-inputs.py +1 -0

@@ -47,6 +47,7 @@ class ReleaseInputs(unittest.TestCase):

4747 else:

4848 self.assertEqual(argv[1].name, "stage-image.py")

4949 self.assertIn("--release=iso-fixture", argv)

50+ self.assertIn("--initramfs-only", argv)

5051 self.assertEqual(argv[-4:], ["--seed-client", self.args.graphics,

5152 "--archive-coverage", self.args.archive_coverage])

5253 argv[5].mkdir()

tools/release-inputs.py +1 -1

@@ -43,7 +43,7 @@ def assemble(args):

4343 subprocess.run(bundle_command, check=True)

4444 command = [sys.executable, tools / "stage-image.py", args.arch, args.desktop,

4545 args.repo, stage, args.auditor, args.fingerprint, "--native-layer",

46- args.native, "--initramfs", f"--release={args.release}",

46+ args.native, "--initramfs-only", f"--release={args.release}",

4747 "--seed-client", args.graphics]

4848 if args.archive_coverage:

4949 command.extend(["--archive-coverage", args.archive_coverage])

tools/stage-image.py +14 -4

@@ -176,7 +176,14 @@ def stage(args):

176176 with tempfile.TemporaryDirectory(dir=output) as directory:

177177 staging = Path(directory)

178178 root = staging / "image"

179- subprocess.run(["cp", "-a", "--reflink=auto", client / "root", root], check=True)

179+ package_root = client / "root"

180+ # Archive-only assembly reads the package files and adds files at new

181+ # paths. The temporary root never becomes a writable output tree.

182+ if args.initramfs_only and package_root.stat().st_dev == staging.stat().st_dev:

183+ copy_mode = ["-al"]

184+ else:

185+ copy_mode = ["-a", "--reflink=auto"]

186+ subprocess.run(["cp", *copy_mode, package_root, root], check=True)

180187 # This compares the installed certificate with the independently supplied pin.

181188 seed = Path(__file__).resolve().with_name("keyring.py")

182189 subprocess.run([sys.executable, seed, "seed", root, args.fingerprint], check=True)

@@ -215,7 +222,7 @@ def stage(args):

215222 with release_file.open("x") as output_file:

216223 output_file.write(args.release + "\n")

217224 release_file.chmod(0o644)

218- if args.initramfs:

225+ if args.initramfs or args.initramfs_only:

219226 if os.path.lexists(root / ".vinix-image-id"):

220227 raise ValueError("the ISO builder assigns the image identity")

221228 image = staging / "initramfs.tar"

@@ -224,7 +231,8 @@ def stage(args):

224231 for artifact in ("native-layer.tsv", "initramfs.tar"):

225232 if (staging / artifact).exists():

226233 (staging / artifact).rename(output / artifact)

227- root.rename(output / "root")

234+ if not args.initramfs_only:

235+ root.rename(output / "root")

228236 print(audit, end="")

229237 print(f"staged {len(indexed)} signed seed packages and the installed database")

230238

@@ -240,5 +248,7 @@ if __name__ == "__main__":

240248 parser.add_argument("--seed-client", type=Path, action="append", default=[],

241249 help="require the installed versions from another audited client in the seed")

242250 parser.add_argument("--archive-coverage", type=Path, help="match signed seed packages to verified release archives")

243- parser.add_argument("--initramfs", action="store_true", help="write a root-owned USTAR archive for the ISO builder")

251+ media = parser.add_mutually_exclusive_group()

252+ media.add_argument("--initramfs", action="store_true", help="also write a root-owned USTAR archive")

253+ media.add_argument("--initramfs-only", action="store_true", help="write a root-owned USTAR archive without keeping an unpacked root")

244254 stage(parser.parse_args())