interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

GitHub aien-dev/aienux#322 (code only)

closed derived b2210aa95ddaa52a #322

Imported from GitHub aien-dev/aienux#322 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base 6e3c492a4bee0154cb05d1c3e45f8874b6588d2d · Head bd3f27b78aee7f88dba25c9e36d85e5f3e410750

Apply it

git checkout -b patch-b2210aa95ddaa52a 6e3c492a4bee0154cb05d1c3e45f8874b6588d2d
curl -fsSL https://interplane.io/drakestapleton/aienux/patches/b2210aa95ddaa52a.patch | git am

Raw patch (mbox) · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/aienux
322
bd3f27b78aee7f88dba25c9e36d85e5f3e410750
{"kind":"github-import","owner":"aien-dev","repo":"aienux","number":322,"url":"https://github.com/aien-dev/aienux/pull/322","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:13Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.crumb b/.crumb
index 71fd990b..b665c536 100644
--- a/.crumb
+++ b/.crumb
@@ -27,33 +27,33 @@
           "purpose": "Directory crates. Purpose not yet described by a human."
         },
         {
-          "digest": "401a6f64c1d174a4182fb2cca14aee8ab95ebfc00bda734fde8181b527c80133",
-          "last_commit": "c30b15e",
+          "digest": "f1a13efb518a3520393f73cbfef859f30c4d604e685adb8ea6aae28dc88d56b6",
+          "last_commit": "6e3c492",
           "name": "docs",
           "purpose": "Directory docs. Purpose not yet described by a human."
         },
         {
-          "digest": "3fda00326650b0475a0cbf006766429338c7f58c7d115a038985284ce2f343a3",
-          "last_commit": "c30b15e",
+          "digest": "6de07abca1282ec322f9b0b7dcefe1e9aef7821bd8a3a4483316a6d811065684",
+          "last_commit": "6e3c492",
           "name": "native",
           "purpose": "Directory native. Purpose not yet described by a human."
         },
         {
-          "digest": "348804e26984e873db9914d2a3ebfcf6c9ea02619247d78809999011b354e048",
+          "digest": "d124a74c6a60db0dbb1b79e7f92f5f90eb0a9cace1873417f986f0075be061bf",
           "last_commit": "4448a50",
           "name": "scripts",
           "purpose": "Directory scripts. Purpose not yet described by a human."
         }
       ],
-      "children_root": "sha256:64c9e2d4935d3ce7fedfd693883d9953a7032ea6b8c4a05cc4db308770c5a616",
-      "compiled_at": "2026-10-12T14:03:50Z",
+      "children_root": "sha256:1b663392329271aa8f4aac73c5ee44a60d6988ee37f07af55262c59184432ed7",
+      "compiled_at": "2026-10-12T14:57:41Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:8d930d9060ffd03e76b1169521c56449861d51deaf44c6c6727d24a74b341d80",
+      "digest": "sha256:f3ebc78d1350b00904ea7c6a80cb1960b92075355b345f8e50a7bbd0d8b8f4d7",
       "evidence_files": 155,
       "evidence_root": "sha256:d59c0cef4e7dd5172923754a95b411ca54b01f35baca4587f792f1b259f1eaf7",
-      "files": 3097,
-      "generated_at_commit": "c30b15e75373d0357956d8b46e81d0b007839d54",
-      "source_tree": "sha256:c5bd2327bbccc565d4d4df76bf1fe045d4f9bce37819c811f0355a3b5370d3c9"
+      "files": 3100,
+      "generated_at_commit": "6e3c492a4bee0154cb05d1c3e45f8874b6588d2d",
+      "source_tree": "sha256:0b2fe2e3762d64fc84b5dc0d2b384f1ab92070fea887cebacccf938cadd45139"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/docs/.crumb b/docs/.crumb
index 21ccb4ce..1a1ee0ed 100644
--- a/docs/.crumb
+++ b/docs/.crumb
@@ -30,14 +30,14 @@
         }
       ],
       "children_root": "sha256:baea130f2c52779b57d90139beb66ac01b21ab499d113471a334be5500f3e369",
-      "compiled_at": "2026-10-12T14:03:50Z",
+      "compiled_at": "2026-10-12T14:57:41Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:401a6f64c1d174a4182fb2cca14aee8ab95ebfc00bda734fde8181b527c80133",
+      "digest": "sha256:f1a13efb518a3520393f73cbfef859f30c4d604e685adb8ea6aae28dc88d56b6",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "files": 71,
-      "generated_at_commit": "c30b15e75373d0357956d8b46e81d0b007839d54",
-      "source_tree": "sha256:b0f13339a715fe94c4aac08937710e74ead7d5130fca62e0da58f266a3732ac0"
+      "files": 72,
+      "generated_at_commit": "6e3c492a4bee0154cb05d1c3e45f8874b6588d2d",
+      "source_tree": "sha256:247a44226d26bd747b974e3f55bc5fecbd9f4f1811842a984f6926a30a360902"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/docs/NATIVE_IMAGE_SLOTS.md b/docs/NATIVE_IMAGE_SLOTS.md
index ba72d4e1..9aab17c2 100644
--- a/docs/NATIVE_IMAGE_SLOTS.md
+++ b/docs/NATIVE_IMAGE_SLOTS.md
@@ -171,6 +171,13 @@ nothing and to re-release anything.
    the owner signs them on the air-gapped machine with OpenSSL
    (`pkeyutl -sign -rawin`), `attach-sig` verifies and attaches. No private
    key ever touches the Spark. The TEST signer exists for tests only.
+   **Cut 1b (merged with this note's follow-up): the package.**
+   `scripts/native_package.sh` builds the image twice from a committed tree,
+   refuses the package if the two builds differ, records `PACKAGE.txt`
+   (commit, variant, image digests, toolchain, component pins, model and
+   firmware digests) and `SHA256SUMS`, and sets the slot manifest's
+   provenance to the SHA-256 of `SHA256SUMS`, so the owner's one signature
+   over the manifest binds the whole package. `docs/NATIVE_PACKAGE.md`.
 2. **Stub reads a slot (after the owner's yes).** The stub locates the
    slots partition on the boot disk, reads C, reads both manifests and
    images, calls `ck_slot_select`, commits the try if asked, and chain-loads
diff --git a/docs/NATIVE_PACKAGE.md b/docs/NATIVE_PACKAGE.md
new file mode 100644
index 00000000..5ff4896c
--- /dev/null
+++ b/docs/NATIVE_PACKAGE.md
@@ -0,0 +1,71 @@
+# Reproducible native package with owner-signed verification (P11 cut 1b)
+
+STATUS: IMPLEMENTED host-side (build, sign, verify, self-test). Nothing in
+this document installs, boots or touches a machine. Gate N7 stays NOT_RUN.
+SECURITY_IMPACT: RECOVERY (the package is what install, update and recovery
+will carry; the format is covered by `docs/NATIVE_IMAGE_SLOTS.md`).
+
+This is the "reproducible native package with exact component/model/firmware
+manifests and owner-signed verification" item of work package P11 (AIEN
+native v1 plan, aien-architecture CURRENT_EXECUTION_PLAN addendum 2026-10-12).
+
+## What a package is
+
+`scripts/native_package.sh build --out DIR --generation N [...]` makes:
+
+| File | Content |
+|---|---|
+| `image/BOOTAA64.EFI` | the image (core, full, or hardware-staging variant), mode 444 |
+| `PACKAGE.txt` | `key value` lines: format, repo, commit and commit time, variant, generation, policy generation, min rollback generation, image bytes/SHA-256/SHA-512, `reproducible two_clean_builds_identical`, gcc/ld/make versions, build host arch, `pin <repo> <sha>` lines from `--pins`, `model_bytes`/`model_sha256` from `--model`, `firmware <name> <bytes> <sha256>` per `--firmware`, and for the staging variant the SHA-256 of the owner public keys file and the machine id file |
+| `SHA256SUMS` | `sha256sum` lines over the image and `PACKAGE.txt` |
+| `slot/MANIFEST.bin` | the unsigned slot manifest (`native/boot/slot_format.h`): generation, digests, commit, timestamp = commit time, **provenance = the 64 hex characters of SHA-256(`SHA256SUMS`)** |
+| `slot/MANIFEST.tbs` | the 448 bytes the owner signs |
+| `slot/MANIFEST.signed.bin` | after `sign`: the manifest with signer id and signature, verified before it is written |
+
+One signature covers everything: the manifest signs the image digest and the
+provenance; the provenance is the digest of `SHA256SUMS`; `SHA256SUMS` covers
+`PACKAGE.txt` and the image. Change any pin, digest or toolchain line and the
+provenance no longer matches; the self-test proves each of these refusals.
+
+## Rules the script enforces
+
+- **Committed tree only.** A dirty working tree is refused (tests may pass
+  `--allow-dirty`; the self-test does so only when the tree is dirty).
+- **Reproducible or not signable** (TRUST-1 Q24). The image is built twice
+  into two fresh directories; if the two differ, no package is written. On
+  2026-10-12 the full image reproduced byte for byte across clean builds
+  (sha256 540b7f75... at aienos 6e3c492).
+- **Never overwritten, never re-signed in place.** `--out` must not exist;
+  `sign` refuses when `MANIFEST.signed.bin` exists.
+- **Private keys never on the Spark.** `build` emits the to-be-signed bytes;
+  the owner signs them on the air-gapped machine
+  (`openssl pkeyutl -sign -inkey owner_root.pem -rawin -in MANIFEST.tbs -out MANIFEST.sig`)
+  and `sign --sig MANIFEST.sig --pubkey <64 hex>` attaches the signature
+  after verifying it. `sign-test` uses the RFC 8032 TEST 1 key and is for
+  tests only; `ck_owner_gen` and the slot tool refuse that key for hardware.
+- **Verify fails closed.** `verify --package DIR --keys FILE` checks
+  `SHA256SUMS`, the `PACKAGE.txt` image digest and the reproducibility line,
+  the provenance binding, the commit match, the signed manifest's signature
+  under the owner keys (`tools/ck_owner_gen.c` file format), and that the
+  signed manifest equals the built one in every field but signer/signature.
+  An unsigned package is refused unless `--allow-unsigned` (reported as not
+  installable).
+
+## Self-test
+
+`make -C native/kernel package-test` runs `scripts/native_package_test.sh`:
+32 checks (build with pins/model/firmware; every PACKAGE.txt line; refusals
+for an existing output, a bad pin, owner files on the wrong variant, an
+unsigned package, double signing, the wrong owner key, a tampered image, a
+tampered PACKAGE.txt with and without re-made sums, a flipped signature byte,
+a missing SHA256SUMS, another package's signed manifest, a non-reproducible
+build via a test hook, the hardware-staging variant with the labelled
+TEST-FIXTURE owner files). About 35 s, nothing booted.
+
+## What is still missing for N7
+
+The package is the input to the updater (slots cut 3) and to the known-good
+recovery image (slots cut 4). Neither exists yet; both wait on the owner
+decision in `docs/NATIVE_IMAGE_SLOTS.md` section 2. Install today is still
+the one-time BootNext procedure of `docs/NATIVE_BOOT_ONE_TIME.md`, which N7
+rejects as the supported path.
diff --git a/native/.crumb b/native/.crumb
index 225d6ad1..f821494d 100644
--- a/native/.crumb
+++ b/native/.crumb
@@ -56,7 +56,7 @@
         },
         {
           "digest": "c1bc8c4dbdd87843adfef62a310e31290b17c16d6251212eca6be9ea6fe1963d",
-          "last_commit": "61bd76a",
+          "last_commit": "6e3c492",
           "name": "boot",
           "purpose": "Directory native/boot. Purpose not yet described by a human."
         },
@@ -79,8 +79,8 @@
           "purpose": "Directory native/disk. Purpose not yet described by a human."
         },
         {
-          "digest": "1cae2705c9a51ed917f8ba4eb048c36e92ab884988421a026182d852ed89086e",
-          "last_commit": "c30b15e",
+          "digest": "4f00e5cd82c3a8f4e474cced14e561ab2bf2c6f811faa8832d333b7bb55293eb",
+          "last_commit": "6e3c492",
           "name": "kernel",
           "purpose": "Directory native/kernel. Purpose not yet described by a human."
         },
@@ -109,15 +109,15 @@
           "purpose": "Directory native/store. Purpose not yet described by a human."
         }
       ],
-      "children_root": "sha256:cb14ac2d1ad86ace9b3107909d67e297ea1bf65c482a293dab790aa36332e481",
-      "compiled_at": "2026-10-12T14:03:50Z",
+      "children_root": "sha256:e8147bf26595c64fb940cf7162999b78639421380acc616ae7a951228ab79ea3",
+      "compiled_at": "2026-10-12T14:57:41Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:3fda00326650b0475a0cbf006766429338c7f58c7d115a038985284ce2f343a3",
+      "digest": "sha256:6de07abca1282ec322f9b0b7dcefe1e9aef7821bd8a3a4483316a6d811065684",
       "evidence_files": 4,
       "evidence_root": "sha256:e410b845507e00568e15b51a5797af32a97e0e4b8ab4e8487bb7c98e7e0cf335",
       "files": 477,
-      "generated_at_commit": "c30b15e75373d0357956d8b46e81d0b007839d54",
-      "source_tree": "sha256:38678f63ce625a35b1ac0aeb94116d8d9d2491fcf633e5d65e1d057eb77bf754"
+      "generated_at_commit": "6e3c492a4bee0154cb05d1c3e45f8874b6588d2d",
+      "source_tree": "sha256:ace261033fa0166854615f85e0abec520d9a0539786a7d5cb4bc27d8f235c4f4"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/kernel/.crumb b/native/kernel/.crumb
index 12f10b66..b9ef43e3 100644
--- a/native/kernel/.crumb
+++ b/native/kernel/.crumb
@@ -93,21 +93,21 @@
           "purpose": "Directory native/kernel/tests. Purpose not yet described by a human."
         },
         {
-          "digest": "48a89618757aeb68d86820be506e65f272374ae9f062bcbddb58dbfc8ca1c6a2",
-          "last_commit": "c30b15e",
+          "digest": "296ff852cc6b1c08d337e2db62489a637ae41385b805290d9a65199c12171865",
+          "last_commit": "6e3c492",
           "name": "tools",
           "purpose": "Hosted (Linux-built) checkers for the native kernel, run by `make -C native/kernel test`; nothin"
         }
       ],
-      "children_root": "sha256:66b658e28d90bcae073551c805f7ccef649ded64fa274b858aacee45e4b680af",
-      "compiled_at": "2026-10-12T14:03:50Z",
+      "children_root": "sha256:5fa11a775a53ed4e7d04bd1e414456b153c398a1ac492ed45bb820d49c83872e",
+      "compiled_at": "2026-10-12T14:57:41Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:1cae2705c9a51ed917f8ba4eb048c36e92ab884988421a026182d852ed89086e",
+      "digest": "sha256:4f00e5cd82c3a8f4e474cced14e561ab2bf2c6f811faa8832d333b7bb55293eb",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 311,
-      "generated_at_commit": "c30b15e75373d0357956d8b46e81d0b007839d54",
-      "source_tree": "sha256:32ab1ed9905c84f191c4aecf4ec5e5d282361b40727b52de6c1e3133d3801b26"
+      "generated_at_commit": "6e3c492a4bee0154cb05d1c3e45f8874b6588d2d",
+      "source_tree": "sha256:2b63e444dacc4fb2dd35aa99bbe335bdeb1240047f9c3fcaf0f7cff41c3b4b14"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/kernel/Makefile b/native/kernel/Makefile
index d7b86489..651f496c 100644
--- a/native/kernel/Makefile
+++ b/native/kernel/Makefile
@@ -1066,8 +1066,8 @@ smmu-l2-mutants: $(OUT)/host/test_smmu
 	else echo "mutant flag refused under CK_HARDWARE_STAGING"; fi; \
 	if [ $$fail = 0 ]; then echo "CK_SMMU_L2_MUTANTS: PASS"; else echo "CK_SMMU_L2_MUTANTS: FAIL"; exit 1; fi
 
-test: $(addprefix $(OUT)/host/,$(TESTS)) handoff-mutant acpi-dev-mutant iort-mutants smmu-l2-mutants osh-op-mutant test-continuity-subject-restart gsp-fw-inspect-test gsp-cot-test gsp-bindata-test gsp-bootargs-test gsp-rpc-test slot-test slot-free
-	@fail=0; for t in $(filter-out handoff-mutant acpi-dev-mutant iort-mutants smmu-l2-mutants osh-op-mutant test-continuity-subject-restart gsp-fw-inspect-test gsp-cot-test gsp-bindata-test gsp-bootargs-test gsp-rpc-test slot-test slot-free,$^); do $$t || fail=1; done; \
+test: $(addprefix $(OUT)/host/,$(TESTS)) handoff-mutant acpi-dev-mutant iort-mutants smmu-l2-mutants osh-op-mutant test-continuity-subject-restart gsp-fw-inspect-test gsp-cot-test gsp-bindata-test gsp-bootargs-test gsp-rpc-test slot-test slot-free package-test
+	@fail=0; for t in $(filter-out handoff-mutant acpi-dev-mutant iort-mutants smmu-l2-mutants osh-op-mutant test-continuity-subject-restart gsp-fw-inspect-test gsp-cot-test gsp-bindata-test gsp-bootargs-test gsp-rpc-test slot-test slot-free package-test,$^); do $$t || fail=1; done; \
 	if [ $$fail = 0 ]; then echo "CK_CORE_HOST: PASS"; else echo "CK_CORE_HOST: FAIL"; exit 1; fi
 
 sanitize: $(addprefix $(OUT)/host-san/,$(TESTS))
@@ -1566,6 +1566,15 @@ slot-free: $(BOOT)/slot_select.c $(BOOT)/slot_format.h
 	if [ -n "$$bad" ]; then echo "slot-free: FAIL unexpected undefined symbols: $$bad"; exit 1; fi; \
 	echo "SLOT_FREE: PASS (undefined: $(SLOT_FREE_ALLOWED_U))"
 
+# ---- reproducible native package (scripts/native_package.sh, P11 cut 1b) ----
+# Builds the image twice from a clean tree, refuses if they differ, records
+# PACKAGE.txt + SHA256SUMS, binds them into the slot manifest's provenance and
+# verifies the owner signature. package-test = scripts/native_package_test.sh
+# (TEST signer and TEST-FIXTURE owner files only; ~35 s; nothing booted).
+package-test: $(SLOT_TOOL)
+	NATIVE_PACKAGE_TOOL_OUT=$(OUT) bash $(REPO)/scripts/native_package_test.sh | grep -E '^NATIVE_PACKAGE_TEST: (PASS|FAIL)' | grep -q PASS || { NATIVE_PACKAGE_TOOL_OUT=$(OUT) bash $(REPO)/scripts/native_package_test.sh | grep -E '^FAIL|NATIVE_PACKAGE_TEST'; exit 1; }
+	@echo "NATIVE_PACKAGE_TEST: PASS"
+
 # ---- host checker for the AIENOS_CK_SCREEN gate (scripts/qemu_ck_screen_test.sh) ----
 FB_CHECK_TOOL := $(OUT)/host/ck_fb_check
 $(FB_CHECK_TOOL): $(KDIR)/tools/ck_fb_check.c $(KDIR)/core/fbcon.c $(KDIR)/core/fbcon.h $(KDIR)/core/font8x8.h
diff --git a/native/kernel/tools/.crumb b/native/kernel/tools/.crumb
index 1b2ddf7e..3e5301c9 100644
--- a/native/kernel/tools/.crumb
+++ b/native/kernel/tools/.crumb
@@ -7,14 +7,14 @@
     "generated": {
       "children": [],
       "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "compiled_at": "2026-10-12T14:03:50Z",
+      "compiled_at": "2026-10-12T14:57:41Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:48a89618757aeb68d86820be506e65f272374ae9f062bcbddb58dbfc8ca1c6a2",
+      "digest": "sha256:296ff852cc6b1c08d337e2db62489a637ae41385b805290d9a65199c12171865",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 18,
-      "generated_at_commit": "c30b15e75373d0357956d8b46e81d0b007839d54",
-      "source_tree": "sha256:c5694f4f087ea2534ca87a531df8d6aa0a6c2ad42963f258c8495c4e5648f11a"
+      "generated_at_commit": "6e3c492a4bee0154cb05d1c3e45f8874b6588d2d",
+      "source_tree": "sha256:0742f2cc6c1f0db5f7f3a7c1def0d535a4de467426153cc09b10aa6e9a077938"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/kernel/tools/ck_slot_tool.c b/native/kernel/tools/ck_slot_tool.c
index 68237d54..d16e7fd4 100644
--- a/native/kernel/tools/ck_slot_tool.c
+++ b/native/kernel/tools/ck_slot_tool.c
@@ -8,6 +8,7 @@
  *   ck_slot_tool make-manifest --image F --generation N --out M
  *       [--policy-generation N] [--min-rollback N] [--commit HEX40]
  *       [--provenance TEXT] [--timestamp N]       unsigned manifest (signature zero)
+ *   ck_slot_tool show M                        print the manifest fields (structural check only)
  *   ck_slot_tool tbs M --out F                   the 448 to-be-signed bytes, for an
  *       offline signer: openssl pkeyutl -sign -inkey owner_root.pem -rawin -in F -out SIG
  *   ck_slot_tool attach-sig M --sig SIG --out M2 --pubkey HEX64
@@ -680,6 +681,21 @@ static int load_manifest(const char *path, struct ck_slot_manifest *m)
     return 0;
 }
 
+static int cmd_show(int argc, char **argv)
+{
+    struct ck_slot_manifest m;
+    const char *why;
+    if (argc < 3)
+        return refuse("show M");
+    if (load_manifest(argv[2], &m) != 0)
+        return 1;
+    print_manifest(&m);
+    if (ck_slot_manifest_check(&m, &why) != 0)
+        return refuse(why);
+    printf("structure: OK (signature not checked; use verify)\n");
+    return 0;
+}
+
 static int cmd_tbs(int argc, char **argv)
 {
     struct ck_slot_manifest m;
@@ -1032,6 +1048,8 @@ int main(int argc, char **argv)
         return selftest();
     if (strcmp(argv[1], "make-manifest") == 0)
         return cmd_make_manifest(argc, argv);
+    if (strcmp(argv[1], "show") == 0)
+        return cmd_show(argc, argv);
     if (strcmp(argv[1], "tbs") == 0)
         return cmd_tbs(argc, argv);
     if (strcmp(argv[1], "sign-test") == 0)
diff --git a/scripts/.crumb b/scripts/.crumb
index 6c7ab731..1fa639a8 100644
--- a/scripts/.crumb
+++ b/scripts/.crumb
@@ -7,14 +7,14 @@
     "generated": {
       "children": [],
       "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "compiled_at": "2026-10-12T11:57:55Z",
+      "compiled_at": "2026-10-12T14:57:41Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:348804e26984e873db9914d2a3ebfcf6c9ea02619247d78809999011b354e048",
+      "digest": "sha256:d124a74c6a60db0dbb1b79e7f92f5f90eb0a9cace1873417f986f0075be061bf",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "files": 84,
-      "generated_at_commit": "20847ab80738c427be90ca3a1ba0c6b69ee0a90c",
-      "source_tree": "sha256:8a24952f080c725f45f951d689db199366d345ccbc97a847ecdf4698bf8ff22f"
+      "files": 86,
+      "generated_at_commit": "6e3c492a4bee0154cb05d1c3e45f8874b6588d2d",
+      "source_tree": "sha256:8e782894349c4cca03bc62e82f5679a8022bb8c3aad7cdcbb9d864b1b750afd2"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/scripts/native_package.sh b/scripts/native_package.sh
new file mode 100755
index 00000000..28fbaa2e
--- /dev/null
+++ b/scripts/native_package.sh
@@ -0,0 +1,308 @@
+#!/usr/bin/env bash
+# native_package.sh -- reproducible AIENOS native package with exact manifests
+# and owner-signed verification (AIEN native v1 plan, P11 cut 1b, gate N7).
+#
+# A package is a directory:
+#   image/BOOTAA64.EFI     the image, built twice from a clean tree; the two
+#                          builds must be byte-identical or the package is
+#                          refused as not signable (TRUST-1 Q24)
+#   PACKAGE.txt            "key value" lines: format, commit, variant, image
+#                          digests, toolchain, component pins, model digest,
+#                          firmware digests (see write_package_txt)
+#   SHA256SUMS             sha256sum lines over image/BOOTAA64.EFI and PACKAGE.txt
+#   slot/MANIFEST.bin      unsigned slot manifest (native/boot/slot_format.h);
+#                          its provenance field is the 64 hex characters of
+#                          sha256(SHA256SUMS), so the owner's one signature
+#                          over the manifest binds the whole package
+#   slot/MANIFEST.tbs      the 448 bytes the owner signs offline:
+#                          openssl pkeyutl -sign -inkey owner_root.pem -rawin \
+#                              -in MANIFEST.tbs -out MANIFEST.sig
+#   slot/MANIFEST.signed.bin  after `sign` (or `sign-test`, TEST key only)
+#
+#   native_package.sh build --out DIR --generation N [--variant core|full|hardware-staging]
+#       [--owner-pubkeys F --machine-id F]   (hardware-staging only)
+#       [--policy-generation N] [--min-rollback N] [--pins FILE] [--model FILE]
+#       [--firmware FILE]... [--allow-dirty]
+#   native_package.sh sign --package DIR --sig FILE --pubkey HEX64
+#   native_package.sh sign-test --package DIR          RFC 8032 TEST 1 key, tests only
+#   native_package.sh verify --package DIR (--keys FILE | --test-key) [--allow-unsigned]
+#
+# --pins FILE: lines "<repo> <40 hex>" copied into PACKAGE.txt after validation.
+# --model FILE: its sha256 and size are recorded (the frozen model of P09/P12).
+# --firmware FILE: each file's sha256 and size are recorded (GB10 firmware blobs
+#   of docs/GB10_FIRMWARE_INVENTORY.md). Nothing is loaded or booted.
+# Build-only. Never writes outside DIR and the scratch build directories.
+# Every refusal prints "refused: <reason>" and exits 1.
+set -euo pipefail
+
+here=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
+repo=$(cd "$here/.." && pwd)
+kdir="$repo/native/kernel"
+FORMAT=1
+
+refuse() { echo "refused: $*"; exit 1; }
+hex40() { [[ "$1" =~ ^[0-9a-f]{40}$ ]]; }
+hex64() { [[ "$1" =~ ^[0-9a-f]{64}$ ]]; }
+sha256_of() { sha256sum "$1" | cut -d' ' -f1; }
+sha512_of() { sha512sum "$1" | cut -d' ' -f1; }
+size_of() { stat -c %s "$1"; }
+
+slot_tool() {
+    local out="${NATIVE_PACKAGE_TOOL_OUT:-$repo/target/native-kernel}"
+    make -s -C "$kdir" OUT="$out" slot-tool >/dev/null
+    echo "$out/host/ck_slot_tool"
+}
+
+# ---- build ---------------------------------------------------------------------
+build_once() {
+    # $1 = OUT dir, $2 = variant, $3 = owner pubkeys, $4 = machine id
+    local out="$1" variant="$2" own="$3" mid="$4"
+    case "$variant" in
+    core) make -s -C "$kdir" OUT="$out" >"$out.log" 2>&1 || refuse "build failed (see $out.log)"; echo "$out/BOOTAA64.EFI";;
+    full) make -s -C "$kdir" OUT="$out" full >"$out.log" 2>&1 || refuse "build failed (see $out.log)"; echo "$out/full/BOOTAA64.EFI";;
+    hardware-staging)
+        make -s -C "$kdir" OUT="$out" full CK_HARDWARE_STAGING=1 CK_OWNER_PUBKEYS="$own" CK_MACHINE_ID="$mid" >"$out.log" 2>&1 || refuse "build failed (see $out.log)"
+        echo "$out/full-hardware-staging/BOOTAA64.EFI";;
+    *) refuse "unknown variant $variant";;
+    esac
+}
+
+write_package_txt() {
+    # $1 = package dir, then named globals
+    local dir="$1"
+    {
+        echo "format $FORMAT"
+        echo "repo aien-dev/aienos"
+        echo "commit $commit"
+        echo "commit_time $commit_time"
+        echo "tree clean"
+        echo "variant $variant"
+        echo "generation $generation"
+        echo "policy_generation $policy_generation"
+        echo "min_rollback_generation $min_rollback"
+        echo "image image/BOOTAA64.EFI"
+        echo "image_bytes $(size_of "$dir/image/BOOTAA64.EFI")"
+        echo "image_sha256 $(sha256_of "$dir/image/BOOTAA64.EFI")"
+        echo "image_sha512 $(sha512_of "$dir/image/BOOTAA64.EFI")"
+        echo "reproducible two_clean_builds_identical"
+        echo "toolchain_cc $(gcc --version | head -1)"
+        echo "toolchain_ld $(ld --version | head -1)"
+        echo "toolchain_make $(make --version | head -1)"
+        echo "build_host_arch $(uname -m)"
+        if [ -n "$pins" ]; then
+            while read -r r s; do
+                [ -z "$r" ] && continue
+                case "$r" in \#*) continue;; esac
+                echo "pin $r $s"
+            done <"$pins"
+        fi
+        if [ -n "$model" ]; then
+            echo "model_bytes $(size_of "$model")"
+            echo "model_sha256 $(sha256_of "$model")"
+        fi
+        for f in "${firmware[@]}"; do
+            echo "firmware $(basename "$f") $(size_of "$f") $(sha256_of "$f")"
+        done
+        if [ -n "$own" ]; then
+            echo "owner_pubkeys_sha256 $(sha256_of "$own")"
+            echo "machine_id_sha256 $(sha256_of "$mid")"
+        fi
+    } >"$dir/PACKAGE.txt"
+}
+
+cmd_build() {
+    local out="" generation="" variant="full" own="" mid="" policy_generation=0 min_rollback=0
+    local pins="" model="" allow_dirty=0
+    local -a firmware=()
+    while [ $# -gt 0 ]; do
+        case "$1" in
+        --out) out="$2"; shift 2;;
+        --generation) generation="$2"; shift 2;;
+        --variant) variant="$2"; shift 2;;
+        --owner-pubkeys) own="$2"; shift 2;;
+        --machine-id) mid="$2"; shift 2;;
+        --policy-generation) policy_generation="$2"; shift 2;;
+        --min-rollback) min_rollback="$2"; shift 2;;
+        --pins) pins="$2"; shift 2;;
+        --model) model="$2"; shift 2;;
+        --firmware) firmware+=("$2"); shift 2;;
+        --allow-dirty) allow_dirty=1; shift;;
+        *) refuse "build: unknown argument $1";;
+        esac
+    done
+    [ -n "$out" ] || refuse "build needs --out DIR"
+    [[ "$generation" =~ ^[1-9][0-9]*$ ]] || refuse "build needs --generation N (positive integer)"
+    [[ "$policy_generation" =~ ^[0-9]+$ ]] || refuse "--policy-generation must be an integer"
+    [[ "$min_rollback" =~ ^[0-9]+$ ]] || refuse "--min-rollback must be an integer"
+    [ -e "$out" ] && refuse "--out $out already exists (packages are never overwritten)"
+    if [ "$variant" = hardware-staging ]; then
+        [ -n "$own" ] && [ -n "$mid" ] || refuse "hardware-staging needs --owner-pubkeys and --machine-id"
+        [ -f "$own" ] && [ -f "$mid" ] || refuse "owner pubkeys or machine id file missing"
+    else
+        [ -z "$own" ] && [ -z "$mid" ] || refuse "--owner-pubkeys/--machine-id only with --variant hardware-staging"
+    fi
+    [ -z "$pins" ] || [ -f "$pins" ] || refuse "pins file missing"
+    if [ -n "$pins" ]; then
+        while read -r r s; do
+            [ -z "$r" ] && continue
+            case "$r" in \#*) continue;; esac
+            hex40 "$s" || refuse "pins file: $r is not followed by 40 hex characters"
+        done <"$pins"
+    fi
+    [ -z "$model" ] || [ -f "$model" ] || refuse "model file missing"
+    for f in "${firmware[@]}"; do [ -f "$f" ] || refuse "firmware file missing: $f"; done
+
+    local dirty
+    dirty=$(git -C "$repo" status --porcelain --untracked-files=no)
+    if [ -n "$dirty" ] && [ "$allow_dirty" = 0 ]; then
+        refuse "working tree is dirty; a package is built from a committed tree only (or --allow-dirty for tests)"
+    fi
+    local commit commit_time
+    commit=$(git -C "$repo" rev-parse HEAD)
+    commit_time=$(git -C "$repo" log -1 --format=%ct)
+    hex40 "$commit" || refuse "cannot read the commit"
+
+    local scratch
+    scratch=$(mktemp -d "${TMPDIR:-/tmp}/native-package.XXXXXX")
+    local img_a img_b
+    img_a=$(build_once "$scratch/a" "$variant" "$own" "$mid")
+    img_b=$(build_once "$scratch/b" "$variant" "$own" "$mid")
+    if [ -n "${NATIVE_PACKAGE_TEST_CORRUPT_SECOND:-}" ]; then
+        printf '\0' >>"$img_b"   # test hook: make the second build differ
+    fi
+    local da db
+    da=$(sha256_of "$img_a"); db=$(sha256_of "$img_b")
+    if [ "$da" != "$db" ]; then
+        rm -rf "$scratch"
+        refuse "two clean builds differ ($da vs $db): not reproducible, not signable"
+    fi
+
+    mkdir -p "$out/image" "$out/slot"
+    cp "$img_a" "$out/image/BOOTAA64.EFI"
+    chmod 444 "$out/image/BOOTAA64.EFI"
+    rm -rf "$scratch"
+    write_package_txt "$out"
+    (cd "$out" && sha256sum image/BOOTAA64.EFI PACKAGE.txt >SHA256SUMS)
+    local prov tool
+    prov=$(sha256_of "$out/SHA256SUMS")
+    tool=$(slot_tool)
+    "$tool" make-manifest --image "$out/image/BOOTAA64.EFI" --generation "$generation" \
+        --policy-generation "$policy_generation" --min-rollback "$min_rollback" \
+        --commit "$commit" --provenance "$prov" --timestamp "$commit_time" \
+        --out "$out/slot/MANIFEST.bin" >/dev/null || refuse "slot manifest not built"
+    "$tool" tbs "$out/slot/MANIFEST.bin" --out "$out/slot/MANIFEST.tbs" >/dev/null
+    echo "package built: $out"
+    echo "  commit $commit variant $variant generation $generation"
+    echo "  image sha256 $da ($(size_of "$out/image/BOOTAA64.EFI") bytes), two clean builds identical"
+    echo "  provenance (sha256 of SHA256SUMS) $prov"
+    echo "  sign offline: openssl pkeyutl -sign -inkey owner_root.pem -rawin -in $out/slot/MANIFEST.tbs -out MANIFEST.sig"
+    echo "  then: $0 sign --package $out --sig MANIFEST.sig --pubkey <64 hex>"
+}
+
+# ---- package integrity (shared by sign and verify) ---------------------------------
+check_package_files() {
+    local dir="$1"
+    [ -d "$dir" ] || refuse "package directory missing"
+    for f in image/BOOTAA64.EFI PACKAGE.txt SHA256SUMS slot/MANIFEST.bin; do
+        [ -f "$dir/$f" ] || refuse "package is missing $f"
+    done
+    (cd "$dir" && sha256sum -c --quiet --strict SHA256SUMS >/dev/null 2>&1) || refuse "SHA256SUMS does not match the package files"
+    local fmt
+    fmt=$(awk '$1=="format"{print $2}' "$dir/PACKAGE.txt")
+    [ "$fmt" = "$FORMAT" ] || refuse "PACKAGE.txt format $fmt is not $FORMAT"
+    local want_sha have_sha
+    want_sha=$(awk '$1=="image_sha256"{print $2}' "$dir/PACKAGE.txt")
+    have_sha=$(sha256_of "$dir/image/BOOTAA64.EFI")
+    [ "$want_sha" = "$have_sha" ] || refuse "PACKAGE.txt image_sha256 does not match the image"
+    local repro
+    repro=$(awk '$1=="reproducible"{print $2}' "$dir/PACKAGE.txt")
+    [ "$repro" = two_clean_builds_identical ] || refuse "PACKAGE.txt does not record a reproducible build"
+}
+
+manifest_provenance_check() {
+    # $1 = dir, $2 = manifest file. The manifest's provenance must be sha256(SHA256SUMS)
+    # and its commit must be PACKAGE.txt's commit. Read via the tool's print lines.
+    local dir="$1" mf="$2" tool="$3"
+    local line prov commit want_prov want_commit
+    line=$("$tool" show "$mf" 2>/dev/null | /usr/bin/grep -m1 '^  commit=' || true)
+    commit=$(echo "$line" | sed -n 's/^  commit=\([0-9a-f]\{40\}\) provenance=.*/\1/p')
+    prov=$(echo "$line" | sed -n 's/^  commit=[0-9a-f]\{40\} provenance=\([0-9a-f]\{64\}\).*/\1/p')
+    want_prov=$(sha256_of "$dir/SHA256SUMS")
+    want_commit=$(awk '$1=="commit"{print $2}' "$dir/PACKAGE.txt")
+    [ "$prov" = "$want_prov" ] || refuse "manifest provenance does not bind this package's SHA256SUMS"
+    [ "$commit" = "$want_commit" ] || refuse "manifest commit does not match PACKAGE.txt"
+}
+
+cmd_sign() {
+    local dir="" sig="" pk="" test_key=0
+    while [ $# -gt 0 ]; do
+        case "$1" in
+        --package) dir="$2"; shift 2;;
+        --sig) sig="$2"; shift 2;;
+        --pubkey) pk="$2"; shift 2;;
+        --test) test_key=1; shift;;
+        *) refuse "sign: unknown argument $1";;
+        esac
+    done
+    [ -n "$dir" ] || refuse "sign needs --package DIR"
+    check_package_files "$dir"
+    local tool
+    tool=$(slot_tool)
+    manifest_provenance_check "$dir" "$dir/slot/MANIFEST.bin" "$tool"
+    [ -e "$dir/slot/MANIFEST.signed.bin" ] && refuse "package is already signed (never re-signed in place)"
+    if [ "$test_key" = 1 ]; then
+        "$tool" sign-test "$dir/slot/MANIFEST.bin" --out "$dir/slot/MANIFEST.signed.bin" | tail -1
+        echo "TEST-SIGNED package (never for hardware): $dir"
+        return 0
+    fi
+    [ -n "$sig" ] && [ -n "$pk" ] || refuse "sign needs --sig FILE and --pubkey HEX64"
+    hex64 "$pk" || refuse "--pubkey must be 64 hex characters"
+    "$tool" attach-sig "$dir/slot/MANIFEST.bin" --sig "$sig" --pubkey "$pk" --out "$dir/slot/MANIFEST.signed.bin" | tail -1
+    echo "signed package: $dir"
+}
+
+cmd_verify() {
+    local dir="" keys="" test_key=0 allow_unsigned=0
+    while [ $# -gt 0 ]; do
+        case "$1" in
+        --package) dir="$2"; shift 2;;
+        --keys) keys="$2"; shift 2;;
+        --test-key) test_key=1; shift;;
+        --allow-unsigned) allow_unsigned=1; shift;;
+        *) refuse "verify: unknown argument $1";;
+        esac
+    done
+    [ -n "$dir" ] || refuse "verify needs --package DIR"
+    [ -n "$keys" ] || [ "$test_key" = 1 ] || refuse "verify needs --keys FILE or --test-key"
+    check_package_files "$dir"
+    local tool
+    tool=$(slot_tool)
+    local mf="$dir/slot/MANIFEST.signed.bin"
+    if [ ! -f "$mf" ]; then
+        [ "$allow_unsigned" = 1 ] || refuse "package is UNSIGNED (slot/MANIFEST.signed.bin missing)"
+        manifest_provenance_check "$dir" "$dir/slot/MANIFEST.bin" "$tool"
+        echo "VERIFY: UNSIGNED package is internally consistent (not installable)"
+        return 0
+    fi
+    manifest_provenance_check "$dir" "$mf" "$tool"
+    local -a karg
+    if [ "$test_key" = 1 ]; then karg=(--test-key); else karg=(--keys "$keys"); fi
+    local vout
+    if ! vout=$("$tool" verify "$mf" --image "$dir/image/BOOTAA64.EFI" "${karg[@]}" 2>&1); then
+        echo "$vout" | /usr/bin/grep '^refused:' || true
+        refuse "slot manifest signature or digest check failed"
+    fi
+    # The unsigned manifest must equal the signed one in every field but signer/signature.
+    cmp -s <(head -c 184 "$dir/slot/MANIFEST.bin") <(head -c 184 "$mf") || refuse "signed manifest differs from the built manifest"
+    echo "VERIFY: PASS $dir"
+    echo "$vout" | /usr/bin/grep -E '^(verify:|manifest:|keys:)'
+    awk '$1=="commit"||$1=="variant"||$1=="generation"||$1=="image_sha256"||$1=="model_sha256"||$1=="pin"{print "  " $0}' "$dir/PACKAGE.txt"
+}
+
+case "${1:-}" in
+build) shift; cmd_build "$@";;
+sign) shift; cmd_sign "$@";;
+sign-test) shift; cmd_sign --test "$@";;
+verify) shift; cmd_verify "$@";;
+*) refuse "usage: native_package.sh build|sign|sign-test|verify ... (see the header)";;
+esac
diff --git a/scripts/native_package_test.sh b/scripts/native_package_test.sh
new file mode 100755
index 00000000..163b466c
--- /dev/null
+++ b/scripts/native_package_test.sh
@@ -0,0 +1,81 @@
+#!/usr/bin/env bash
+# native_package_test.sh -- self-test of scripts/native_package.sh (P11 cut 1b).
+# Build-only; nothing is booted. Uses the RFC 8032 TEST 1 signer (never for
+# hardware) and the labelled TEST-FIXTURE owner files. Every row prints PASS or
+# FAIL; the last line is NATIVE_PACKAGE_TEST: PASS|FAIL (n checks).
+set -uo pipefail
+here=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
+repo=$(cd "$here/.." && pwd)
+np="$here/native_package.sh"
+fix="$repo/native/kernel/tests/fixtures/owner"
+T=$(mktemp -d "${TMPDIR:-/tmp}/native-package-test.XXXXXX")
+trap 'rm -rf "$T"' EXIT
+export NATIVE_PACKAGE_TOOL_OUT="$T/tool"
+checks=0; fails=0
+pass() { checks=$((checks+1)); echo "PASS: $1"; }
+fail() { checks=$((checks+1)); fails=$((fails+1)); echo "FAIL: $1"; }
+expect_ok() { local what="$1"; shift; if out=$("$@" 2>&1); then pass "$what"; else fail "$what: $(echo "$out" | tail -1)"; fi; }
+expect_refused() { # what, needle, cmd...
+    local what="$1" needle="$2"; shift 2
+    if out=$("$@" 2>&1); then fail "$what: accepted"; return; fi
+    if echo "$out" | /usr/bin/grep -q -- "$needle"; then pass "$what"; else fail "$what: wrong reason: $(echo "$out" | /usr/bin/grep '^refused' | tail -1)"; fi
+}
+dirty=()
+[ -z "$(git -C "$repo" status --porcelain --untracked-files=no)" ] || dirty=(--allow-dirty)
+
+printf 'aien-dev/omega 781e98d8224b5bf229991f54722d2dc7c415d79f\naien-dev/physics 57aafa0d69d5d768e46164ff0963ffd87355ab0d\n' >"$T/pins.txt"
+head -c 4096 /dev/urandom >"$T/model.bin"
+head -c 1024 /dev/urandom >"$T/fw1.bin"
+
+# 1. build a full package with pins, model and firmware digests
+expect_ok "build full package (two clean builds identical)" "$np" build --out "$T/p1" --generation 7 --policy-generation 5 --pins "$T/pins.txt" --model "$T/model.bin" --firmware "$T/fw1.bin" "${dirty[@]}"
+for k in "commit " "image_sha256 " "reproducible two_clean_builds_identical" "pin aien-dev/omega 781e98d8" "model_sha256 $(sha256sum "$T/model.bin" | cut -c1-64)" "firmware fw1.bin 1024 "; do
+    if /usr/bin/grep -q "^$k" "$T/p1/PACKAGE.txt"; then pass "PACKAGE.txt has $k"; else fail "PACKAGE.txt lacks $k"; fi
+done
+[ "$(stat -c %s "$T/p1/slot/MANIFEST.tbs")" = 448 ] && pass "tbs is 448 bytes" || fail "tbs size"
+expect_refused "build refuses an existing --out" "already exists" "$np" build --out "$T/p1" --generation 7 "${dirty[@]}"
+echo "aien-dev/omega notahash" >"$T/badpins.txt"
+expect_refused "build refuses a bad pins line" "40 hex" "$np" build --out "$T/px" --generation 7 --pins "$T/badpins.txt" "${dirty[@]}"
+expect_refused "build refuses owner files without hardware-staging" "only with --variant hardware-staging" "$np" build --out "$T/py" --generation 7 --owner-pubkeys "$fix/TEST-FIXTURE-owner-pubkeys.txt" --machine-id "$fix/TEST-FIXTURE-machine-id.txt" "${dirty[@]}"
+
+# 2. unsigned
+expect_refused "verify refuses an unsigned package" "UNSIGNED" "$np" verify --package "$T/p1" --test-key
+expect_ok "verify --allow-unsigned accepts the consistent unsigned package" "$np" verify --package "$T/p1" --test-key --allow-unsigned
+
+# 3. test-signed, verify, wrong key
+expect_ok "sign-test" "$np" sign-test --package "$T/p1"
+expect_refused "sign-test refuses to sign twice" "already signed" "$np" sign-test --package "$T/p1"
+expect_ok "verify PASS with the TEST key" "$np" verify --package "$T/p1" --test-key
+expect_refused "verify refuses under the fixture owner key" "no trusted key" "$np" verify --package "$T/p1" --keys "$fix/TEST-FIXTURE-owner-pubkeys.txt"
+expect_refused "verify needs a key source" "needs --keys" "$np" verify --package "$T/p1"
+
+# 4. tampering (each on a fresh copy)
+cp -r "$T/p1" "$T/t1"; chmod u+w "$T/t1/image/BOOTAA64.EFI"; printf '\xff' | dd of="$T/t1/image/BOOTAA64.EFI" bs=1 seek=100 conv=notrunc status=none
+expect_refused "tampered image byte" "SHA256SUMS does not match" "$np" verify --package "$T/t1" --test-key
+cp -r "$T/p1" "$T/t2"; sed -i 's/^generation 7$/generation 9/' "$T/t2/PACKAGE.txt"
+expect_refused "tampered PACKAGE.txt" "SHA256SUMS does not match" "$np" verify --package "$T/t2" --test-key
+cp -r "$T/p1" "$T/t3"; sed -i 's/^generation 7$/generation 9/' "$T/t3/PACKAGE.txt"; (cd "$T/t3" && sha256sum image/BOOTAA64.EFI PACKAGE.txt >SHA256SUMS)
+expect_refused "tampered PACKAGE.txt with re-made SHA256SUMS" "provenance does not bind" "$np" verify --package "$T/t3" --test-key
+cp -r "$T/p1" "$T/t4"; printf '\x01' | dd of="$T/t4/slot/MANIFEST.signed.bin" bs=1 seek=460 conv=notrunc status=none
+expect_refused "flipped signature byte" "signature or digest" "$np" verify --package "$T/t4" --test-key
+cp -r "$T/p1" "$T/t5"; rm "$T/t5/SHA256SUMS"
+expect_refused "missing SHA256SUMS" "missing SHA256SUMS" "$np" verify --package "$T/t5" --test-key
+
+# 5. a signed manifest from another package does not verify here
+expect_ok "build core package generation 8" "$np" build --out "$T/p2" --generation 8 --variant core "${dirty[@]}"
+expect_ok "sign-test p2" "$np" sign-test --package "$T/p2"
+cp -r "$T/p1" "$T/t6"; cp "$T/p2/slot/MANIFEST.signed.bin" "$T/t6/slot/MANIFEST.signed.bin"
+expect_refused "signed manifest of another package" "provenance does not bind" "$np" verify --package "$T/t6" --test-key
+
+# 6. non-reproducible build is refused
+expect_refused "non-reproducible build refused (test hook)" "not reproducible, not signable" env NATIVE_PACKAGE_TEST_CORRUPT_SECOND=1 "$np" build --out "$T/p3" --generation 7 --variant core "${dirty[@]}"
+[ ! -e "$T/p3" ] && pass "no package directory left behind" || fail "refused build left a package"
+
+# 7. hardware-staging variant with the labelled fixtures
+expect_ok "build hardware-staging package (fixture owner files)" "$np" build --out "$T/p4" --generation 7 --variant hardware-staging --owner-pubkeys "$fix/TEST-FIXTURE-owner-pubkeys.txt" --machine-id "$fix/TEST-FIXTURE-machine-id.txt" "${dirty[@]}"
+/usr/bin/grep -q "^owner_pubkeys_sha256 " "$T/p4/PACKAGE.txt" && pass "staging PACKAGE.txt records owner_pubkeys_sha256" || fail "staging owner digest missing"
+/usr/bin/grep -q "^variant hardware-staging$" "$T/p4/PACKAGE.txt" && pass "staging variant recorded" || fail "staging variant"
+expect_refused "staging variant needs both owner files" "needs --owner-pubkeys" "$np" build --out "$T/p5" --generation 7 --variant hardware-staging "${dirty[@]}"
+
+echo "NATIVE_PACKAGE_TEST: $([ "$fails" = 0 ] && echo PASS || echo FAIL) ($checks checks, $fails failures)"
+[ "$fails" = 0 ]