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

closed derived 5a4fbcb4d9957324 #348

Imported from GitHub aien-dev/aienux#348 (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 0af06ebdd5799e4976fa109e8c340011cf4c8d9b · Head dad6a8eb88918d64df22de343d9a51eb112ceca2

Apply it

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

Changes

diff --git a/.crumb b/.crumb
index 7f83664f..5cd333aa 100644
--- a/.crumb
+++ b/.crumb
@@ -33,27 +33,27 @@
           "purpose": "Directory docs. Purpose not yet described by a human."
         },
         {
-          "digest": "f6dacf501f99cc29eabd70f9baa5f6bfe7ae76ee224a5e7f5094bf95f1668371",
-          "last_commit": "e262a06",
+          "digest": "3dbd76762cec64c2a59d7fc313a39e186bf4a5939276db8ab271d9f7d276792a",
+          "last_commit": "291917b",
           "name": "native",
           "purpose": "Directory native. Purpose not yet described by a human."
         },
         {
-          "digest": "197bb0910cb0164678c40a278c02240cd8f147d407d2322be38ce7a66289316e",
-          "last_commit": "e262a06",
+          "digest": "edbbdde42da02e5b95aede8b2be3541b22dad6dc44f49c33aab1744653769801",
+          "last_commit": "d7e27e9",
           "name": "scripts",
           "purpose": "Directory scripts. Purpose not yet described by a human."
         }
       ],
-      "children_root": "sha256:3ef11bc2637d50d288ed541ccd6f00c461d1480632f1af0497def463c28982db",
-      "compiled_at": "2026-10-13T10:40:53Z",
+      "children_root": "sha256:3ce09a0619073434ee39c008ba6b6baeef101ebdf40b7a77a08460f4d9a5c525",
+      "compiled_at": "2026-10-13T10:54:06Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:a9251aae38cf18df59e05016cedfac798972f878842bcfb63d5904525f41d1b4",
+      "digest": "sha256:a344e56fbe6722077a1af4bb92a827ef8e18261104904ba4298c24d25fa2f941",
       "evidence_files": 156,
       "evidence_root": "sha256:cd53ab119be9de6ce28c4f5949b106c9622f1fe105611de3de21c3bce7932694",
-      "files": 3140,
-      "generated_at_commit": "e262a060d0b6be8436bbd5507cd3619edbf449b2",
-      "source_tree": "sha256:e61d5450cc819cb4c9f2d38f1654e3e329ece2009d5bb23a81cbc490f7c30372"
+      "files": 3141,
+      "generated_at_commit": "291917b982b27e07b60cc0a95d880649335ba1e9",
+      "source_tree": "sha256:7ec971f6ce51f1df811af8f4daf5dc8b6f275a650719836bab08f8213e4085b9"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/.crumb b/native/.crumb
index 58d2e027..ef76db68 100644
--- a/native/.crumb
+++ b/native/.crumb
@@ -79,8 +79,8 @@
           "purpose": "Directory native/disk. Purpose not yet described by a human."
         },
         {
-          "digest": "26315dfb3c6aea258c8e786146c9768fcdfcc48fc93b270f4d74add688327909",
-          "last_commit": "16cf1b2",
+          "digest": "93285aa612c474c993243d2881ff86694b56a456cf808e55fa3293e2b320e69a",
+          "last_commit": "291917b",
           "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:7b6572d0cdc9e1fdcd29bfb3f6e8bead19e3e087eb06aabfb3269b2e1d2bed2e",
-      "compiled_at": "2026-10-13T07:56:49Z",
+      "children_root": "sha256:757255e6a66411265b70be97731b1dcf7f367cc191665d608bab3df47ee0358b",
+      "compiled_at": "2026-10-13T10:54:06Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:f6dacf501f99cc29eabd70f9baa5f6bfe7ae76ee224a5e7f5094bf95f1668371",
+      "digest": "sha256:3dbd76762cec64c2a59d7fc313a39e186bf4a5939276db8ab271d9f7d276792a",
       "evidence_files": 4,
       "evidence_root": "sha256:e410b845507e00568e15b51a5797af32a97e0e4b8ab4e8487bb7c98e7e0cf335",
-      "files": 508,
-      "generated_at_commit": "16cf1b2353974f0f22f25fd2fc992d594271a2a7",
-      "source_tree": "sha256:ef0853bbc050a53e6f4b776b44290826c336832a9a27b0ba60647a472787c6ff"
+      "files": 509,
+      "generated_at_commit": "291917b982b27e07b60cc0a95d880649335ba1e9",
+      "source_tree": "sha256:767c0b1cf858ec0a4e636f963fc4dedb91b540d64ca2b01f6b193a89e2152f4f"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/kernel/.crumb b/native/kernel/.crumb
index 5a315759..456bdabd 100644
--- a/native/kernel/.crumb
+++ b/native/kernel/.crumb
@@ -57,14 +57,14 @@
           "purpose": "Directory native/kernel/artifact. Purpose not yet described by a human."
         },
         {
-          "digest": "6d0ed43b6dacbc54818db5b34531768fa2d0acf992e386b488ed66c61be7e3f7",
-          "last_commit": "27f24e8",
+          "digest": "013787d45c47e9445eb44129c28e00cc7508b4481cff9ba2391907cee621bb4d",
+          "last_commit": "291917b",
           "name": "core",
           "purpose": "Directory native/kernel/core. Purpose not yet described by a human."
         },
         {
-          "digest": "7f3dc4d9ecbeba802bd8a3c59514ff336ea615e8aca587c1c998e660abde23c3",
-          "last_commit": "502d168",
+          "digest": "7a4dbeb86004aa667074b4d83ba5f072c9a852f8f8783c7eee1dd6f8411ef6e9",
+          "last_commit": "291917b",
           "name": "dev",
           "purpose": "Directory native/kernel/dev. Purpose not yet described by a human."
         },
@@ -88,7 +88,7 @@
         },
         {
           "digest": "90c571fe56a5ba0d0fc8b68ded88e8006bb1be273725222d6a49c9c4c03ae350",
-          "last_commit": "27f24e8",
+          "last_commit": "e262a06",
           "name": "tests",
           "purpose": "Directory native/kernel/tests. Purpose not yet described by a human."
         },
@@ -99,15 +99,15 @@
           "purpose": "Hosted (Linux-built) checkers for the native kernel, run by `make -C native/kernel test`; nothin"
         }
       ],
-      "children_root": "sha256:f270e5c733f1f2230a1fbcd92d52ca923abcdf121dcdcebd3cadd00afae97c02",
-      "compiled_at": "2026-10-13T07:56:49Z",
+      "children_root": "sha256:136ee5dc2bf043548176307e39343aba22814104643eb638f13112aa3dd309e0",
+      "compiled_at": "2026-10-13T10:54:06Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:26315dfb3c6aea258c8e786146c9768fcdfcc48fc93b270f4d74add688327909",
+      "digest": "sha256:93285aa612c474c993243d2881ff86694b56a456cf808e55fa3293e2b320e69a",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "files": 331,
-      "generated_at_commit": "16cf1b2353974f0f22f25fd2fc992d594271a2a7",
-      "source_tree": "sha256:75486b99242892b6c2dd39f783caa7598fb73f1e1505f1ef5c942af5c4c99e91"
+      "files": 332,
+      "generated_at_commit": "291917b982b27e07b60cc0a95d880649335ba1e9",
+      "source_tree": "sha256:e8d601645e6cab6d79ee867d748f75a1dc45a049889fff7e547f5888ff4d5ad4"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/kernel/Makefile b/native/kernel/Makefile
index 6b4604be..eda62d47 100644
--- a/native/kernel/Makefile
+++ b/native/kernel/Makefile
@@ -138,6 +138,18 @@ HOSTCC ?= cc
 # UEFI stub's KLOG.MAP reader (native/boot/efi_klog.c). Own OUT, so it never
 # replaces a default image. Not for the Spark or QEMU: pi5_wdt.c and pi5.c
 # touch BCM2712-only addresses and refuse to build without CK_PI5.
+CK_PI5_STORE ?=
+ifneq ($(strip $(CK_PI5_STORE)),)
+ifneq ($(strip $(CK_PI5_STORE)),1)
+$(error CK_PI5_STORE must be empty or 1)
+endif
+ifneq ($(strip $(CK_SERVICE)$(CK_TEST_STORE_CRASH)$(CK_TEST_CONTINUITY)$(CK_HARDWARE_STAGING)),)
+$(error CK_PI5_STORE is the TEST-key qualification tier (SEED-0B-PI5): it cannot be combined with CK_SERVICE, CK_TEST_STORE_CRASH, CK_TEST_CONTINUITY or CK_HARDWARE_STAGING)
+endif
+CK_PI5 := 1
+OUT ?= $(REPO)/target/native-kernel-pi5-store
+CK_EXTRA_CFLAGS += -DCK_PI5_STORE=1
+endif
 CK_PI5 ?=
 ifneq ($(strip $(CK_PI5)),)
 ifneq ($(strip $(CK_PI5)),1)
@@ -764,6 +776,17 @@ ifeq ($(strip $(CK_TEST_DISK_XLATE_BYPASS)),1)
 FULL_NAME := $(FULL_NAME)-test-xlate-bypass
 STAGE_DMA_FLAGS += -DCK_TEST_DISK_XLATE_BYPASS=1
 endif
+# AIENOS-PI5 step 3b: the sealed Store stage on the Pi card, in the TEST-key qualification tier
+# (SEED-0B-PI5, the Pi counterpart of the QEMU full image). Only the Store stage and what it needs
+# are linked: no PCI, NVMe, USB, virtio, SMMU or security stage (none of that hardware is on the
+# Pi path). core/pi5.c supplies ck_dev_boot_disk and ck_dev_nvme_release over the SD partition view.
+FULL_STAGE_SYMS := ck_stage_devices ck_stage_security ck_stage_store ck_stage_quiesce ck_stage_disk_artifacts
+ifeq ($(strip $(CK_PI5_STORE)),1)
+FULL_NAME := full-pi5-store
+FULL_STAGE_SYMS := ck_stage_store ck_stage_disk_artifacts
+STAGE_SRCS := $(KDIR)/svc/store_boot.c $(KDIR)/svc/artifact_store.c $(KDIR)/svc/store_crash.c $(KDIR)/svc/ck_compat.c \
+  $(foreach m,store/store_v1 store/store_engine store/store_disk store/store_sealed store/torn_slot m5/m5_keys m5/m5_envelope m5/m5_state crypto/aes crypto/polyval crypto/gcm_siv crypto/hmac crypto/ct argus/sha256,$(NATIVE)/$(m).c)
+endif
 FULL_OUT := $(OUT)/$(FULL_NAME)
 STAGE_KOBJ := $(OUT)/obj/stage-$(FULL_NAME)
 STAGE_HDRS := $(HDRS) $(wildcard $(NATIVE)/*/*.h $(NATIVE)/argus/bridge/*.h $(KDIR)/svc/compat/*.h)
@@ -1033,7 +1056,7 @@ $(ELF): $(CORE_OBJS) $(BOOT)/image.ld
 $(FULL_ELF): $(CORE_OBJS) $(STAGE_BUILT) $(BOOT)/image.ld
 	$(call link_image,$@,$(CORE_OBJS) $(STAGE_LINK) $(CK_RUST_LIBS) $(CK_INFER_LIB))
 	$(call rollback_check,$@)
-	@for s in ck_stage_devices ck_stage_security ck_stage_store ck_stage_quiesce ck_stage_disk_artifacts; do \
+	@for s in $(FULL_STAGE_SYMS); do \
 	  $(KNM) $@ | grep -qE " [TW] $$s$$" || { echo "full image lacks $$s"; rm -f $@; exit 1; }; done
 	$(call fwcfg_check,$@)
 	$(call owner_check,$@)
@@ -1787,6 +1810,9 @@ $(PI5DIAG_EFI): $(PI5DIAG_ELF)
 pi5-diag: $(PI5DIAG_EFI)
 
 # Raspberry Pi 5 board image (see CK_PI5 above): target/native-kernel-pi5/BOOTAA64.EFI
+pi5-store:
+	$(MAKE) CK_PI5_STORE=1 full
+
 pi5:
 	$(MAKE) CK_PI5=1 all
 
@@ -1827,7 +1853,7 @@ clean:
 
 FORCE:
 .PHONY: uefi-vars slot-loader slot-loader-check pi5-diag
-.PHONY: all full pi5 test sanitize handoff-mutant acpi-dev-mutant iort-mutants smmu-l2-mutants acpi-scan clean print-kcflags udp-echo tool store-image gpt-image cont-tool owner-gen fb-check continuity-mutants continuity-resolve-mutants FORCE
+.PHONY: all full pi5 pi5-store test sanitize handoff-mutant acpi-dev-mutant iort-mutants smmu-l2-mutants acpi-scan clean print-kcflags udp-echo tool store-image gpt-image cont-tool owner-gen fb-check continuity-mutants continuity-resolve-mutants FORCE
 
 # AIENOS-PI5 step 3 marker + Pi card GPT test (hosted; a file stands in for the card, QEMU cannot model the Pi SD host).
 PI5_MARKER_SRCS := $(KDIR)/core/pi5_marker.c $(KDIR)/dev/disk_part.c $(NATIVE)/disk/disk.c $(NATIVE)/disk/disk_file.c \
diff --git a/native/kernel/core/.crumb b/native/kernel/core/.crumb
index b2bd6bdb..6ae5720d 100644
--- a/native/kernel/core/.crumb
+++ b/native/kernel/core/.crumb
@@ -7,14 +7,14 @@
     "generated": {
       "children": [],
       "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "compiled_at": "2026-10-13T07:51:09Z",
+      "compiled_at": "2026-10-13T10:54:06Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:6d0ed43b6dacbc54818db5b34531768fa2d0acf992e386b488ed66c61be7e3f7",
+      "digest": "sha256:013787d45c47e9445eb44129c28e00cc7508b4481cff9ba2391907cee621bb4d",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 53,
-      "generated_at_commit": "27f24e8c3b542611bc086755ba3b5693c2125f30",
-      "source_tree": "sha256:7132acc95cffde6d0b2e2839a5ca2b9272fcbd366c20174003029a65ee116696"
+      "generated_at_commit": "291917b982b27e07b60cc0a95d880649335ba1e9",
+      "source_tree": "sha256:ac011180952e850335f24e61aefa6dfc3315b4cc1f7c6ae6aba2ebe931df9f80"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/kernel/core/artifact_loader.c b/native/kernel/core/artifact_loader.c
index 7551f2d9..298f0724 100644
--- a/native/kernel/core/artifact_loader.c
+++ b/native/kernel/core/artifact_loader.c
@@ -1064,6 +1064,14 @@ static void print_receipt(const char *name, const struct report *r)
  * candidate. A test-only QEMU fw_cfg side channel exists only in images built
  * with CK_TEST_FWCFG_ARTIFACTS=1 and is compiled out of every default image. */
 
+/* Qualification tier label printed in every receipt header. A Pi 5 image is never
+ * the QEMU tier and never production: the label names the board. */
+#ifdef CK_PI5
+#define CK_RECEIPT_TIER "SEED-0B-PI5"
+#else
+#define CK_RECEIPT_TIER "SEED-0B-QEMU"
+#endif
+
 static struct report rep;
 static unsigned run_admitted, run_rejected, run_seen;
 
@@ -1075,9 +1083,9 @@ static void source_preamble(uint32_t count)
     hex(vh, verifier_id, 32);
     hex(ph, pd, 32);
     ck_printf("artifact_candidates: %u\n", count);
-    ck_printf("artifact_receipt_tier: SEED-0B-QEMU\nartifact_verifier_identity: %s\n"
+    ck_printf("artifact_receipt_tier: %s\nartifact_verifier_identity: %s\n"
               "artifact_policy_digest: %s\n",
-              vh, ph);
+              CK_RECEIPT_TIER, vh, ph);
     ck_printf("artifact_frames_free_before: %llu\n", (unsigned long long)free_frames());
 }
 
diff --git a/native/kernel/core/pi5.c b/native/kernel/core/pi5.c
index d8b5f4fa..04ebc59c 100644
--- a/native/kernel/core/pi5.c
+++ b/native/kernel/core/pi5.c
@@ -6,6 +6,12 @@
  *   ck_pi5_before_reset  write the RAM console log (core/klog.c) into the
  *                        card's log slot (core/klog_slot.h), then reset
  *
+ * Limit: the card log is written only on the orderly reset path. A watchdog
+ * expiry (a hang) resets the board without running ck_pi5_before_reset, so
+ * that boot's RAM log is lost and the slot keeps the previous run's header;
+ * pi5-run.sh's per-run nonce makes such a run read as "no report", never as
+ * a pass. Periodic flushes at stage boundaries are not implemented.
+ *
  * The SD host address is fixed for this board: the firmware's ACPI DSDT
  * (\_SB.SDC0, dumped by AIENOS-PI5-ACPI-0, 2026-10-13) computes its _CRS in a
  * method the kernel's static scanner does not run, and gives the same range
@@ -32,6 +38,8 @@
 static volatile uint8_t *sd_regs;
 static sdhci_card sd;
 static int sd_up;
+static ck_part part;       /* the AIENOS partition view, once found (the marker uses its reserved tail) */
+static ck_part store_part; /* the same partition minus the marker region: the sealed Store's view */
 
 static uint32_t sd_r32(void *c, uint32_t o) { (void)c; return *(volatile uint32_t *)(sd_regs + o); }
 static void sd_w32(void *c, uint32_t o, uint32_t v) { (void)c; *(volatile uint32_t *)(sd_regs + o) = v; }
@@ -71,7 +79,6 @@ void ck_pi5_start(void)
               rc == 0 && s0[510] == 0x55 && s0[511] == 0xaa ? "MBR ok" : "no MBR signature");
     /* Step 3: the AIENOS partition through the same GPT partition view the NVMe path uses (dev/disk_part.c),
      * then the scratch marker at its end (core/pi5_marker.c): formatted on a blank card, reopened after a reboot. */
-    static ck_part part;
     ck_gpt_info gi;
     rc = ck_gpt_find_aienos(&sd.dev, &part, &gi);
     if (rc) {
@@ -81,6 +88,15 @@ void ck_pi5_start(void)
     ck_printf("pi5_part: AIENOS partition first_lba=%llu blocks=%llu (%llu MiB) entries_used=%u index=%u via GPT (CRC32 primary+backup ok)\n",
               (unsigned long long)part.first_lba, (unsigned long long)part.blocks,
               (unsigned long long)(part.blocks / 2048u), gi.used, gi.part_index);
+    /* The Store's view ends before the marker region (core/pi5_marker.h ck_pi5_store_view), in every image,
+     * so the marker and the Store's units and probe unit never share a sector. */
+    rc = ck_pi5_store_view(&part, &store_part);
+    if (rc)
+        ck_printf("pi5_store_view: FAIL rc=%d (%s)\n", rc, ck_pi5_marker_strerror(rc));
+    else
+        ck_printf("pi5_store_view: lba 0..%llu (%llu units) for the Store; marker reserved at %llu..%llu\n",
+                  (unsigned long long)(store_part.blocks - 1u), (unsigned long long)(store_part.blocks / 8u),
+                  (unsigned long long)(part.blocks - CK_PI5_MARKER_SECS), (unsigned long long)(part.blocks - 1u));
     static uint8_t mbuf[CK_PI5_MARKER_BUF_BYTES] __attribute__((aligned(64)));
     uint64_t gen = 0;
     rc = ck_pi5_marker_run(&part.dev, mbuf, &gen);
@@ -150,6 +166,16 @@ static int klog_write(void)
         return -1;
     if (disk_flush(&sd.dev) != DISK_OK)
         return -1;
+    /* Payload read back and compared before the header that vouches for it is written. */
+    static uint8_t chk[8u * 512u] __attribute__((aligned(64)));
+    for (uint32_t s0 = 0; s0 < secs; s0 += 8u) {
+        uint32_t c = secs - s0 < 8u ? secs - s0 : 8u;
+        if (disk_read(&sd.dev, m->lba + 1u + s0, c, chk) != DISK_OK)
+            return -1;
+        for (uint32_t i = 0; i < c * 512u; i++)
+            if (chk[i] != (uint8_t)text[(size_t)s0 * 512u + i])
+                return -1;
+    }
     ck_klog_hdr_written(&hdr, m, n, ck_klog_total(), commit_prefix(), ck_stage_name());
     if (disk_write(&sd.dev, m->lba, 1, (const uint8_t *)&hdr) != DISK_OK || disk_flush(&sd.dev) != DISK_OK)
         return -1;
@@ -174,3 +200,22 @@ void ck_pi5_before_reset(void)
     ck_printf("klog_card: %s\n", rc == 0 ? "written and read back" : rc > 0 ? "not written" : "FAILED");
     ck_pi5_wdt_pet();
 }
+
+#ifdef CK_PI5_STORE
+/* Hand the card's AIENOS partition view to the sealed Store stage (svc/store_boot.c ck_stage_store), the
+ * same stage the QEMU "full" image runs. Tier: SEED-0B-PI5, the Pi counterpart of SEED-0B-QEMU. The Store
+ * keys are the labelled TEST keys (ck_store_test_keys); the production key source stays BLOCKED_OPERATOR
+ * and is not touched here. CK_HARDWARE_STAGING and CK_PI5 cannot be combined (Makefile), so no hardware
+ * staging image can ever carry this. */
+const disk_dev *ck_dev_boot_disk(void)
+{
+    static int said;
+    if (!said++)
+        ck_puts("pi5_store_tier: SEED-0B-PI5 qualification only: Store keys are the public TEST keys, "
+                "Store uuid is the TEST uuid, no production keys, not a production Store\n");
+    return sd_up && store_part.valid ? &store_part.dev : 0;
+}
+
+/* The SD card has no bus master or SMMU stream to revoke: nothing to release. */
+void ck_dev_nvme_release(void) {}
+#endif
diff --git a/native/kernel/core/pi5_marker.c b/native/kernel/core/pi5_marker.c
index b99b9ed4..cdb3bbe6 100644
--- a/native/kernel/core/pi5_marker.c
+++ b/native/kernel/core/pi5_marker.c
@@ -1,6 +1,7 @@
 /* pi5_marker.c -- see pi5_marker.h. */
 #include "pi5_marker.h"
 #include "../dev/disk_part.h"
+#include "../dev/disk_layout.h"
 
 #define MAGIC "AIENPI5M"
 #define HDR_CRC_BYTES 40u
@@ -125,3 +126,16 @@ const char *ck_pi5_marker_strerror(int rc)
     default: return "unknown";
     }
 }
+
+int ck_pi5_store_view(const ck_part *full, ck_part *out)
+{
+    const uint64_t bpu = CK_LAYOUT_UNIT / DISK_SECTOR_BYTES;
+    if (!full || !out || !full->valid || full->dev.block_size != DISK_SECTOR_BYTES ||
+        full->blocks < CK_PI5_MARKER_SECS + bpu)
+        return CK_PI5_MARKER_ESIZE;
+    *out = *full;
+    out->blocks = (full->blocks - CK_PI5_MARKER_SECS) / bpu * bpu;
+    out->dev.ctx = out;
+    out->dev.block_count = out->blocks;
+    return 0;
+}
diff --git a/native/kernel/core/pi5_marker.h b/native/kernel/core/pi5_marker.h
index b3d0fd74..0c501c7d 100644
--- a/native/kernel/core/pi5_marker.h
+++ b/native/kernel/core/pi5_marker.h
@@ -22,6 +22,7 @@
 #define AIENOS_CK_PI5_MARKER_H
 #include <stdint.h>
 #include "disk.h"
+#include "../dev/disk_part.h"
 
 #define CK_PI5_MARKER_SECS 64u /* 32 KiB: one header sector + 63 payload sectors */
 #define CK_PI5_MARKER_BUF_BYTES (CK_PI5_MARKER_SECS * DISK_SECTOR_BYTES)
@@ -41,4 +42,13 @@ enum {
  * *generation is set on success. */
 int ck_pi5_marker_run(const disk_dev *d, uint8_t *buf, uint64_t *generation);
 const char *ck_pi5_marker_strerror(int rc);
+
+/* The sealed Store's view of the AIENOS partition on the Pi card: the same
+ * partition with the marker region reserved. *out ends before the last
+ * CK_PI5_MARKER_SECS sectors, rounded down to whole CK_LAYOUT_UNIT units, so
+ * the Store's units 4..U-2 and its probe unit U-1 (dev/disk_layout.h) never
+ * touch a marker sector, and the marker never touches the Store. Every image
+ * that writes either one uses this split. CK_PI5_MARKER_ESIZE when full is
+ * invalid, not 512-byte blocks, or too small for one unit plus the marker. */
+int ck_pi5_store_view(const ck_part *full, ck_part *out);
 #endif
diff --git a/native/kernel/dev/.crumb b/native/kernel/dev/.crumb
index 1c59867e..3b5a165b 100644
--- a/native/kernel/dev/.crumb
+++ b/native/kernel/dev/.crumb
@@ -7,14 +7,14 @@
     "generated": {
       "children": [],
       "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "compiled_at": "2026-10-13T06:35:07Z",
+      "compiled_at": "2026-10-13T10:54:06Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:7f3dc4d9ecbeba802bd8a3c59514ff336ea615e8aca587c1c998e660abde23c3",
+      "digest": "sha256:7a4dbeb86004aa667074b4d83ba5f072c9a852f8f8783c7eee1dd6f8411ef6e9",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "files": 29,
-      "generated_at_commit": "93ae0323091b1f40c93fbc3a2bdfaaa48745c61a",
-      "source_tree": "sha256:29c8c27228d50dd45d39070ffd23961fa57821564f2e3b43b1e706b8418c5ba3"
+      "files": 30,
+      "generated_at_commit": "291917b982b27e07b60cc0a95d880649335ba1e9",
+      "source_tree": "sha256:1e88d2a3a045a32f58dba7a8303fc1b7b548c179ac30f28da296a9f4d59f67bb"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/kernel/dev/tests/pi5_store_test.c b/native/kernel/dev/tests/pi5_store_test.c
new file mode 100644
index 00000000..99784aa1
--- /dev/null
+++ b/native/kernel/dev/tests/pi5_store_test.c
@@ -0,0 +1,215 @@
+/* pi5_store_test.c -- AIENOS-PI5 step 3b host test: the sealed Store stage
+ * (svc/store_boot.c, the same one the QEMU full image runs) over the Pi 5
+ * card layout (protective MBR, ESP, AIENOS partition, two-copy GPT), in the
+ * TEST-key qualification tier (SEED-0B-PI5). A file stands in for the card;
+ * the SD controller itself is proved on the hub Pi (pi5-run.sh).
+ *
+ * Checks: blank card formats and commits boot 1; after a "reboot" (file
+ * closed, GPT parsed again, nothing kept in memory) the Store reopens and
+ * commits boot 2 and 3 with the generation advancing; every byte outside the
+ * AIENOS partition (MBR, GPT copies, ESP) is unchanged; the production key
+ * source still refuses and hands out no key bytes; a hardware-staging policy
+ * refuses the TEST keys before touching the card. The Store runs on the
+ * partition view minus the marker region (core/pi5_marker.h
+ * ck_pi5_store_view): its units and probe unit never write a marker sector,
+ * stale non-zero data in the reserved tail does not stop a format, and the
+ * marker and the Store each reopen after the other has written. Hosted test
+ * code only. */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include "ck.h"
+#include "ck_host.h"
+#include "disk_file.h"
+#include "disk_layout.h"
+#include "disk_part.h"
+#include "gpt_write.h"
+#include "../../core/pi5_marker.h"
+#include "store_boot.h"
+
+static int checks, failures;
+#define CHECK(c)                                                    \
+    do {                                                            \
+        checks++;                                                   \
+        if (!(c)) {                                                 \
+            failures++;                                             \
+            printf("  FAIL %s:%d: %s\n", __FILE__, __LINE__, #c);   \
+        }                                                           \
+    } while (0)
+
+#define BLOCKS 262144ull /* 128 MiB stand-in for the card */
+static char g_path[256];
+
+static uint8_t *slurp(size_t *n)
+{
+    FILE *fp = fopen(g_path, "rb");
+    CHECK(fp != 0);
+    if (!fp) { *n = 0; return 0; }
+    fseek(fp, 0, SEEK_END);
+    *n = (size_t)ftell(fp);
+    rewind(fp);
+    uint8_t *m = malloc(*n);
+    CHECK(m && fread(m, 1, *n, fp) == *n);
+    fclose(fp);
+    return m;
+}
+
+/* One "boot": open the card file, parse the GPT, run the Store stage body. */
+static int boot(int hardware_staging, const ss_keys *k, ck_store_report *r)
+{
+    disk_file f;
+    disk_dev d;
+    ck_part p;
+    ck_gpt_info gi;
+    if (disk_file_open(&f, &d, g_path, 512, 0, 0)) return -9999;
+    ck_part sp;
+    int rc = ck_gpt_find_aienos(&d, &p, &gi);
+    if (rc || ck_pi5_store_view(&p, &sp)) { disk_file_close(&f); return -9998; }
+    ck_host_quiet = 1;
+    rc = store_boot_run_policy(&sp.dev, k, ck_store_test_uuid, "pi5-store-test", hardware_staging, r);
+    ck_host_quiet = 0;
+    disk_file_close(&f);
+    return rc;
+}
+
+/* One marker "boot" on the full partition view (what core/pi5.c runs in every image). */
+static int marker_boot(uint64_t *gen)
+{
+    disk_file f;
+    disk_dev d;
+    ck_part p;
+    ck_gpt_info gi;
+    static uint8_t mbuf[CK_PI5_MARKER_BUF_BYTES] __attribute__((aligned(64)));
+    if (disk_file_open(&f, &d, g_path, 512, 0, 0)) return -9999;
+    int rc = ck_gpt_find_aienos(&d, &p, &gi);
+    if (!rc) rc = ck_pi5_marker_run(&p.dev, mbuf, gen);
+    disk_file_close(&f);
+    return rc;
+}
+
+#define PART_FIRST 8192u
+#define PART_SECS 8192u
+#define MARKER_AT (PART_FIRST + PART_SECS - CK_PI5_MARKER_SECS) /* absolute sector of the marker header */
+
+int main(void)
+{
+    snprintf(g_path, sizeof g_path, "/tmp/aienos-pi5-store-test-%d.img", (int)getpid());
+    gw_part gp[2] = {{gw_esp_type, 2048, 4095, "AIENOSPI5-ESP", 0x5a}, {ck_aienos_part_type, 8192, 8192 + 8192 - 1, "AIENOS", 0}};
+    CHECK(gw_write(g_path, 512, BLOCKS, gp, 2, 0) == 0);
+    size_t n0 = 0, n1 = 0;
+    /* Stale non-zero bytes in the reserved tail (an old marker, or junk) before the first format. */
+    {
+        FILE *fp = fopen(g_path, "r+b");
+        CHECK(fp != 0);
+        if (fp) {
+            uint8_t junk[CK_PI5_MARKER_SECS * 512u];
+            memset(junk, 0xA5, sizeof junk);
+            fseek(fp, (long)MARKER_AT * 512L, SEEK_SET);
+            CHECK(fwrite(junk, 1, sizeof junk, fp) == sizeof junk);
+            fclose(fp);
+        }
+    }
+    uint8_t *before = slurp(&n0);
+
+    ss_keys k;
+    ck_store_report r;
+    ck_store_test_keys(&k);
+    CHECK(k.identity_class == M5_ID_TEST); /* the tier is TEST: labelled, public, protects nothing */
+
+    int rc = boot(0, &k, &r);
+    CHECK(rc == 0 && r.verdict == CK_SB_COMMITTED && r.formatted == 1 && r.boot_count_new == 1);
+    uint64_t g1 = r.gen_commit;
+    rc = boot(0, &k, &r);
+    CHECK(rc == 0 && r.formatted == 0 && r.boot_count_prev == 1 && r.boot_count_new == 2 && r.gen_commit > g1);
+    uint64_t g2 = r.gen_commit;
+    rc = boot(0, &k, &r);
+    CHECK(rc == 0 && r.formatted == 0 && r.boot_count_new == 3 && r.gen_commit > g2);
+    CHECK(strcmp(r.prev_commit, "pi5-store-test") == 0);
+    /* AIENOS partition is 8192 sectors = 1024 units; the Store view drops the 64-sector (8-unit) marker
+     * region: 1016 units, anchor 4, probe 1. */
+    CHECK(r.store_units == (8192u - CK_PI5_MARKER_SECS) / 8u - CK_LAYOUT_ANCHOR_UNITS - CK_LAYOUT_PROBE_UNITS);
+
+    uint8_t *after = slurp(&n1);
+    CHECK(before && after && n0 == n1);
+    if (before && after && n0 == n1) {
+        CHECK(memcmp(before, after, 8192u * 512u) == 0);                                  /* MBR, GPT, ESP */
+        CHECK(memcmp(before + 16384u * 512u, after + 16384u * 512u, n0 - 16384u * 512u) == 0); /* after the partition, backup GPT */
+        CHECK(memcmp(before + 8192u * 512u, after + 8192u * 512u, 8192u * 512u) != 0);      /* the Store wrote inside */
+        CHECK(memcmp(before + (size_t)MARKER_AT * 512u, after + (size_t)MARKER_AT * 512u,
+                     CK_PI5_MARKER_SECS * 512u) == 0); /* three Store boots, probe included: reserved tail untouched */
+    }
+    free(before);
+    free(after);
+
+    /* The stale junk is neither blank nor a marker: the marker refuses and writes nothing. Clear it as a
+     * fresh card would be, then marker and Store alternate: each reopens after the other wrote. */
+    uint64_t mg = 0;
+    CHECK(marker_boot(&mg) == CK_PI5_MARKER_EREFUSED);
+    {
+        FILE *fp = fopen(g_path, "r+b");
+        CHECK(fp != 0);
+        if (fp) {
+            uint8_t z[CK_PI5_MARKER_SECS * 512u];
+            memset(z, 0, sizeof z);
+            fseek(fp, (long)MARKER_AT * 512L, SEEK_SET);
+            CHECK(fwrite(z, 1, sizeof z, fp) == sizeof z);
+            fclose(fp);
+        }
+    }
+    CHECK(marker_boot(&mg) == CK_PI5_MARKER_FORMATTED && mg == 1);
+    rc = boot(0, &k, &r);
+    CHECK(rc == 0 && r.formatted == 0 && r.boot_count_new == 4);
+    CHECK(marker_boot(&mg) == CK_PI5_MARKER_REOPENED && mg == 2);
+    rc = boot(0, &k, &r);
+    CHECK(rc == 0 && r.formatted == 0 && r.boot_count_new == 5);
+    CHECK(marker_boot(&mg) == CK_PI5_MARKER_REOPENED && mg == 3);
+
+    /* Geometry: the Store view ends at or before the marker's first sector, in whole units. */
+    {
+        disk_file f;
+        disk_dev d;
+        ck_part p, sp;
+        ck_gpt_info gi;
+        CHECK(disk_file_open(&f, &d, g_path, 512, 0, 0) == 0);
+        CHECK(ck_gpt_find_aienos(&d, &p, &gi) == 0);
+        CHECK(ck_pi5_store_view(&p, &sp) == 0);
+        CHECK(sp.blocks % 8u == 0 && sp.blocks <= p.blocks - CK_PI5_MARKER_SECS && sp.dev.block_count == sp.blocks);
+        CHECK(sp.dev.ctx == &sp && sp.first_lba == p.first_lba);
+        uint8_t one[512];
+        CHECK(disk_read(&sp.dev, sp.blocks, 1, one) != DISK_OK); /* the first marker sector is outside the view */
+        /* An odd-sized partition still leaves the whole marker outside the Store's last unit. */
+        ck_part odd = p, so;
+        odd.blocks = p.blocks - 3u;
+        odd.dev.ctx = &odd;
+        odd.dev.block_count = odd.blocks;
+        CHECK(ck_pi5_store_view(&odd, &so) == 0 && so.blocks % 8u == 0 && so.blocks <= odd.blocks - CK_PI5_MARKER_SECS);
+        ck_part tiny = p, st;
+        tiny.blocks = CK_PI5_MARKER_SECS + 7u;
+        CHECK(ck_pi5_store_view(&tiny, &st) == CK_PI5_MARKER_ESIZE);
+        disk_file_close(&f);
+    }
+
+    /* Production key source: still BLOCKED_OPERATOR, no key bytes handed out, no fallback. */
+    ss_keys pk;
+    memset(&pk, 0xAA, sizeof pk);
+    CHECK(ck_store_production_keys(&pk) == CK_SB_E_BLOCKED_OPERATOR);
+    int nz = 0;
+    for (size_t i = 0; i < sizeof pk; i++) nz |= ((uint8_t *)&pk)[i];
+    CHECK(nz == 0);
+
+    /* A hardware-staging policy refuses the TEST keys before any disk access. */
+    uint8_t *b2 = slurp(&n0);
+    rc = boot(1, &k, &r);
+    CHECK(rc == CK_SB_E_TEST_KEYS);
+    uint8_t *a2 = slurp(&n1);
+    CHECK(b2 && a2 && n0 == n1 && memcmp(b2, a2, n0) == 0);
+    free(b2);
+    free(a2);
+
+    memset(&k, 0, sizeof k);
+    unlink(g_path);
+    printf("pi5_store_test: %d checks, %d failures\n", checks, failures);
+    printf("CK_PI5_STORE_HOST: %s\n", failures ? "FAIL" : "PASS");
+    return failures ? 1 : 0;
+}
diff --git a/native/kernel/stage.mk b/native/kernel/stage.mk
index 37faf5ce..b6f6d84a 100644
--- a/native/kernel/stage.mk
+++ b/native/kernel/stage.mk
@@ -158,3 +158,20 @@ disk-part-sanitize: $(STAGE_OUT)/disk_part_test_san
 
 stage-test: disk-part-test
 stage-sanitize: disk-part-sanitize
+
+# ---- AIENOS-PI5 step 3b: sealed Store over the Pi card layout (dev/tests/pi5_store_test.c) ----
+# Same sources as disk_part_test; the image build of this stage is "make pi5-store".
+PI5_STORE_TEST_SRCS := $(filter-out %/disk_part_test.c,$(DISK_PART_TEST_SRCS)) $(STAGE_DIR)/core/pi5_marker.c $(STAGE_DIR)/dev/tests/pi5_store_test.c
+$(STAGE_OUT)/pi5_store_test: $(PI5_STORE_TEST_SRCS) $(DISK_PART_TEST_DEPS) $(STAGE_DIR)/core/pi5_marker.c $(STAGE_DIR)/core/pi5_marker.h $(STAGE_DIR)/dev/tests/pi5_store_test.c
+	@mkdir -p $(@D)
+	$(STAGE_CC) $(STAGE_HOST_FLAGS) $(DISK_PART_INC) -o $@ $(PI5_STORE_TEST_SRCS)
+$(STAGE_OUT)/pi5_store_test_san: $(PI5_STORE_TEST_SRCS) $(DISK_PART_TEST_DEPS) $(STAGE_DIR)/core/pi5_marker.c $(STAGE_DIR)/core/pi5_marker.h $(STAGE_DIR)/dev/tests/pi5_store_test.c
+	@mkdir -p $(@D)
+	$(STAGE_CC) $(STAGE_HOST_FLAGS) $(STAGE_SAN_FLAGS) $(DISK_PART_INC) -o $@ $(PI5_STORE_TEST_SRCS)
+.PHONY: pi5-store-test pi5-store-sanitize
+pi5-store-test: $(STAGE_OUT)/pi5_store_test
+	$<
+pi5-store-sanitize: $(STAGE_OUT)/pi5_store_test_san
+	ASAN_OPTIONS=detect_leaks=1 UBSAN_OPTIONS=print_stacktrace=1 $<
+stage-test: pi5-store-test
+stage-sanitize: pi5-store-sanitize
diff --git a/scripts/.crumb b/scripts/.crumb
index 6408916f..8ed4204a 100644
--- a/scripts/.crumb
+++ b/scripts/.crumb
@@ -7,14 +7,14 @@
     "generated": {
       "children": [],
       "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "compiled_at": "2026-10-13T07:51:09Z",
+      "compiled_at": "2026-10-13T10:54:06Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:197bb0910cb0164678c40a278c02240cd8f147d407d2322be38ce7a66289316e",
+      "digest": "sha256:edbbdde42da02e5b95aede8b2be3541b22dad6dc44f49c33aab1744653769801",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 92,
-      "generated_at_commit": "27f24e8c3b542611bc086755ba3b5693c2125f30",
-      "source_tree": "sha256:4d2e5f840e9b0fb5373a8a70bc13fd3a6ef06eeeddaa8331d7af02c66228af1c"
+      "generated_at_commit": "291917b982b27e07b60cc0a95d880649335ba1e9",
+      "source_tree": "sha256:ed926f5f40480a130a705f665892375d7bd36cb07fc2349eaac85a959997c62b"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/scripts/ck_pi5_build_check.sh b/scripts/ck_pi5_build_check.sh
index dd38f54d..aea40ef3 100755
--- a/scripts/ck_pi5_build_check.sh
+++ b/scripts/ck_pi5_build_check.sh
@@ -21,4 +21,15 @@ for s in ${syms}; do
     if defined "${def}" "${s}"; then echo "FAIL default image defines ${s}"; fail=1; else echo "PASS default image has no ${s}"; fi
 done
 test -s "${root}/target/native-kernel-pi5/BOOTAA64.EFI" || { echo "FAIL no Pi BOOTAA64.EFI"; fail=1; }
+
+# Step 3b: the Pi image with the sealed Store stage in the TEST-key tier (SEED-0B-PI5).
+make -C "${root}/native/kernel" pi5-store >/dev/null
+ps="${root}/target/native-kernel-pi5-store/full-pi5-store/aienos-ck.elf"
+for s in ck_stage_store ck_dev_boot_disk ck_store_test_keys; do
+    if defined "${ps}" "${s}"; then echo "PASS pi5-store image defines ${s}"; else echo "FAIL pi5-store image lacks ${s}"; fail=1; fi
+    if defined "${pi5}" "${s}"; then echo "FAIL plain pi5 image defines ${s}"; fail=1; else echo "PASS plain pi5 image has no ${s}"; fi
+done
+ps_strings="$(strings -a "${ps}")" # no early-exit pipe (SIGPIPE under pipefail)
+if grep -q "SEED-0B-PI5" <<<"${ps_strings}" && ! grep -q "SEED-0B-QEMU" <<<"${ps_strings}"; then echo "PASS pi5-store image carries the SEED-0B-PI5 tier label only"; else echo "FAIL pi5-store tier label"; fail=1; fi
+test -s "${root}/target/native-kernel-pi5-store/full-pi5-store/BOOTAA64.EFI" || { echo "FAIL no pi5-store BOOTAA64.EFI"; fail=1; }
 if [[ ${fail} == 0 ]]; then echo "CK_PI5_BUILD: PASS"; else echo "CK_PI5_BUILD: FAIL"; exit 1; fi