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

closed derived 5690118042e32479 #271

Imported from GitHub aien-dev/aienux#271 (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 3df181c0d11a69dd3d6f3bd863e6f0bb746747a3 · Head 5b3111d816ba45a2c6d72e5ad5954831753e24a6

Apply it

git checkout -b patch-5690118042e32479 3df181c0d11a69dd3d6f3bd863e6f0bb746747a3
curl -fsSL https://interplane.io/drakestapleton/aienux/patches/5690118042e32479.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
271
5b3111d816ba45a2c6d72e5ad5954831753e24a6
{"kind":"github-import","owner":"aien-dev","repo":"aienux","number":271,"url":"https://github.com/aien-dev/aienux/pull/271","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:06Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.crumb b/.crumb
index d686c65e..04af6382 100644
--- a/.crumb
+++ b/.crumb
@@ -27,14 +27,14 @@
           "purpose": "Directory crates. Purpose not yet described by a human."
         },
         {
-          "digest": "d2b7dc151c8acb7896ad59cb1bf525b7a380502eda063a9dc24bc83d60d76d07",
-          "last_commit": "2058747",
+          "digest": "5e5be67d1fbe4c9cff1c82bc2771db42450873d04037ef608917e5167359df13",
+          "last_commit": "5836561",
           "name": "docs",
           "purpose": "Directory docs. Purpose not yet described by a human."
         },
         {
           "digest": "824c5b5926f18ffae7c3f46491ce3bd78758f79ca9fdcb4f6c59b1fadff785f2",
-          "last_commit": "9e69692",
+          "last_commit": "3df181c",
           "name": "native",
           "purpose": "Directory native. Purpose not yet described by a human."
         },
@@ -45,15 +45,15 @@
           "purpose": "Directory scripts. Purpose not yet described by a human."
         }
       ],
-      "children_root": "sha256:acdb2f8786b6d63a8e9ac868ed7cfbb6300a4604aa3a722ffccba0261a759339",
-      "compiled_at": "2026-10-06T11:55:32Z",
+      "children_root": "sha256:f059835856e5f9c2aeb2f0a7266eaae5f072eafee9357045ae79d1209ac0f765",
+      "compiled_at": "2026-10-06T14:19:06Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:e5dbf729258b2676a12ae09de0823c3bc6e777941820efa7213004ab9d7dfac4",
+      "digest": "sha256:3a0361c7d2a632de8d1f78a7ee4b077313a8fae5a57131123428acf26b77d450",
       "evidence_files": 152,
       "evidence_root": "sha256:a74ab9a4f344734b1737c5c8f029eeec57f10340cf251cf0484903f158c3f418",
-      "files": 2874,
-      "generated_at_commit": "788425caf3125f809254efb433fd5bc036eb6a59",
-      "source_tree": "sha256:0e32a7f299bc4df9090755493ef97ec0a5189fc6879217032e5c16012f95ba6f"
+      "files": 2875,
+      "generated_at_commit": "58365612acf1272e4f3f39a91734b77e5fc53a95",
+      "source_tree": "sha256:033d106e89a54ecafc7d14de630ae5f34123e487f10ec5697009b0845401083a"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/docs/.crumb b/docs/.crumb
index c48bb0ee..848cc2ad 100644
--- a/docs/.crumb
+++ b/docs/.crumb
@@ -30,14 +30,14 @@
         }
       ],
       "children_root": "sha256:25a2af14107c1c2ae96916dd5c4086195ebd4117975ea0ae458855ac21f46099",
-      "compiled_at": "2026-10-05T19:19:49Z",
+      "compiled_at": "2026-10-06T14:19:06Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:d2b7dc151c8acb7896ad59cb1bf525b7a380502eda063a9dc24bc83d60d76d07",
+      "digest": "sha256:5e5be67d1fbe4c9cff1c82bc2771db42450873d04037ef608917e5167359df13",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "files": 59,
-      "generated_at_commit": "6bbd3c685159e4c4db1bb45fdcf6f40c03c0d0a2",
-      "source_tree": "sha256:eac6b5430f0fafba3178dd56d2f4923f42873a295b545d6aab5c5e724cbda693"
+      "files": 60,
+      "generated_at_commit": "58365612acf1272e4f3f39a91734b77e5fc53a95",
+      "source_tree": "sha256:b1267ad1031b76b866903c9ef09601ae0e88a946c1c619296e04144b2a1e9b78"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/docs/native/PREFLIGHT-AND-RECOVERY.md b/docs/native/PREFLIGHT-AND-RECOVERY.md
new file mode 100644
index 00000000..0b5818a6
--- /dev/null
+++ b/docs/native/PREFLIGHT-AND-RECOVERY.md
@@ -0,0 +1,112 @@
+# Native AIENOS: preflight and recovery for an attended Spark boot
+
+Status: NOT A MASTER PLAN. A checklist and a procedure, nothing more. Nothing in
+the change that adds this page runs on the physical Spark. Every PASS cited in
+the repo for the C kernel is QEMU only, not physical (`native/kernel/GATES.md`).
+
+Related, read first: `docs/NATIVE_BOOT_ONE_TIME.md` (the one-time BootNext
+procedure and its invariants), `docs/NATIVE_BOOT_ROLLBACK_CONTRACT.md`
+(rollback rules), `docs/RECOVERY_MEDIA_MACHINE1.md` (the recovery stick),
+`docs/BOOT_HANDOFF_CONTRACT.md` section 7 (why there are no A/B slots).
+
+## 0. Which "slot": there is none
+
+The operator decision Q3 (ADR 0024) says the loader gets no A/B slots. The
+"slot" is the firmware's one-time BootNext entry (the candidate) against the
+unchanged BootOrder (Linux, Boot0001). A candidate gets one attempt. The next
+boot is Linux again, whatever happened. Boot counters would need a loader that
+reads and writes state, which Q3 freezes (see "Open decision" at the end).
+
+## 1. Reproducible image build (host, no Spark involvement)
+
+Run on any aarch64 or cross-capable Linux host, from a clean checkout:
+
+    git status --porcelain            # must print nothing
+    commit=$(git rev-parse HEAD)
+    make -s -C native/kernel OUT=/tmp/ck-a AIENOS_COMMIT="$commit" full
+    make -s -C native/kernel OUT=/tmp/ck-b AIENOS_COMMIT="$commit" full
+    sha256sum /tmp/ck-a/BOOTAA64.EFI /tmp/ck-b/BOOTAA64.EFI
+
+Expected: the two digests are equal for the same commit (UNVERIFIED: this was
+not built when this page was written, the machine was held quiet by another
+run). The digest changes with every commit because the commit hash is built
+into the image, so no single digest can be written down in advance. The
+digest of the image that is actually staged is printed by the kernel itself on
+the recovery console (`recovery_console: identity build_sha256=<64 hex>
+commit=<commit>`) and recorded by the stage script. Compare the two.
+
+The hardware staging image (the only one for the Spark) needs owner files and
+refuses the TEST keys:
+
+    make -C native/kernel full CK_HARDWARE_STAGING=1 \
+        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.
+
+## 2. Preflight checklist before any attended boot
+
+All of these are read-only checks. Stop at the first one that fails.
+
+1. Drake is at the machine, with a display and keyboard attached. (Drake's
+   physical presence and fresh go-ahead are required; see section 5.)
+2. The recovery stick `AIENOSRECOV` is plugged in and listed as `Boot0004`
+   (`efibootmgr` with no arguments). If it is absent, stop.
+3. Secure Boot state: record it. As of 2026-10-01 it is OFF for development by
+   owner decision, and it is recorded, not changed. A release candidate needs it
+   ON. Never flip it as part of this procedure: flipping changes the TPM
+   measurement and can lock the private storage volumes
+   (`docs/NATIVE_BOOT_ONE_TIME.md`, historical warning).
+4. `BootOrder` is the normal one (Linux first, `0001`) and `BootNext` is unset.
+5. The working tree is clean and its commit equals the commit the image was
+   built from; the image digest from section 1 is written down.
+6. Which "slot": the candidate will be the one-time BootNext entry. Linux stays
+   the permanent default.
+7. The pre-boot capture runs first (`scripts/verify_native_rollback.sh
+   --capture-pre`); the stage script does this itself.
+8. No other session holds the machine quiet for its own hardware test.
+
+## 3. Getting back to Linux
+
+Normal return: do nothing. Firmware deletes BootNext before it starts the
+candidate, so any reset or power-cycle (hold the chassis power button, wait,
+press again) boots the next BootOrder entry, which is Linux. If the candidate
+hangs, wait 60 seconds, then power-cycle.
+
+## 4. Recovery procedure if Linux does not come back
+
+1. At power-on, press the firmware boot-menu key (F11 or the firmware's own
+   hotkey) and pick `AIENOSRECOV` (Boot0004). It runs entirely from RAM.
+2. Mount the internal root and the EFI partition read-only and run the
+   packaged collector exactly as in `docs/RECOVERY_MEDIA_MACHINE1.md`
+   ("Inspect internal storage read-only", "Capture the recovery evidence").
+3. Only with a separate fresh authorization from Drake: repair, or remove the
+   staged files in `\EFI\AIENOS` on the EFI partition. Never edit BootOrder
+   from the stick without that authorization.
+4. After Linux is back: `sudo scripts/verify_native_rollback.sh --pre ...
+   --post ... --verify` (the ten invariants in `docs/NATIVE_BOOT_ONE_TIME.md`).
+
+## 5. What needs Drake's physical action and fresh authorization
+
+Each of these needs Drake present and a new go-ahead for that boot. A past
+approval does not carry over:
+
+- plugging in or removing the recovery stick or any USB stick;
+- any firmware (BIOS) setting, including Secure Boot;
+- any reboot or power-cycle of the Spark;
+- running `--apply` of any stage script (it writes to the EFI partition and
+  sets BootNext);
+- pressing keys at the recovery prompt, and any repair in section 4 step 3.
+
+An agent may do the host-side parts: build the image, run the dry-run, run QEMU
+gates. Nothing in this change was run on the physical Spark.
+
+## Open decision (not made here)
+
+A boot-count A/B scheme with automatic fallback after N failed boots is not
+implemented and not specified here. The accepted spec forbids slots in this
+loader (Q3, ADR 0024; `docs/BOOT_HANDOFF_CONTRACT.md` section 7: "the handoff
+record carries no rollback state, and never will"). Doing it needs Drake to
+reopen Q3 first. The existing one-time BootNext rollback is proven in QEMU
+(M0_NATIVE_ROLLBACK_QEMU), and M0_ROLLBACK for the C image is
+MISSING_IMPLEMENTATION until the rows in section 7.1 of that contract are built.