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#309 (code only)

closed derived 139412618b5400cc #309

Imported from GitHub aien-dev/aienux#309 (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 adb4dd0951a5ab3aabcc5c3ea11e58b72c6413b2 · Head 57a51b50cf61d62c59b5c3bbab9f18ff8a0588b6

Apply it

git checkout -b patch-139412618b5400cc adb4dd0951a5ab3aabcc5c3ea11e58b72c6413b2
curl -fsSL https://interplane.io/drakestapleton/aienux/patches/139412618b5400cc.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
309
57a51b50cf61d62c59b5c3bbab9f18ff8a0588b6
{"kind":"github-import","owner":"aien-dev","repo":"aienux","number":309,"url":"https://github.com/aien-dev/aienux/pull/309","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:11Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.crumb b/.crumb
index b3bb6039..2a217235 100644
--- a/.crumb
+++ b/.crumb
@@ -27,33 +27,33 @@
           "purpose": "Directory crates. Purpose not yet described by a human."
         },
         {
-          "digest": "4a006f504e49f1586a9591657f799ab634dd4b8256fbbed233d2bfbf541a7907",
-          "last_commit": "51c05da",
+          "digest": "fabe7edbdb8877e2b15cd29bee691f924d8d502cd202b60686c046b3a5ca7aa2",
+          "last_commit": "e01be85",
           "name": "docs",
           "purpose": "Directory docs. Purpose not yet described by a human."
         },
         {
-          "digest": "0ab785d09f7eab5872d69b17ee8ffe01f169d64fc0dd477f0719e29d6faee7d7",
-          "last_commit": "8daa91d",
+          "digest": "771f766c7b0d59e22e653b67bd60c4f7c8cb068f5ee7220be0e317aa1d385802",
+          "last_commit": "e01be85",
           "name": "native",
           "purpose": "Directory native. Purpose not yet described by a human."
         },
         {
-          "digest": "9fac5e2c6ace7bf64f1773b6da11b091ec82d394f285baad457758435df36f98",
-          "last_commit": "8daa91d",
+          "digest": "220b980dcb68f58f243c7334f554634ff22438a535a770bee491dd57f0f8dc69",
+          "last_commit": "e01be85",
           "name": "scripts",
           "purpose": "Directory scripts. Purpose not yet described by a human."
         }
       ],
-      "children_root": "sha256:5e87521eb4857240f8ddf1b69307ff45a8a912351e609b143352fa4b70fb3cfe",
-      "compiled_at": "2026-10-12T04:00:08Z",
+      "children_root": "sha256:3757c7204f15b29864d08af18bb37f141df1e300d53eda784115c46bda89fbac",
+      "compiled_at": "2026-10-12T04:51:22Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:3f9f11932753ab5f47d4768bbdbc99cc4b3497386fa188754c3aa18182b29e79",
+      "digest": "sha256:208ee92a5e07cce0b7c4fb06c7b5e9e18c3f26c2402ead772df383d6eb67b9fe",
       "evidence_files": 155,
       "evidence_root": "sha256:d59c0cef4e7dd5172923754a95b411ca54b01f35baca4587f792f1b259f1eaf7",
-      "files": 3072,
-      "generated_at_commit": "8daa91dcd1e546cae2e8d39fada6d59b759804c3",
-      "source_tree": "sha256:a56b9be1d834f2d8ff5040e496999910fb2bd99d179546628aaae9945defac06"
+      "files": 3073,
+      "generated_at_commit": "e01be85155f959705f2534cf07a7b66a03567404",
+      "source_tree": "sha256:befb2f29a6a28d8bed2ef14f02f70a3c6b180c8341c4f96412b78432c072587f"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/docs/.crumb b/docs/.crumb
index 5c2ff645..c9d5bc93 100644
--- a/docs/.crumb
+++ b/docs/.crumb
@@ -30,14 +30,14 @@
         }
       ],
       "children_root": "sha256:55bcc89f5282eb2e3f4e86d882abdfb5f4ea39e427ef97ef620b2267e5701eb1",
-      "compiled_at": "2026-10-11T21:20:24Z",
+      "compiled_at": "2026-10-12T04:06:57Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:4a006f504e49f1586a9591657f799ab634dd4b8256fbbed233d2bfbf541a7907",
+      "digest": "sha256:fabe7edbdb8877e2b15cd29bee691f924d8d502cd202b60686c046b3a5ca7aa2",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 69,
-      "generated_at_commit": "362cba9653c8021996a21b17ead00d5d1140b371",
-      "source_tree": "sha256:5ae38aa8f3095ebededbd595f7e7755691c24a93c3bb67aa54ccb7329ad4b2a3"
+      "generated_at_commit": "51c05daff49b0836692eb1c777ec2758cf0746ae",
+      "source_tree": "sha256:24c323cc22254c282467f5877a44a60c1e7dd79161d5ba2b53c2193e02ab83db"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/docs/campaigns/B7B-PHYSICAL-BOOT-PREP.md b/docs/campaigns/B7B-PHYSICAL-BOOT-PREP.md
index d3baa22e..8e576810 100644
--- a/docs/campaigns/B7B-PHYSICAL-BOOT-PREP.md
+++ b/docs/campaigns/B7B-PHYSICAL-BOOT-PREP.md
@@ -27,8 +27,13 @@ Built and tested without hardware (PR #302, squash `863bef83`, issue #286 commen
   IDR0/IDR1, unconfines. `--self-test`: 19 canned logs and 4 Makefile refusals. Local runs recorded in the PR: all PASS.
 - Expected Spark output: `docs/GB10_IORT_DECODE.md` section 10, labelled *expected, not observed*.
 
-Not built, and therefore a blocker (section 4, G7): a probe variant of the one-time staging script
-(`scripts/stage_one_time_boot_ck.sh` / `_full.sh`); it touches the boot-entry staging path and is left for this campaign.
+Built 2026-10-12 (native v1 package P02): the probe variant of the one-time staging script,
+`scripts/stage_one_time_boot_ck_b7b.sh` (`--dry-run` / `--apply`, same shape as `_full.sh`). It builds the probe
+hardware staging image twice and refuses on a digest mismatch, checks the image carries the segment-15 probe and no
+TEST marker, and stages it as `\EFI\AIENOS\aienos-ck-b7b.efi` with a `STAGED-CK-B7B.TXT` record. Its dry run was
+executed on the Spark on 2026-10-12 (read-only; it stopped on four preflight items, among them the recovery stick not
+being inserted), and two builds of the image at commit `51c05da` with the labelled TEST-FIXTURE owner files (a build
+check only, never a boot) gave one digest. What remains for G7 is Drake reading the dry run.
 
 ## 2. People and things required (all physical, all Drake's)
 
@@ -58,9 +63,9 @@ failure.
 | P7 | `bash scripts/qemu_verify_recovery_media.sh` | the recovery environment boots in QEMU with zero hard disks |
 | P8 | `bash scripts/qemu_ck_rollback_test.sh` and `bash scripts/qemu_native_rollback_test.sh` | the rollback gates pass for this commit |
 | P9 | `bash scripts/qemu_ck_b7b_probe_test.sh --self-test`, then with no flag, then `--positive` | `AIENOS_CK_B7B_PROBE_SELF_TEST: PASS`, `AIENOS_CK_B7B_PROBE: PASS`, `AIENOS_CK_B7B_PROBE_POSITIVE: PASS` |
-| P10 | `bash scripts/ck_repro_build.sh full` (builds twice, compares) and the probe build `make -C native/kernel full CK_B7B_PROBE=1 CK_HARDWARE_STAGING=1 CK_OWNER_PUBKEYS=<file> CK_MACHINE_ID=<file>` | two equal digests; the probe image digest written down. UNVERIFIED that `ck_repro_build.sh` accepts the probe flag; read its help first |
+| P10 | `bash scripts/ck_repro_build.sh full` (builds twice, compares); the probe staging image is built twice by the stage script itself (P12 shows the commands, `--apply` runs them and STOPs on a digest mismatch; `ck_repro_build.sh` does not build staging images, verified 2026-10-12 by reading it) | two equal digests for the default full image; the probe image digest is written down from the stage script output |
 | P11 | `bash scripts/native_boot_preflight.sh --image <probe image .efi> --expect-sha256 <digest from P10>` | last line `NATIVE_PREFLIGHT: READY`; the `ASK` lines are Drake's and are answered in person |
-| P12 | `bash scripts/stage_one_time_boot_ck.sh --dry-run` (or the probe variant's dry run, once it exists) | prints every command, touches nothing; Drake reads it |
+| P12 | `AIENOS_OWNER_PUBKEYS=<file> AIENOS_MACHINE_ID=<file> bash scripts/stage_one_time_boot_ck_b7b.sh --dry-run` | prints every command, touches nothing, ends "Pre-flight clean"; Drake reads it |
 | P13 | the recovery stick, tested in person: booted once in an earlier attended window per `docs/RECOVERY_MEDIA_MACHINE1.md`, evidence kept | the evidence file from that boot is on hand. UNVERIFIED whether a current one exists; no script checks this |
 
 Secure Boot is recorded, never changed. As of 2026-10-01 it is OFF for development by owner decision
@@ -79,8 +84,9 @@ UNVERIFIED here and is part of Drake's go/no-go.
   on screen).
 - G5 `BootNext` unset, `BootOrder` unchanged (P4), Linux is the running system.
 - G6 Everyone can state the abort rule (section 7) from memory.
-- G7 A reviewed probe variant of the staging script exists and its dry run (P12) was read by Drake. **Today this is
-  false; therefore today the answer is NO-GO.**
+- G7 A reviewed probe variant of the staging script exists (`scripts/stage_one_time_boot_ck_b7b.sh`, since 2026-10-12)
+  and its dry run (P12) was read by Drake. **The script exists; the read-through has not happened; therefore today the
+  answer is still NO-GO.**
 - G8 Drake says "go" out loud in the window, and the witness writes the time.
 
 **NO-GO (any one):** any preflight STOP line; a dirty tree; the stick missing; an unexpected `BootNext`; a digest
@@ -93,7 +99,7 @@ that Drake wants answered first.
 2. In Linux, capture the "before" state (needs sudo; Drake runs it):
    `sudo scripts/verify_native_rollback.sh --capture-pre evidence/pre_boot_capture.json`.
    The staging script does this itself; do not capture twice.
-3. Stage once: the probe variant of the stage script with `--apply` (needs sudo; it writes only the staging directory
+3. Stage once: `sudo` is asked for by `scripts/stage_one_time_boot_ck_b7b.sh --apply` with the owner files set (needs sudo; it writes only the staging directory
    `\EFI\AIENOS` on the ESP and sets `BootNext` once; it never reboots and never changes `BootOrder`). Read its
    output aloud; it must end with `BootNext` set and `Boot0004 AIENOSRECOV` still listed.
 4. Reboot by Drake's hand (`sudo reboot`). Start the clock.
@@ -103,8 +109,9 @@ that Drake wants answered first.
    `smmu: instance 1 up base=0x13000000`; the reserved-range line; `b7b_probe: confined ...`;
    `b7b_probe: instance=1 idr0=0x........ idr1=0x........ st_level=. sidsize=..`; `b7b_probe: unconfine rc=0 (ok)`;
    `AIENOS_B7B_PROBE: CONFINED_AND_RELEASED`.
-6. The image holds the console for its hold time (120 s on the infer image; UNVERIFIED for the probe image) and then
-   resets. Do not touch anything. The next start is Linux because `BootNext` is already consumed.
+6. The image holds the console for 120 s (`CK_FB_HOLD_S=120`, set by the stage script; the probe returns to kmain and
+   the full image's normal final report, hold and reset follow, so the hold is the full image's own; UNVERIFIED on
+   the real console until this window) and then resets. Do not touch anything. The next start is Linux because `BootNext` is already consumed.
 7. Back in Linux: `sudo scripts/verify_native_rollback.sh --capture-post evidence/post_boot_capture.json`, then
    `--pre ... --post ... --verify` (ten invariants). Read the verdict aloud.
 
@@ -136,6 +143,11 @@ that Drake wants answered first.
 
 - UNKNOWN whether the GB10 or the HDA0 audio device attempts DMA while no OS drives them, after SMMUv3 B is left
   enabled with every stream aborting until the next reset. An abort there is recorded as an event, not acted on.
+  Checked 2026-10-12 against the code (`native/kernel/core/smmu_svc.c`, the unconfine path): the kernel drains the
+  event queue only while unconfining, and counts only events for the stream being unconfined; after the probe no
+  event is read. So a later GB10 or HDA0 abort would NOT appear on screen in this window. It is not answered by the
+  Spark user guide either (DOCS SILENT); the window records only what the screen shows. Answering it needs a later
+  probe build that reads and prints the event queue before the final report (a P07 item), not a change to this one.
 - UNVERIFIED that the Spark's real IORT routes segment 15 rid 0x100 to instance 1; this is the expectation from
   decoded tables (`GB10_IORT_DECODE.md` sections 3 and 9), and the first thing the window tests.
 - UNVERIFIED hold time and reset behavior of the probe image on the real console.
@@ -151,5 +163,6 @@ with limits; a physical PASS is claimed only for what was seen.
 ## 10. Statement of non-execution
 
 This page prepares a boot. It is not an authorization. No command in sections 3 or 5 has been run for this campaign
-beyond the host-side QEMU gates already recorded in PR #302, and nothing in it will run on the Spark until Drake has
-opened an attended window and said "go" in it.
+beyond the host-side QEMU gates already recorded in PR #302 and the read-only dry run of the staging script on
+2026-10-12 (it printed its commands and stopped; nothing was built into the ESP, no boot entry was created, `BootNext`
+stayed unset), and nothing in it will run on the Spark until Drake has opened an attended window and said "go" in it.
diff --git a/docs/native/PREFLIGHT-AND-RECOVERY.md b/docs/native/PREFLIGHT-AND-RECOVERY.md
index ebc4ca42..d8cbdc6b 100644
--- a/docs/native/PREFLIGHT-AND-RECOVERY.md
+++ b/docs/native/PREFLIGHT-AND-RECOVERY.md
@@ -49,7 +49,8 @@ refuses the TEST keys:
         CK_OWNER_PUBKEYS=<owner public keys file> CK_MACHINE_ID=<machine id file>
 
 Normally use `scripts/stage_one_time_boot_ck_full.sh --dry-run`, which prints
-every command it would run and touches nothing.
+every command it would run and touches nothing (for the B7b probe boot:
+`scripts/stage_one_time_boot_ck_b7b.sh --dry-run`, same contract).
 
 ## 2. Preflight checklist before any attended boot
 
diff --git a/native/.crumb b/native/.crumb
index 2884e5b8..1d2e5fe4 100644
--- a/native/.crumb
+++ b/native/.crumb
@@ -79,8 +79,8 @@
           "purpose": "Directory native/disk. Purpose not yet described by a human."
         },
         {
-          "digest": "fd5099789ea8d7044949cbad944c1a3a2d8fa4ebd820ab1d6f1c5b05007810f1",
-          "last_commit": "8daa91d",
+          "digest": "0da8cdbe6a21cf428fdf4f163e4bc2e80bcae3e2917a649b8b1c0d8280b425a2",
+          "last_commit": "e01be85",
           "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:4761990bc08d0c36329945919f884b543bbf945b65fa6b5a85c9e9b4f2b6cd8f",
-      "compiled_at": "2026-10-12T04:00:08Z",
+      "children_root": "sha256:0ec3e69bfed1c735f349c6f640f590ef5611da4baaf18b9190ede741dd734cdb",
+      "compiled_at": "2026-10-12T04:51:22Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:0ab785d09f7eab5872d69b17ee8ffe01f169d64fc0dd477f0719e29d6faee7d7",
+      "digest": "sha256:771f766c7b0d59e22e653b67bd60c4f7c8cb068f5ee7220be0e317aa1d385802",
       "evidence_files": 4,
       "evidence_root": "sha256:e410b845507e00568e15b51a5797af32a97e0e4b8ab4e8487bb7c98e7e0cf335",
       "files": 460,
-      "generated_at_commit": "8daa91dcd1e546cae2e8d39fada6d59b759804c3",
-      "source_tree": "sha256:08b3892231de7346823a8554cdf4c4056a54a0a87cb555a28bca19ba2a1087e5"
+      "generated_at_commit": "e01be85155f959705f2534cf07a7b66a03567404",
+      "source_tree": "sha256:32b067f8cdec9462a479dd2c21816ca93c6f6d83da4d7e93541b4807f250888b"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/kernel/.crumb b/native/kernel/.crumb
index f92d63f6..c5916675 100644
--- a/native/kernel/.crumb
+++ b/native/kernel/.crumb
@@ -58,7 +58,7 @@
         },
         {
           "digest": "6c183da30a2362e1e5c86b485cc6f6be46cfe9a9e30960f8f395e47659b18d42",
-          "last_commit": "8daa91d",
+          "last_commit": "adb4dd0",
           "name": "core",
           "purpose": "Directory native/kernel/core. Purpose not yet described by a human."
         },
@@ -70,7 +70,7 @@
         },
         {
           "digest": "bad996a1149ddaa6a4404ac97b147414f8df3b376d9f403d9bca7b0ea72a4e9c",
-          "last_commit": "8daa91d",
+          "last_commit": "adb4dd0",
           "name": "include",
           "purpose": "Directory native/kernel/include. Purpose not yet described by a human."
         },
@@ -82,13 +82,13 @@
         },
         {
           "digest": "97067439083188400b87693964d28f9a06fb8b6cf3ff1271c4016ecbe80e5133",
-          "last_commit": "8daa91d",
+          "last_commit": "adb4dd0",
           "name": "svc",
           "purpose": "Directory native/kernel/svc. Purpose not yet described by a human."
         },
         {
           "digest": "c1ffd88afd48fbef6e14bcec2a9c1318e372ab31c01481f3fb60a8ed0b04a6e1",
-          "last_commit": "8daa91d",
+          "last_commit": "adb4dd0",
           "name": "tests",
           "purpose": "Directory native/kernel/tests. Purpose not yet described by a human."
         },
@@ -100,14 +100,14 @@
         }
       ],
       "children_root": "sha256:5cc12ebd8eba25b26b0dc719d258803dd234004d199c22427d41e9c53fa63725",
-      "compiled_at": "2026-10-12T04:00:08Z",
+      "compiled_at": "2026-10-12T04:51:22Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:fd5099789ea8d7044949cbad944c1a3a2d8fa4ebd820ab1d6f1c5b05007810f1",
+      "digest": "sha256:0da8cdbe6a21cf428fdf4f163e4bc2e80bcae3e2917a649b8b1c0d8280b425a2",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 296,
-      "generated_at_commit": "8daa91dcd1e546cae2e8d39fada6d59b759804c3",
-      "source_tree": "sha256:a5866f1308a2b86c92c89d410e332e90e781a7b188265dd566f7f4d34359bb65"
+      "generated_at_commit": "e01be85155f959705f2534cf07a7b66a03567404",
+      "source_tree": "sha256:65549349df470cfc371e44ef52ec3338a8c22ad153aed5738cdd62cca093e622"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/kernel/README.md b/native/kernel/README.md
index 6188d887..9f82c6c7 100644
--- a/native/kernel/README.md
+++ b/native/kernel/README.md
@@ -237,7 +237,9 @@ hardware image, `scripts/stage_one_time_boot_ck_full.sh` (`--dry-run` prints
 every command and touches nothing; `--apply` builds `make full
 CK_HARDWARE_STAGING=1` with the operator's own owner files, copies it to
 `\EFI\AIENOS\aienos-ck-full.efi`, and sets BootNext once; it never
-reboots). Do not run it yet: until the SMMU service accepts the Spark IORT,
+reboots). The B7b probe boot has its own variant,
+`scripts/stage_one_time_boot_ck_b7b.sh` (adds `CK_B7B_PROBE=1`, builds
+twice and refuses on a digest mismatch, stages `aienos-ck-b7b.efi`). Do not run it yet: until the SMMU service accepts the Spark IORT,
 the run can only show the fail-closed deny lines above, not a keyboard.
 The steps below are the procedure that run will follow, so it can be
 reviewed now.
diff --git a/scripts/.crumb b/scripts/.crumb
index d711f3a3..eddc6136 100644
--- a/scripts/.crumb
+++ b/scripts/.crumb
@@ -7,14 +7,14 @@
     "generated": {
       "children": [],
       "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "compiled_at": "2026-10-12T04:00:08Z",
+      "compiled_at": "2026-10-12T04:51:22Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:9fac5e2c6ace7bf64f1773b6da11b091ec82d394f285baad457758435df36f98",
+      "digest": "sha256:220b980dcb68f58f243c7334f554634ff22438a535a770bee491dd57f0f8dc69",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "files": 81,
-      "generated_at_commit": "8daa91dcd1e546cae2e8d39fada6d59b759804c3",
-      "source_tree": "sha256:0736d952a514f1142055a7057ead3db0bc952bdcc1ba333bb7935a7c2008be34"
+      "files": 82,
+      "generated_at_commit": "e01be85155f959705f2534cf07a7b66a03567404",
+      "source_tree": "sha256:a3de6543e6481e3f074dc558bbc871c7cec34731fdd5381beb4efd02b9ff3811"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/scripts/stage_one_time_boot_ck_b7b.sh b/scripts/stage_one_time_boot_ck_b7b.sh
new file mode 100755
index 00000000..5aaa5c80
--- /dev/null
+++ b/scripts/stage_one_time_boot_ck_b7b.sh
@@ -0,0 +1,271 @@
+#!/usr/bin/env bash
+# Stage the B7b PROBE build of the FULL C kernel hardware image (native/kernel
+# `make full CK_B7B_PROBE=1 CK_HARDWARE_STAGING=1`) on Machine 1 for exactly
+# one attended boot: the B7b campaign (aienos#286, docs/campaigns/
+# B7B-PHYSICAL-BOOT-PREP.md, go/no-go item G7). Variant of
+# scripts/stage_one_time_boot_ck_full.sh; the only differences are the probe
+# flag, the double build with digest comparison, the probe image checks and
+# the names (output folder, ESP file, boot-entry label, record, evidence dir).
+#
+#   scripts/stage_one_time_boot_ck_b7b.sh --dry-run   print every command, touch nothing
+#   scripts/stage_one_time_boot_ck_b7b.sh --apply     do it (needs sudo; operator only)
+#
+# Exactly one of the two is required; there is no default mode.
+#
+# What the probe image does on the Spark (core/smmu_svc.c ck_b7b_probe, run in
+# kmain before the device stages): confine PCI segment 15 requester 0x100 (the
+# GB10) once on a one-page window on SMMUv3 instance 1, read SMMU_IDR0/IDR1,
+# unconfine, print AIENOS_B7B_PROBE: CONFINED_AND_RELEASED (or REFUSED / FAIL),
+# then continue through the normal full-image stages (xHCI keyboard, recovery
+# access hook, NVMe, Store: the Store refuses, production key source
+# BLOCKED_OPERATOR) to the final report and the reset. No device moves data
+# for the probe; the GPU is not programmed. Expected lines: docs/
+# GB10_IORT_DECODE.md section 10 (expected, not observed).
+#
+# Owner files (the hardware staging image refuses the TEST Store keys and
+# TEST machine id; native/kernel/README.md, "Owner provisioning"):
+#   AIENOS_OWNER_PUBKEYS=<owner public keys file>
+#   AIENOS_MACHINE_ID=<machine id file>
+# The labelled TEST-FIXTURE files under native/kernel/tests/fixtures/owner/
+# are refused here: they are for build checks, not for a boot.
+#
+# --dry-run runs only read-only probes (git, findmnt, lsblk, efibootmgr
+# without arguments, the Secure Boot variable) and prints every command
+# --apply would run, in order. It builds nothing, writes nothing, creates no
+# file or directory, and calls no sudo.
+#
+# --apply, in order:
+#   1. builds the probe hardware staging image TWICE, in two output folders,
+#      with CK_FB_HOLD_S=120 (the last report stays on screen for two minutes
+#      before the reset), and STOPs unless the two digests are equal (the
+#      reproducibility check of docs/native/PREFLIGHT-AND-RECOVERY.md
+#      section 1, done here because scripts/ck_repro_build.sh does not build
+#      staging images); checks the image carries the probe for segment 15,
+#      the platform xHCI discovery and the recovery hook, and no TEST marker;
+#   2. sudo scripts/verify_native_rollback.sh --capture-pre (before BootNext,
+#      which the capture requires absent);
+#   3. copies the image to \EFI\AIENOS on the ESP (the only scratch
+#      directory, docs/NATIVE_BOOT_ONE_TIME.md invariant 4) with a
+#      STAGED-CK-B7B.TXT record;
+#   4. creates a boot entry WITHOUT adding it to BootOrder (BootOrder is
+#      restored if anything changed it), checks that Boot0004 AIENOSRECOV is
+#      still there, and sets BootNext once.
+#
+# It never reboots. The firmware consumes BootNext on that boot, so the next
+# boot after it returns to the normal BootOrder (Linux). The boot itself is
+# attended: Drake at the machine, AIENOSRECOV stick inserted (Boot0004),
+# camera on, witness present (B7B-PHYSICAL-BOOT-PREP.md sections 2 to 5).
+#
+# Carried unknowns (B7B-PHYSICAL-BOOT-PREP.md section 8), unchanged by this
+# script: whether the GB10 or HDA0 attempts DMA while SMMUv3 B stays enabled
+# with every stream aborting; whether the real IORT routes segment 15 rid
+# 0x100 to instance 1. The screen hold and reset of the probe image are the
+# full image's own (the probe returns to kmain and the normal final report
+# and reset follow), so they are expected to match the full image; UNVERIFIED
+# on the real console until the window.
+# No Python.
+set -euo pipefail
+
+repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+cd "${repo_root}"
+
+mode=""
+case "${1:-}" in
+    --dry-run) mode=dry ;;
+    --apply) mode=apply ;;
+    *) echo "usage: $0 --dry-run | --apply" >&2; exit 2 ;;
+esac
+[[ $# -eq 1 ]] || { echo "usage: $0 --dry-run | --apply" >&2; exit 2; }
+
+disk="/dev/nvme0n1"
+esp="/boot/efi"
+owner_pubkeys="${AIENOS_OWNER_PUBKEYS:-}"
+machine_id="${AIENOS_MACHINE_ID:-}"
+out="${repo_root}/target/native-kernel-b7b-staging"
+out_b="${out}-build-b"
+image="${out}/full-hardware-staging/BOOTAA64.EFI"
+image_b="${out_b}/full-hardware-staging/BOOTAA64.EFI"
+loader='\EFI\AIENOS\aienos-ck-b7b.efi'
+label="AIENOS C kernel B7b probe (one-time)"
+recov_entry="0004"
+recov_label="AIENOSRECOV"
+hold_s=120
+secure_boot_var="/sys/firmware/efi/efivars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c"
+stamp="$(date -u +%Y%m%dT%H%M%SZ)"
+evidence_dir="${AIENOS_STAGE_OUT:-${HOME}/workspace/evidence-out/B7B/staging}/${stamp}"
+
+stops=()
+stop() { stops+=("$*"); echo "STOP: $*"; }
+
+# Print a command; run it only with --apply.
+run() {
+    printf '+'
+    printf ' %q' "$@"
+    printf '\n'
+    [[ "${mode}" == apply ]] || return 0
+    "$@"
+}
+
+echo "mode: ${mode}"
+
+# ---- read-only pre-flight ----
+if [[ -n "$(git status --porcelain)" ]]; then
+    stop "the checkout has uncommitted changes; the boot must map to one exact commit"
+fi
+commit="$(git rev-parse HEAD)"
+echo "commit:        ${commit}"
+
+for f in owner_pubkeys machine_id; do
+    v="${!f}"
+    if [[ -z "${v}" ]]; then
+        stop "${f} file not given (set AIENOS_OWNER_PUBKEYS and AIENOS_MACHINE_ID)"
+    elif [[ ! -f "${v}" ]]; then
+        stop "${f} file not found: ${v}"
+    elif [[ "$(basename "${v}")" == TEST-FIXTURE* ]]; then
+        stop "${f} is a labelled TEST-FIXTURE file (${v}); a boot needs the operator's own file"
+    else
+        v="$(realpath -- "${v}")" # make -C native/kernel resolves relative paths from there
+        printf -v "${f}" %s "${v}"
+        echo "${f}: ${v}"
+    fi
+done
+
+esp_dev="$(findmnt -no SOURCE "${esp}" 2>/dev/null || true)"
+esp_opts="$(findmnt -no OPTIONS "${esp}" 2>/dev/null || true)"
+[[ -n "${esp_dev}" ]] || stop "the ESP is not mounted at ${esp}"
+esp_disk="/dev/$(lsblk -no PKNAME "${esp_dev}" 2>/dev/null | head -1)"
+esp_part="$(cat "/sys/class/block/$(basename "${esp_dev:-none}")/partition" 2>/dev/null || true)"
+echo "esp:           ${esp_dev:-?} partition ${esp_part:-?} of ${esp_disk} (${esp_opts%%,*})"
+[[ "${esp_disk}" == "${disk}" ]] || stop "the ESP is not on ${disk}"
+[[ ",${esp_opts}," == *",rw,"* ]] || stop "the ESP is not mounted read-write"
+
+if [[ -r "${secure_boot_var}" ]] && [[ "$(od -An -t u1 -j 4 -N 1 "${secure_boot_var}" | tr -d ' ')" == "1" ]]; then
+    stop "Secure Boot is enabled; the firmware will refuse the unsigned C image"
+else
+    echo "secure boot:   off or unreadable (recorded only; development decision 2026-10-01)"
+fi
+
+boot_state="$(efibootmgr 2>/dev/null || true)"
+[[ -n "${boot_state}" ]] || stop "efibootmgr gave no output"
+order_before="$(sed -n 's/^BootOrder: //p' <<<"${boot_state}")"
+current_before="$(sed -n 's/^BootCurrent: //p' <<<"${boot_state}")"
+next_before="$(sed -n 's/^BootNext: //p' <<<"${boot_state}")"
+recov_line="$(grep -E "^Boot${recov_entry}\*? " <<<"${boot_state}" || true)"
+echo "BootCurrent:   ${current_before}"
+echo "BootOrder:     ${order_before} (never changed)"
+[[ -z "${next_before}" ]] || stop "BootNext is already set (${next_before}); another staging is pending"
+if [[ "${recov_line}" == *"${recov_label}"* ]]; then
+    echo "recovery:      Boot${recov_entry} ${recov_label} present (kept untouched)"
+else
+    stop "Boot${recov_entry} ${recov_label} not present: insert the recovery stick and check docs/RECOVERY_MEDIA_MACHINE1.md (got: '${recov_line:-none}')"
+fi
+existing="$(sed -n "s/^Boot\([0-9A-F]\{4\}\)\*\{0,1\} ${label}.*/\1/p" <<<"${boot_state}" | head -1)"
+echo "boot entry:    '${label}' ${existing:+exists as Boot${existing}}${existing:-will be created (create-only, not in BootOrder)}"
+echo "evidence:      ${evidence_dir}"
+echo "screen hold:   ${hold_s} s before the reset (CK_FB_HOLD_S)"
+
+if [[ "${mode}" == apply && ${#stops[@]} -gt 0 ]]; then
+    echo "STOPPED before touching anything: ${#stops[@]} pre-flight problem(s) above."
+    exit 1
+fi
+
+echo
+echo "commands (--apply runs them in this order; --dry-run only prints them):"
+
+# ---- 1. build, twice, and compare (the probe image's reproducibility check) ----
+cross=""
+[[ "$(uname -m)" == aarch64 ]] || cross="aarch64-linux-gnu-"
+for o in "${out}" "${out_b}"; do
+    run make -s -C native/kernel CROSS="${cross}" OUT="${o}" AIENOS_COMMIT="${commit}" full \
+        CK_B7B_PROBE=1 CK_HARDWARE_STAGING=1 \
+        CK_OWNER_PUBKEYS="${owner_pubkeys:-<owner pubkeys file>}" \
+        CK_MACHINE_ID="${machine_id:-<machine id file>}" CK_FB_HOLD_S="${hold_s}"
+done
+if [[ "${mode}" == apply ]]; then
+    digest="$(sha256sum "${image}" | cut -d' ' -f1)"
+    digest_b="$(sha256sum "${image_b}" | cut -d' ' -f1)"
+    [[ "${digest}" == "${digest_b}" ]] \
+        || { echo "STOP: the two probe builds differ (${digest} vs ${digest_b}); the image is not reproducible"; exit 1; }
+    grep -aqF "b7b_probe: start segment=" "${image}" || { echo "STOP: the image carries no B7b probe"; exit 1; }
+    grep -aqF "screen: gop " "${image}" || { echo "STOP: the image has no screen console"; exit 1; }
+    grep -aqF "xhci_acpi: " "${image}" || { echo "STOP: the image has no platform xHCI discovery"; exit 1; }
+    grep -aqF "recovery_access: " "${image}" || { echo "STOP: the image has no recovery access hook"; exit 1; }
+    for m in "TEST-ONLY" "TEST Store" "TEST machine id" "segment 0"; do
+        if grep -aqF "${m}" "${image}"; then echo "STOP: the image carries a TEST marker (${m})"; exit 1; fi
+    done
+    echo "image sha256:  ${digest} (build A and build B equal)"
+else
+    echo "+ (compare the two digests: STOP if they differ)"
+    echo "+ (check the image: B7b probe for segment 15, screen console, xhci_acpi discovery and recovery_access present; no TEST-ONLY, TEST Store, TEST machine id or segment 0 marker)"
+    digest="(computed after the build)"
+    digest_b="(computed after the build)"
+fi
+# ---- 2. pre-boot capture (BootNext still absent) ----
+run mkdir -p "${evidence_dir}"
+run sudo scripts/verify_native_rollback.sh --capture-pre "${evidence_dir}/pre_boot_capture.json"
+
+# ---- 3. ESP scratch directory \EFI\AIENOS ----
+record="${evidence_dir}/STAGED-CK-B7B.TXT"
+if [[ "${mode}" == apply ]]; then
+    cat >"${record}" <<EOF
+aienos_commit: ${commit}
+image: C kernel B7b probe hardware staging image (make full CK_B7B_PROBE=1 CK_HARDWARE_STAGING=1), CK_FB_HOLD_S=${hold_s}
+image_sha256_build_b: ${digest_b}
+probe: PCI segment 15 requester 0x100 on SMMUv3 instance 1, one page, no DMA
+image_sha256: ${digest}
+owner_pubkeys_sha256: $(sha256sum "${owner_pubkeys}" | cut -d' ' -f1)
+machine_id_sha256: $(sha256sum "${machine_id}" | cut -d' ' -f1)
+staged_by: ${AIEN_AGENT_ID:-${USER:-unknown}}
+staged_at_utc: ${stamp}
+boot_current_before: ${current_before}
+boot_order_before: ${order_before}
+recovery_entry: Boot${recov_entry} ${recov_label}
+linux_kernel_before: $(uname -r)
+EOF
+else
+    echo "+ (write ${record}: commit, image and owner file digests, prior boot state)"
+fi
+run sudo install -D -m 0644 "${image}" "${esp}/EFI/AIENOS/aienos-ck-b7b.efi"
+
+# ---- 4. one-time boot entry ----
+entry="${existing}"
+if [[ -z "${entry}" ]]; then
+    run sudo efibootmgr --quiet --create-only --disk "${disk}" --part "${esp_part:-<esp partition>}" \
+        --label "${label}" --loader "${loader}"
+    if [[ "${mode}" == apply ]]; then
+        entry="$(efibootmgr | sed -n "s/^Boot\([0-9A-F]\{4\}\)\*\{0,1\} ${label}.*/\1/p" | head -1)"
+        [[ -n "${entry}" ]] || { echo "STOP: the boot entry was not created"; exit 1; }
+    fi
+fi
+entry="${entry:-NNNN}"
+[[ "${entry}" != "${recov_entry}" ]] || { echo "STOP: the new entry took the recovery entry's number"; exit 1; }
+if [[ "${mode}" == apply ]]; then
+    order_after="$(efibootmgr | sed -n 's/^BootOrder: //p')"
+    if [[ "${order_after}" != "${order_before}" ]]; then
+        run sudo efibootmgr --quiet --bootorder "${order_before}"
+    fi
+    efibootmgr | grep -qE "^Boot${recov_entry}\*? .*${recov_label}" \
+        || { echo "STOP: Boot${recov_entry} ${recov_label} is gone; BootNext NOT set"; exit 1; }
+    echo "aienos_boot_entry: ${entry}" >>"${record}"
+else
+    echo "+ (only if BootOrder changed: sudo efibootmgr --quiet --bootorder ${order_before})"
+    echo "+ (check Boot${recov_entry} ${recov_label} still present, else stop before BootNext)"
+fi
+run sudo install -m 0644 "${record}" "${esp}/EFI/AIENOS/STAGED-CK-B7B.TXT"
+run sudo efibootmgr --quiet --bootnext "${entry}"
+
+echo
+if [[ "${mode}" == dry ]]; then
+    if [[ ${#stops[@]} -gt 0 ]]; then
+        echo "Dry run: nothing touched. --apply would STOP now on ${#stops[@]} pre-flight problem(s) above."
+    else
+        echo "Dry run: nothing touched. Pre-flight clean; --apply would stage the boot above."
+    fi
+    exit 0
+fi
+cat "${record}"
+efibootmgr | sed -n '1,4p'
+echo "Staged: the next boot runs Boot${entry} once. Nothing was rebooted."
+echo "Reboot only with the operator at the machine and the ${recov_label} stick inserted."
+echo "After the return to Linux: sudo scripts/verify_native_rollback.sh --capture-post ${evidence_dir}/post_boot_capture.json,"
+echo "then --pre ${evidence_dir}/pre_boot_capture.json --post ${evidence_dir}/post_boot_capture.json --verify; write the screen lines next to the record."