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

closed derived 5b4b72224abf8aa8 #359

Imported from GitHub aien-dev/aienux#359 (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 2529bc07ca9ac053058d2d44823ae66094ad2230 · Head 55f6cc0130d2932263ef0baece5a89c88a99c739

Apply it

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

Changes

diff --git a/.crumb b/.crumb
index 396d0142..f80845ee 100644
--- a/.crumb
+++ b/.crumb
@@ -33,27 +33,27 @@
           "purpose": "Directory docs. Purpose not yet described by a human."
         },
         {
-          "digest": "527f2f29be9c6f49513516b66a06c470320a63aa64d4488af321204f40907cdf",
-          "last_commit": "a01f365",
+          "digest": "71354ffe863a62393a1e92b1afbc1beaeb303656ce93e1fe9016e3117ebbb8d1",
+          "last_commit": "535421b",
           "name": "native",
           "purpose": "Directory native. Purpose not yet described by a human."
         },
         {
-          "digest": "ebacb9a6843c9319ee3cb65d8af90e79b76b22398528626d71363a7d45b98d1a",
-          "last_commit": "a01f365",
+          "digest": "f2439778c4be0d383e54636dc2364563ac9a3904b827de7c295041c764720d19",
+          "last_commit": "535421b",
           "name": "scripts",
           "purpose": "Directory scripts. Purpose not yet described by a human."
         }
       ],
-      "children_root": "sha256:c6830a2a2d8d6b7174eb4eec96bca9f59299ff41ea9dfbac639e5dca22eed04b",
-      "compiled_at": "2026-10-13T12:30:58Z",
+      "children_root": "sha256:b0264fc20922cf0548cd2a74f2203db88aef11c36e40b2170538d0c32175a1b9",
+      "compiled_at": "2026-10-13T13:55:32Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:a302bde0e553440966a84940890dbcce2053da11747fd989ce71dbfc2224fd19",
+      "digest": "sha256:adc07607efc9ec35305ef648d07132dbefa16f550070b7b7ea58847a6fe523d8",
       "evidence_files": 156,
       "evidence_root": "sha256:cd53ab119be9de6ce28c4f5949b106c9622f1fe105611de3de21c3bce7932694",
-      "files": 3145,
-      "generated_at_commit": "a01f365f16ea16bb4843f97b031ee72b4e028389",
-      "source_tree": "sha256:e5b17cbe1452fdd8dae0b25b85f9ec501694c527338b9f79f181b99e9521b892"
+      "files": 3151,
+      "generated_at_commit": "535421b0de0c44a5c614c90deffbb5736266bc7c",
+      "source_tree": "sha256:261454bafbdfad45c4538900b3ec96d9a1d3b939bb1a99d179623027e15570cd"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/.crumb b/native/.crumb
index d6b94c1e..4cb327aa 100644
--- a/native/.crumb
+++ b/native/.crumb
@@ -55,8 +55,8 @@
           "purpose": "Directory native/argus. Purpose not yet described by a human."
         },
         {
-          "digest": "aa53401411b940e8361373c4e4325edf91b649c86ca6047dbe1c2dbb10f5c2de",
-          "last_commit": "502d168",
+          "digest": "a0fa7029b69edd1b451162c0eee5d816edb1efb37ee972b167b460a0f21f0629",
+          "last_commit": "535421b",
           "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": "238b04ca7654bb6b12fa96199fc185c8ec5e3e50ef7d27e93ab027a0b6ec9e17",
-          "last_commit": "a01f365",
+          "digest": "5b24756a02b229d972d05cef3a0fb46e478ae336102335952392e1a22b114542",
+          "last_commit": "535421b",
           "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:d82d3657c3d9315b627145e341e0ff89d552608d1fef7749739e4717a3592963",
-      "compiled_at": "2026-10-13T12:30:58Z",
+      "children_root": "sha256:6351eec18060931bdf55c0779f2b017bada8134ec499558cb72bcb9c813e5015",
+      "compiled_at": "2026-10-13T13:55:32Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:527f2f29be9c6f49513516b66a06c470320a63aa64d4488af321204f40907cdf",
+      "digest": "sha256:71354ffe863a62393a1e92b1afbc1beaeb303656ce93e1fe9016e3117ebbb8d1",
       "evidence_files": 4,
       "evidence_root": "sha256:e410b845507e00568e15b51a5797af32a97e0e4b8ab4e8487bb7c98e7e0cf335",
-      "files": 512,
-      "generated_at_commit": "a01f365f16ea16bb4843f97b031ee72b4e028389",
-      "source_tree": "sha256:7b8eff45b8dfea3c3f6a570a7fae3e81db430c94cbcaba0efd83e34f88cea09f"
+      "files": 517,
+      "generated_at_commit": "535421b0de0c44a5c614c90deffbb5736266bc7c",
+      "source_tree": "sha256:1e7b2f9976f8be974c3c77c57795d66e87db6b1f0c717e51d390e5f1684d0358"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/boot/.crumb b/native/boot/.crumb
index d17671e4..c0e4d272 100644
--- a/native/boot/.crumb
+++ b/native/boot/.crumb
@@ -7,14 +7,14 @@
     "generated": {
       "children": [],
       "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "compiled_at": "2026-10-13T06:35:07Z",
+      "compiled_at": "2026-10-13T13:55:32Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:aa53401411b940e8361373c4e4325edf91b649c86ca6047dbe1c2dbb10f5c2de",
+      "digest": "sha256:a0fa7029b69edd1b451162c0eee5d816edb1efb37ee972b167b460a0f21f0629",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "files": 18,
-      "generated_at_commit": "93ae0323091b1f40c93fbc3a2bdfaaa48745c61a",
-      "source_tree": "sha256:63118f8e3a815f73d94b9980d177542e0d8a82d6f958e8af3127c82acf987fb2"
+      "files": 19,
+      "generated_at_commit": "535421b0de0c44a5c614c90deffbb5736266bc7c",
+      "source_tree": "sha256:fca5a91929e8d47e6407d601622820b70befacf67f07098ea3e269c63bc2ef4c"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/boot/efi_main.c b/native/boot/efi_main.c
index 00b46437..70939417 100644
--- a/native/boot/efi_main.c
+++ b/native/boot/efi_main.c
@@ -38,6 +38,9 @@ static struct ck_handoff handoff;
 static EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *conout;
 
 int ck_boot_model_load(EFI_HANDLE image, EFI_SYSTEM_TABLE *st, struct ck_handoff *h);
+#ifdef CK_PI5_UNLOCK_CARD
+void ck_boot_unlock_req_find(EFI_HANDLE image, EFI_SYSTEM_TABLE *st);
+#endif
 #ifdef CK_KLOG
 void ck_boot_klog_find(EFI_HANDLE image, EFI_SYSTEM_TABLE *st);
 #endif
@@ -133,6 +136,10 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *st)
 #ifdef CK_KLOG
     /* Pi 5 build: find the card's log slot while Block I/O is still up (efi_klog.c). */
     ck_boot_klog_find(image, st);
+#endif
+#ifdef CK_PI5_UNLOCK_CARD
+    /* Pi qualification unlock image: the throwaway recovery secret request file (efi_unlock.c). */
+    ck_boot_unlock_req_find(image, st);
 #endif
     ck_puts("kernel_impl: c (native/kernel, Lane 18)\n");
     vendor_print(st->FirmwareVendor);
diff --git a/native/boot/efi_unlock.c b/native/boot/efi_unlock.c
new file mode 100644
index 00000000..f4c20da0
--- /dev/null
+++ b/native/boot/efi_unlock.c
@@ -0,0 +1,64 @@
+/* efi_unlock.c -- read \EFI\AIENOS\UNLOCK.REQ from the boot volume before
+ * ExitBootServices (Raspberry Pi 5 qualification image, CK_PI5_UNLOCK_CARD).
+ * Nothing is written. The file holds a THROWAWAY recovery secret placed by the
+ * run tool (see native/kernel/core/unlock_req.h); the secret is never printed.
+ * Result in ck_unlock_req_boot (stub and kernel are one image): ABSENT (no
+ * file: not an error, the Store stays closed), REFUSED (printed why), FOUND. */
+#include "efi.h"
+#include "../kernel/core/unlock_req.h"
+#include "../kernel/arch/arch.h"
+#include "../kernel/core/ck_internal.h"
+
+static uint8_t buf[CK_UNLOCK_REQ_SIZE + 1u] __attribute__((aligned(64)));
+
+static void wipe_buf(void)
+{
+    volatile uint8_t *b = buf;
+    for (unsigned i = 0; i < sizeof buf; i++)
+        b[i] = 0;
+}
+
+void ck_boot_unlock_req_find(EFI_HANDLE image, EFI_SYSTEM_TABLE *st)
+{
+    static const EFI_GUID li_guid = EFI_LOADED_IMAGE_PROTOCOL_GUID_INIT;
+    static const EFI_GUID fs_guid = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID_INIT;
+    static CHAR16 path[] = {'\\', 'E', 'F', 'I', '\\', 'A', 'I', 'E', 'N', 'O', 'S', '\\',
+                            'U', 'N', 'L', 'O', 'C', 'K', '.', 'R', 'E', 'Q', 0};
+    EFI_BOOT_SERVICES *bs = st->BootServices;
+    EFI_LOADED_IMAGE_PROTOCOL *li = 0;
+    EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *fs = 0;
+    EFI_FILE_PROTOCOL *root = 0, *f = 0;
+    ck_unlock_req_boot.state = CK_UNLOCK_REQ_ABSENT;
+    if (bs->HandleProtocol(image, &li_guid, (void **)&li) != EFI_SUCCESS || !li || !li->DeviceHandle ||
+        bs->HandleProtocol(li->DeviceHandle, &fs_guid, (void **)&fs) != EFI_SUCCESS || !fs ||
+        fs->OpenVolume(fs, &root) != EFI_SUCCESS || !root) {
+        ck_puts("unlock_req: absent (boot volume not readable); the Store stays closed\n");
+        return;
+    }
+    if (root->Open(root, &f, path, EFI_FILE_MODE_READ, 0) != EFI_SUCCESS || !f) {
+        root->Close(root);
+        ck_puts("unlock_req: absent (no " CK_UNLOCK_REQ_PATH "); the Store stays closed\n");
+        return;
+    }
+    wipe_buf();
+    uint64_t n = sizeof buf; /* one byte more than the format: a longer file is refused */
+    EFI_STATUS s = f->Read(f, &n, buf);
+    f->Close(f);
+    root->Close(root);
+    ck_unlock_req_boot.state = CK_UNLOCK_REQ_REFUSED;
+    if (s != EFI_SUCCESS || n != CK_UNLOCK_REQ_SIZE) {
+        ck_printf("unlock_req: refused (read status=0x%llx bytes=%llu, want exactly %u)\n", (unsigned long long)s,
+                  (unsigned long long)n, (unsigned)CK_UNLOCK_REQ_SIZE);
+        wipe_buf();
+        return;
+    }
+    const char *why = 0;
+    if (ck_unlock_req_check((const struct ck_unlock_req *)buf, &why)) {
+        ck_printf("unlock_req: refused (%s)\n", why ? why : "malformed");
+        wipe_buf();
+        return;
+    }
+    ck_unlock_req_store((const struct ck_unlock_req *)buf);
+    wipe_buf();
+    ck_puts("unlock_req: found a well-formed request file (QUALIFICATION ONLY, throwaway secret); secret not printed\n");
+}
diff --git a/native/kernel/.crumb b/native/kernel/.crumb
index bf906e38..d8d6539b 100644
--- a/native/kernel/.crumb
+++ b/native/kernel/.crumb
@@ -46,7 +46,7 @@
       "children": [
         {
           "digest": "8f63182b423b274a3fa6dcf0a17811343f93bd1539e33479102ffa87935da1ca",
-          "last_commit": "a01f365",
+          "last_commit": "2529bc0",
           "name": "arch",
           "purpose": "Directory native/kernel/arch. Purpose not yet described by a human."
         },
@@ -57,14 +57,14 @@
           "purpose": "Directory native/kernel/artifact. Purpose not yet described by a human."
         },
         {
-          "digest": "1f4276b8bf582552f24f021e12078c4abf288b1e10415b724d7fc71819c115b2",
-          "last_commit": "a01f365",
+          "digest": "a3800f538eb9f5f3ee2b1dfef888f62ff12756136828f4bbd1df92a881c57e98",
+          "last_commit": "535421b",
           "name": "core",
           "purpose": "Directory native/kernel/core. Purpose not yet described by a human."
         },
         {
-          "digest": "ce05eacbe36c1ae486f78c41446fe810a33aa95e152437b7d95ebf60437802a8",
-          "last_commit": "a01f365",
+          "digest": "fc1238a186e63fedc2604dff5dbd433f092f55e44a32cdd5d304c9e35fba0974",
+          "last_commit": "535421b",
           "name": "dev",
           "purpose": "Directory native/kernel/dev. Purpose not yet described by a human."
         },
@@ -81,14 +81,14 @@
           "purpose": "Directory native/kernel/mm. Purpose not yet described by a human."
         },
         {
-          "digest": "f2ef5ffe9eae8f9119dd302b55989b8b50f68def6ad03a2db227e28dbd270ddd",
-          "last_commit": "2cdd37f",
+          "digest": "1269af87b047348f0eec4bf57ba98cbff4fd643a8bb7a619fa1771183c95cf17",
+          "last_commit": "5ec8143",
           "name": "svc",
           "purpose": "Directory native/kernel/svc. Purpose not yet described by a human."
         },
         {
-          "digest": "ae1566720e4d7f5c05d03a40297cbc77b0b8891acea51dedbbf181944e89f8a4",
-          "last_commit": "a01f365",
+          "digest": "eeb3f3e295f20349daba59ddf7c896ef121edceb954342c2f04bf27233127f13",
+          "last_commit": "535421b",
           "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:1d0b2dee2ea9c91b010e2dfa8ac8975a4bc7cfca2708452e065a721af1fd6199",
-      "compiled_at": "2026-10-13T12:30:58Z",
+      "children_root": "sha256:44af6ed1031a5f3f945cb5db33e783cb1bd5aecfd32d87ed406ea3c20b00d74a",
+      "compiled_at": "2026-10-13T13:55:32Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:238b04ca7654bb6b12fa96199fc185c8ec5e3e50ef7d27e93ab027a0b6ec9e17",
+      "digest": "sha256:5b24756a02b229d972d05cef3a0fb46e478ae336102335952392e1a22b114542",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "files": 335,
-      "generated_at_commit": "a01f365f16ea16bb4843f97b031ee72b4e028389",
-      "source_tree": "sha256:82479a2b1ea1cf9be5c313f638ba41251762bc0ad2c4a4186899a1843a1dbc47"
+      "files": 339,
+      "generated_at_commit": "535421b0de0c44a5c614c90deffbb5736266bc7c",
+      "source_tree": "sha256:5e28b49b12788710635982ac9beabd0256a4f514e7e1bbf333fd50b564295f05"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/kernel/Makefile b/native/kernel/Makefile
index bbaf201f..ba6e52ac 100644
--- a/native/kernel/Makefile
+++ b/native/kernel/Makefile
@@ -150,6 +150,46 @@ CK_PI5 := 1
 OUT ?= $(REPO)/target/native-kernel-pi5-store
 CK_EXTRA_CFLAGS += -DCK_PI5_STORE=1
 endif
+
+# Pi unlock image (CK_PI5_UNLOCK=1, "make pi5-unlock", PI5-4 cut 1): the same Store stage, but the Store opens
+# ONLY through the ADR 0017 Slot 1 recovery-secret path (ck_store_unlock_boot, PRODUCTION-class keys).
+# ck_store_test_keys and ck_store_test_uuid are not compiled, so no TEST key or TEST uuid can reach it.
+# It is a separate image from CK_PI5_STORE (TEST keys) and cannot be combined with any other tier flag.
+# PI5-4 cut 2: CK_PI5_UNLOCK_CARD=1 (QUALIFICATION ONLY, "make pi5-unlock-card") adds one secret source to the
+# unlock image: a THROWAWAY recovery secret from \EFI\AIENOS\UNLOCK.REQ on the card (core/unlock_req.h). It
+# needs CK_PI5_UNLOCK=1 and is a separate image with its own OUT. CK_PI5_PRODUCTION is reserved for a future
+# production Pi image; it is not implemented and can never be combined with the card request source.
+CK_PI5_UNLOCK_CARD ?=
+CK_PI5_PRODUCTION ?=
+ifneq ($(strip $(CK_PI5_PRODUCTION)),)
+$(error CK_PI5_PRODUCTION is reserved and not implemented: there is no production Pi image yet)
+endif
+ifneq ($(strip $(CK_PI5_UNLOCK_CARD)),)
+ifneq ($(strip $(CK_PI5_UNLOCK_CARD)),1)
+$(error CK_PI5_UNLOCK_CARD must be empty or 1)
+endif
+ifeq ($(strip $(CK_PI5_UNLOCK)),)
+$(error CK_PI5_UNLOCK_CARD (card request file, throwaway secret, QUALIFICATION ONLY) needs CK_PI5_UNLOCK=1)
+endif
+endif
+CK_PI5_UNLOCK ?=
+ifneq ($(strip $(CK_PI5_UNLOCK)),)
+ifneq ($(strip $(CK_PI5_UNLOCK)),1)
+$(error CK_PI5_UNLOCK must be empty or 1)
+endif
+ifneq ($(strip $(CK_PI5_STORE)),)
+$(error CK_PI5_UNLOCK (production-class keys from the recovery secret) cannot be combined with CK_PI5_STORE (public TEST keys))
+endif
+ifneq ($(strip $(CK_SERVICE)$(CK_TEST_STORE_CRASH)$(CK_TEST_CONTINUITY)$(CK_HARDWARE_STAGING)$(CK_SERVICE_TEST_KEYS)),)
+$(error CK_PI5_UNLOCK cannot be combined with CK_SERVICE, CK_SERVICE_TEST_KEYS, CK_TEST_STORE_CRASH, CK_TEST_CONTINUITY or CK_HARDWARE_STAGING)
+endif
+CK_PI5 := 1
+OUT ?= $(REPO)/target/native-kernel-pi5-unlock$(if $(strip $(CK_PI5_UNLOCK_CARD)),-card)
+CK_EXTRA_CFLAGS += -DCK_PI5_UNLOCK=1
+ifneq ($(strip $(CK_PI5_UNLOCK_CARD)),)
+CK_EXTRA_CFLAGS += -DCK_PI5_UNLOCK_CARD=1
+endif
+endif
 CK_PI5 ?=
 ifneq ($(strip $(CK_PI5)),)
 ifneq ($(strip $(CK_PI5)),1)
@@ -668,6 +708,9 @@ ifeq ($(strip $(CK_PI5)),1)
 CORE_C += $(BOOT)/efi_klog.c $(KDIR)/core/pi5.c $(KDIR)/core/pi5_marker.c $(KDIR)/dev/disk_part.c $(KDIR)/core/klog.c $(KDIR)/core/klog_slot.c \
 	$(KDIR)/dev/pi5_wdt.c $(KDIR)/dev/pi5_rng.c $(NATIVE)/disk/disk.c $(NATIVE)/disk/disk_sdhci.c
 endif
+ifneq ($(strip $(CK_PI5_UNLOCK_CARD)),)
+CORE_C += $(BOOT)/efi_unlock.c $(KDIR)/core/unlock_req.c
+endif
 # P2 sealed-artifact loader: format/admission/receipt (artifact/), SHA-256
 # (argus), Ed25519/SHA-512 (sig). Built into the core so every image carries
 # the loader; the TEST-anchor qualification build is CK_SEED0B_TEST_ANCHOR=1.
@@ -781,8 +824,8 @@ endif
 # 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
+ifneq ($(strip $(CK_PI5_STORE)$(CK_PI5_UNLOCK)),)
+FULL_NAME := $(if $(strip $(CK_PI5_UNLOCK)),full-pi5-unlock$(if $(strip $(CK_PI5_UNLOCK_CARD)),-card),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)
@@ -1079,10 +1122,10 @@ $(FULL_EFI): $(FULL_ELF)
 HOST_SRCS := $(KDIR)/core/fmt.c $(KDIR)/core/acpi.c $(KDIR)/core/smmu.c $(KDIR)/mm/frames.c \
 	$(KDIR)/mm/pt.c $(KDIR)/mm/heap.c $(KDIR)/core/sched.c $(KDIR)/core/ipc.c $(KDIR)/core/entropy.c \
 	$(KDIR)/core/handoff_check.c $(KDIR)/core/fbcon.c $(KDIR)/core/acpi_dev.c $(KDIR)/core/lifecycle_fsm.c \
-	$(KDIR)/core/line_rx.c $(KDIR)/core/klog.c $(KDIR)/core/klog_slot.c
+	$(KDIR)/core/line_rx.c $(KDIR)/core/klog.c $(KDIR)/core/klog_slot.c $(KDIR)/core/unlock_req.c
 TESTS := test_fmt test_frames test_pt test_acpi test_acpi_dev test_heap test_smmu test_sched test_ipc test_artifact test_osc_unit test_osc_launch test_osc_admit test_entropy test_handoff test_fbcon test_osh_op \
 	test_continuity_codec test_continuity_resolve test_continuity_commit test_continuity_recovery test_continuity_geometry \
-	test_continuity_subject test_continuity_subject_provision test_lifecycle test_console_rx test_klog test_klog_slot test_pi5 test_pi5_marker test_pi5_rng
+	test_continuity_subject test_continuity_subject_provision test_lifecycle test_console_rx test_klog test_klog_slot test_pi5 test_pi5_marker test_pi5_rng test_unlock_req
 HCFLAGS := -std=gnu11 -O1 -g -Wall -Wextra -Werror -I$(KDIR)/core -I$(KDIR)/mm -I$(KDIR)/tests -I$(BOOT)
 SANFLAGS := -fsanitize=address,undefined -fno-sanitize-recover=all -fno-omit-frame-pointer
 
@@ -1814,6 +1857,12 @@ pi5-diag: $(PI5DIAG_EFI)
 pi5-store:
 	$(MAKE) CK_PI5_STORE=1 full
 
+pi5-unlock:
+	$(MAKE) CK_PI5_UNLOCK=1 full
+
+pi5-unlock-card:
+	$(MAKE) CK_PI5_UNLOCK=1 CK_PI5_UNLOCK_CARD=1 full
+
 pi5:
 	$(MAKE) CK_PI5=1 all
 
@@ -1865,7 +1914,7 @@ $(OUT)/host-san/test_pi5_rng: $(KDIR)/tests/test_pi5_rng.c $(PI5_RNG_SRCS) $(KDI
 
 FORCE:
 .PHONY: uefi-vars slot-loader slot-loader-check pi5-diag
-.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
+.PHONY: all full pi5 pi5-store pi5-unlock pi5-unlock-card 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/README.md b/native/kernel/README.md
index 36ac9b5f..7b1bab7c 100644
--- a/native/kernel/README.md
+++ b/native/kernel/README.md
@@ -149,6 +149,38 @@ The Pi image is the default core image plus board glue (`core/pi5.c`). The
 default and QEMU images link none of it: the hooks in `include/ck.h` are weak
 and absent, and `scripts/ck_pi5_build_check.sh` checks both images.
 
+**Pi unlock image (PI5-4 cut 1, `make pi5-unlock`, `CK_PI5_UNLOCK=1`).** A
+separate image from `pi5-store`: the Store opens only through the ADR 0017
+Slot 1 recovery-secret path (`ck_store_pi5_unlock_run` calls
+`ck_store_unlock_boot` with the hardware policy). `ck_store_test_keys` and
+`ck_store_test_uuid` are not compiled, a TEST-identity key is refused before
+any disk access, a Store without a KeySlotManifest (for example a TEST-tier
+Store) is refused, a wrong secret fails the K_vol unwrap tag, and every refusal
+writes nothing. The secret source is `ck_pi5_unlock_secret` in `core/pi5.c`;
+this cut compiles in no source, so the Store stays closed
+(`unlock_source: none`). The Makefile refuses the flag with `CK_PI5_STORE`,
+`CK_SERVICE`, `CK_HARDWARE_STAGING` and the test flags. Host test:
+`make pi5-unlock-test` (`dev/tests/pi5_unlock_test.c`); image checks:
+`scripts/ck_pi5_build_check.sh`. Tier label in receipts:
+`PI5-UNLOCK-QUALIFICATION`. Not a production image: no TPM, no operator
+ceremony.
+
+**Card unlock request (PI5-4 cut 2, `make pi5-unlock-card`, QUALIFICATION ONLY).**
+`CK_PI5_UNLOCK_CARD=1` (needs `CK_PI5_UNLOCK=1`, own OUT directory) adds the
+one secret source the Pi can have without a TPM or a serial reader: a
+THROWAWAY recovery secret in `\EFI\AIENOS\UNLOCK.REQ` on the card (`core/unlock_req.h`,
+512 bytes, tier tag `QUALIF-THROWAWAY`). The UEFI stub reads it before
+ExitBootServices (`boot/efi_unlock.c`, reads only), the Store stage takes the
+secret once and runs the Slot 1 path as if the operator had typed `unlock`
+(first-time setup on a blank Store). The boot log says
+`unlock_source: card request file (QUALIFICATION ONLY, throwaway secret)`; the
+secret is never printed. `pi5-run.sh UNLOCK_REQ=<file>` places the file and
+zeroes and deletes it from the card after the run, checking it is gone;
+`scripts/pi5_unlock_req.sh` writes a throwaway request (never inside a git
+checkout). `CK_PI5_PRODUCTION` is reserved for a future production Pi image: the
+Makefile refuses it, so the card source can never be combined with it. A
+production image must read its secret from the operator, never from the card.
+
 | Piece | What |
 | --- | --- |
 | `dev/pi5_wdt.c` | BCM2712 PM watchdog (Linux `bcm2835_wdt.c` registers), armed for `CK_PI5_WDT_S` (15 s) at start, petted at every `ck_set_stage`. A hang resets the board; on the hub the tryboot one-shot flag is already cleared, so it comes back on normal Linux. |
diff --git a/native/kernel/core/.crumb b/native/kernel/core/.crumb
index e3c9d37d..4029f2a3 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-13T12:30:58Z",
+      "compiled_at": "2026-10-13T13:55:32Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:1f4276b8bf582552f24f021e12078c4abf288b1e10415b724d7fc71819c115b2",
+      "digest": "sha256:a3800f538eb9f5f3ee2b1dfef888f62ff12756136828f4bbd1df92a881c57e98",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "files": 53,
-      "generated_at_commit": "a01f365f16ea16bb4843f97b031ee72b4e028389",
-      "source_tree": "sha256:72143dfd95ecf8012fe7d70ee418793eab596b343933ae88038ca075b1cdd39c"
+      "files": 55,
+      "generated_at_commit": "535421b0de0c44a5c614c90deffbb5736266bc7c",
+      "source_tree": "sha256:1948784dc57a11db7ca9e4a542ee323257b50593fc37ca8afa45096cc5c7170b"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/kernel/core/artifact_loader.c b/native/kernel/core/artifact_loader.c
index 298f0724..de9aa8b7 100644
--- a/native/kernel/core/artifact_loader.c
+++ b/native/kernel/core/artifact_loader.c
@@ -1066,7 +1066,9 @@ static void print_receipt(const char *name, const struct report *r)
 
 /* 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
+#if defined(CK_PI5_UNLOCK)
+#define CK_RECEIPT_TIER "PI5-UNLOCK-QUALIFICATION"
+#elif defined(CK_PI5)
 #define CK_RECEIPT_TIER "SEED-0B-PI5"
 #else
 #define CK_RECEIPT_TIER "SEED-0B-QEMU"
diff --git a/native/kernel/core/pi5.c b/native/kernel/core/pi5.c
index 04ebc59c..72d88211 100644
--- a/native/kernel/core/pi5.c
+++ b/native/kernel/core/pi5.c
@@ -30,6 +30,9 @@
 #include "disk.h"
 #include "disk_sdhci.h"
 #include "pi5_marker.h"
+#ifdef CK_PI5_UNLOCK_CARD
+#include "unlock_req.h"
+#endif
 #include "../dev/disk_part.h"
 
 #define PI5_SD_PHYS 0x1000fff000ull
@@ -201,7 +204,10 @@ void ck_pi5_before_reset(void)
     ck_pi5_wdt_pet();
 }
 
-#ifdef CK_PI5_STORE
+#if defined(CK_PI5_STORE) || defined(CK_PI5_UNLOCK)
+#if defined(CK_PI5_STORE) && defined(CK_PI5_UNLOCK)
+#error "CK_PI5_STORE (TEST keys) and CK_PI5_UNLOCK (production class keys) are separate images"
+#endif
 /* 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
@@ -211,11 +217,39 @@ const disk_dev *ck_dev_boot_disk(void)
 {
     static int said;
     if (!said++)
+#ifdef CK_PI5_UNLOCK
+        ck_puts("pi5_unlock_tier: PI5-4 recovery-secret unlock: Store keys derive from K_vol (ADR 0017 Slot 1), "
+                "PRODUCTION class; no TEST keys and no TEST uuid exist in this image\n");
+#else
         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");
+#endif
     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
+
+#ifdef CK_PI5_UNLOCK
+/* The recovery secret source of the Pi unlock image (CK_SB_SECRET_LEN = 32, svc/store_boot.h). This
+ * image has no UART input and no TPM. Plain CK_PI5_UNLOCK compiles in no source: the Store stays
+ * closed (ck_store_pi5_unlock_run refuses before reading the disk). CK_PI5_UNLOCK_CARD (QUALIFICATION
+ * ONLY) adds the throwaway secret from the card request file the UEFI stub read (core/unlock_req.h);
+ * it is handed out once and wiped. The source string is printed loudly by the Store stage. */
+int ck_pi5_unlock_secret(uint8_t out[32], const char **source)
+{
+#ifdef CK_PI5_UNLOCK_CARD
+    if (ck_unlock_req_take(out) == 0) {
+        if (source)
+            *source = CK_UNLOCK_REQ_SOURCE;
+        return 0;
+    }
+#else
+    (void)source;
+#endif
+    for (unsigned i = 0; i < 32; i++)
+        out[i] = 0;
+    return -1;
+}
+#endif
diff --git a/native/kernel/core/unlock_req.c b/native/kernel/core/unlock_req.c
new file mode 100644
index 00000000..1390710b
--- /dev/null
+++ b/native/kernel/core/unlock_req.c
@@ -0,0 +1,81 @@
+/* unlock_req.c -- see unlock_req.h. */
+#include "unlock_req.h"
+
+struct ck_unlock_req_boot ck_unlock_req_boot;
+
+static void wipe(void *p, size_t n)
+{
+    volatile uint8_t *b = p;
+    while (n--)
+        *b++ = 0;
+}
+
+int ck_unlock_req_check(const struct ck_unlock_req *q, const char **why)
+{
+    const char *w = 0;
+    const uint8_t *p = (const uint8_t *)q;
+    if (!q) {
+        w = "no request";
+        goto out;
+    }
+    for (unsigned i = 0; i < 8; i++)
+        if (q->magic[i] != (uint8_t)CK_UNLOCK_REQ_MAGIC[i]) {
+            w = "bad magic";
+            goto out;
+        }
+    if (q->version != CK_UNLOCK_REQ_VERSION) {
+        w = "bad version";
+        goto out;
+    }
+    if (q->flags != 0) {
+        w = "flags must be zero";
+        goto out;
+    }
+    for (unsigned i = 0; i < 16; i++)
+        if (q->tag[i] != (uint8_t)CK_UNLOCK_REQ_TAG[i]) {
+            w = "tier tag is not QUALIF-THROWAWAY";
+            goto out;
+        }
+    {
+        unsigned zero = 1, same = 1;
+        for (unsigned i = 0; i < CK_UNLOCK_REQ_SECRET_LEN; i++) {
+            if (q->secret[i] != 0)
+                zero = 0;
+            if (q->secret[i] != q->secret[0])
+                same = 0;
+        }
+        if (zero || same) {
+            w = "secret is all zero or one repeated byte";
+            goto out;
+        }
+    }
+    for (unsigned i = 64; i < CK_UNLOCK_REQ_SIZE; i++)
+        if (p[i] != 0) {
+            w = "padding is not zero";
+            goto out;
+        }
+out:
+    if (why)
+        *why = w;
+    return w ? -1 : 0;
+}
+
+void ck_unlock_req_store(const struct ck_unlock_req *q)
+{
+    for (unsigned i = 0; i < CK_UNLOCK_REQ_SECRET_LEN; i++)
+        ck_unlock_req_boot.secret[i] = q->secret[i];
+    ck_unlock_req_boot.state = CK_UNLOCK_REQ_FOUND;
+}
+
+int ck_unlock_req_take(uint8_t out[CK_UNLOCK_REQ_SECRET_LEN])
+{
+    if (ck_unlock_req_boot.state != CK_UNLOCK_REQ_FOUND) {
+        wipe(out, CK_UNLOCK_REQ_SECRET_LEN);
+        return -1;
+    }
+    for (unsigned i = 0; i < CK_UNLOCK_REQ_SECRET_LEN; i++)
+        out[i] = ck_unlock_req_boot.secret[i];
+    wipe(ck_unlock_req_boot.secret, CK_UNLOCK_REQ_SECRET_LEN);
+    ck_unlock_req_boot.state = CK_UNLOCK_REQ_NONE;
+    return 0;
+}
diff --git a/native/kernel/core/unlock_req.h b/native/kernel/core/unlock_req.h
new file mode 100644
index 00000000..90f04fdd
--- /dev/null
+++ b/native/kernel/core/unlock_req.h
@@ -0,0 +1,60 @@
+/* unlock_req.h -- the card unlock request file of the Pi qualification image
+ * (PI5-4 cut 2, build flag CK_PI5_UNLOCK_CARD, only with CK_PI5_UNLOCK).
+ *
+ * QUALIFICATION ONLY. The Pi has no TPM and nothing reads its serial port
+ * during a run, so the run tool (pi5-run.sh UNLOCK_REQ=<file>) may place
+ * \EFI\AIENOS\UNLOCK.REQ on the card's EFI partition holding a THROWAWAY
+ * 32-byte recovery secret. The UEFI stub (native/boot/efi_unlock.c) reads it
+ * before ExitBootServices, the Store stage takes the secret exactly once and
+ * runs the same Slot 1 path an operator's `unlock <64-hex>` would. The file
+ * is deleted from the card after the run. A real operator secret must never
+ * be put in such a file: the tier tag below says so in the bytes themselves.
+ *
+ * File layout, exactly 512 bytes, little endian, everything else zero:
+ *   0   magic "AIENUNQ1"
+ *   8   version 1
+ *   12  flags 0
+ *   16  tier tag "QUALIF-THROWAWAY" (16 ASCII bytes, no NUL)
+ *   32  secret, 32 bytes (not all zero, not all one byte value)
+ *   64  zero padding to 512
+ * The secret is never printed. */
+#ifndef AIENOS_CK_UNLOCK_REQ_H
+#define AIENOS_CK_UNLOCK_REQ_H
+#include <stddef.h>
+#include <stdint.h>
+
+#define CK_UNLOCK_REQ_MAGIC "AIENUNQ1"
+#define CK_UNLOCK_REQ_TAG "QUALIF-THROWAWAY"
+#define CK_UNLOCK_REQ_VERSION 1u
+#define CK_UNLOCK_REQ_SIZE 512u
+#define CK_UNLOCK_REQ_SECRET_LEN 32u
+#define CK_UNLOCK_REQ_PATH "\\EFI\\AIENOS\\UNLOCK.REQ"
+#define CK_UNLOCK_REQ_SOURCE "card request file (QUALIFICATION ONLY, throwaway secret)"
+
+struct ck_unlock_req {
+    uint8_t magic[8];
+    uint32_t version;
+    uint32_t flags;
+    uint8_t tag[16];
+    uint8_t secret[CK_UNLOCK_REQ_SECRET_LEN];
+    uint8_t pad[CK_UNLOCK_REQ_SIZE - 64];
+};
+
+/* 0 = well formed; else -1 and *why names the first failed check (never the secret). */
+int ck_unlock_req_check(const struct ck_unlock_req *q, const char **why);
+
+enum { CK_UNLOCK_REQ_NONE = 0, CK_UNLOCK_REQ_ABSENT = 1, CK_UNLOCK_REQ_REFUSED = 2, CK_UNLOCK_REQ_FOUND = 3 };
+
+/* What the UEFI stub found (shared with the kernel: the stub and the kernel are one image). */
+struct ck_unlock_req_boot {
+    int state;                                /* CK_UNLOCK_REQ_* */
+    uint8_t secret[CK_UNLOCK_REQ_SECRET_LEN]; /* only while state is FOUND */
+};
+extern struct ck_unlock_req_boot ck_unlock_req_boot;
+
+/* The stub stores a checked request (state FOUND, secret copied). */
+void ck_unlock_req_store(const struct ck_unlock_req *q);
+/* One-shot: copies the secret out and wipes the boot copy (state back to NONE) and returns 0;
+ * returns -1 and zeroes out when there is no found request (or it was already taken). */
+int ck_unlock_req_take(uint8_t out[CK_UNLOCK_REQ_SECRET_LEN]);
+#endif
diff --git a/native/kernel/dev/.crumb b/native/kernel/dev/.crumb
index 7758279d..1db87cd8 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-13T12:30:58Z",
+      "compiled_at": "2026-10-13T13:55:32Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:ce05eacbe36c1ae486f78c41446fe810a33aa95e152437b7d95ebf60437802a8",
+      "digest": "sha256:fc1238a186e63fedc2604dff5dbd433f092f55e44a32cdd5d304c9e35fba0974",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "files": 32,
-      "generated_at_commit": "a01f365f16ea16bb4843f97b031ee72b4e028389",
-      "source_tree": "sha256:3c12c30529809e47200d0717160a804e89f7d310a93562d2c55d340b8cb0888b"
+      "files": 33,
+      "generated_at_commit": "535421b0de0c44a5c614c90deffbb5736266bc7c",
+      "source_tree": "sha256:fd3d6df1cb8ba8150e05030091871ccb0cdbbb08d58bca13c4b0e533fc544d07"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/kernel/dev/tests/pi5_unlock_test.c b/native/kernel/dev/tests/pi5_unlock_test.c
new file mode 100644
index 00000000..d7efa7b9
--- /dev/null
+++ b/native/kernel/dev/tests/pi5_unlock_test.c
@@ -0,0 +1,255 @@
+/* pi5_unlock_test.c -- AIENOS PI5-4 cut 1 host test: the Pi unlock image's Store policy
+ * (svc/store_boot.c ck_store_pi5_unlock_run, compiled with -DCK_PI5_UNLOCK exactly as
+ * "make pi5-unlock" builds it) over the Pi card layout. A file stands in for the card.
+ *
+ * Proves: no secret -> refused before the disk is read, nothing written; TEST-identity keys are
+ * refused by the image's own policy (store_boot_run) before any disk access, on a blank card and on
+ * a PRODUCTION Store; a TEST-tier Store (formatted with TEST keys and the TEST uuid by a different
+ * image) is refused by the unlock path with no keyslot manifest, nothing written; a wrong secret
+ * is refused, nothing written; the right secret on a blank card formats a PRODUCTION-class Store
+ * under a drawn uuid that is not the TEST uuid; the same secret reopens it and the generation
+ * advances. The TEST keys are built here from the public label, because the image itself does not
+ * contain them (scripts/ck_pi5_build_check.sh checks that on the real ELF). 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 "m5.h"
+#include "sha256.h"
+#include "store_boot.h"
+#include "../../core/unlock_req.h"
+
+#ifndef CK_PI5_UNLOCK
+#error "pi5_unlock_test.c must be built with -DCK_PI5_UNLOCK (the image's policy)"
+#endif
+#ifdef CK_STORE_TEST_KEYS
+#error "the unlock image must not compile the TEST keys"
+#endif
+
+static int checks, failures;
+#define CHECK(c)                                                    \
+    do {                                                            \
+        checks++;                                                   \
+        if (!(c)) {                                                 \
+            failures++;                                             \
+            printf("  FAIL %s:%d: %s\n", __FILE__, __LINE__, #c);   \
+        }                                                           \
+    } while (0)
+
+extern int ck_host_entropy_refuse;
+
+/* The secret source symbol the stage references; the real one lives in core/pi5.c. */
+int ck_pi5_unlock_secret(uint8_t out[CK_SB_SECRET_LEN], const char **source)
+{
+    (void)out;
+    (void)source;
+    return -1;
+}
+
+#define BLOCKS 262144ull
+#define PART_FIRST 8192u
+#define PART_SECS 8192u
+static char g_path[256];
+
+/* The public TEST keys and uuid of the SEED-0B-PI5 image, rebuilt here (public label, not secret). */
+static const uint8_t test_uuid[16] = {'A', 'I', 'E', 'N', '-', 'T', 'E', 'S', 'T', '-', 'B', 'O', 'O', 'T', '0', '1'};
+static void test_keys(ss_keys *k)
+{
+    uint8_t kvol[32];
+    m5_subkeys sk;
+    static const char label[] = "AIENOS-LANE18-TEST-KVOL-NOT-SECRET";
+    sha256_hash((const uint8_t *)label, sizeof label - 1, kvol);
+    memset(k, 0, sizeof *k);
+    m5_derive_subkeys(kvol, M5_ID_TEST, 0, &sk);
+    k->identity_class = M5_ID_TEST;
+    k->key_generation = 1;
+    memcpy(k->k_root_auth, sk.k_root_auth, 32);
+    memcpy(k->k_domain, sk.k_artifact, 32);
+    m5_subkeys_wipe(&sk);
+}
+
+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;
+}
+
+enum { BOOT_TESTKEYS_POLICY, BOOT_TESTKEYS_IMAGE, BOOT_UNLOCK };
+/* One boot on the Store view of the card file. */
+static int boot(int mode, const uint8_t *secret, ck_store_report *r)
+{
+    disk_file f;
+    disk_dev d;
+    ck_part p, sp;
+    ck_gpt_info gi;
+    ss_keys k;
+    if (disk_file_open(&f, &d, g_path, 512, 0, 0)) return -9999;
+    if (ck_gpt_find_aienos(&d, &p, &gi) || ck_pi5_store_view(&p, &sp)) { disk_file_close(&f); return -9998; }
+    ck_host_quiet = 1;
+    int rc;
+    test_keys(&k);
+    if (mode == BOOT_TESTKEYS_POLICY) rc = store_boot_run_policy(&sp.dev, &k, test_uuid, "pi5-unlock-test", 0, r);
+    else if (mode == BOOT_TESTKEYS_IMAGE) rc = store_boot_run(&sp.dev, &k, test_uuid, "pi5-unlock-test", r);
+    else rc = ck_store_pi5_unlock_run(&sp.dev, secret, "pi5-unlock-test", r);
+    ck_host_quiet = 0;
+    memset(&k, 0, sizeof k);
+    disk_file_close(&f);
+    return rc;
+}
+
+static int same_bytes(const uint8_t *a, size_t na, const uint8_t *b, size_t nb)
+{
+    return a && b && na == nb && memcmp(a, b, na) == 0;
+}
+
+int main(void)
+{
+    snprintf(g_path, sizeof g_path, "/tmp/aienos-pi5-unlock-test-%d.img", (int)getpid());
+    gw_part gp[2] = {{gw_esp_type, 2048, 4095, "AIENOSPI5-ESP", 0x5a}, {ck_aienos_part_type, PART_FIRST, PART_FIRST + PART_SECS - 1, "AIENOS", 0}};
+    CHECK(gw_write(g_path, 512, BLOCKS, gp, 2, 0) == 0);
+    uint8_t S[CK_SB_SECRET_LEN], W[CK_SB_SECRET_LEN];
+    for (int i = 0; i < 32; i++) S[i] = (uint8_t)(i * 11 + 3);
+    memcpy(W, S, 32);
+    W[31] ^= 0x80;
+    ck_store_report r;
+    size_t n0, n1;
+    uint8_t *b, *a;
+
+    /* 1. No secret source: refused before the disk is read; a blank card stays blank. */
+    b = slurp(&n0);
+    int rc = boot(BOOT_UNLOCK, 0, &r);
+    a = slurp(&n1);
+    CHECK(rc == CK_SB_E_BLOCKED_OPERATOR && r.verdict == CK_SB_REFUSED && r.formatted == 0);
+    CHECK(r.proof && strcmp(r.proof, "keyed") == 0);
+    CHECK(same_bytes(b, n0, a, n1));
+    free(b);
+    free(a);
+
+    /* 2. TEST keys against the image's own policy (hardware policy): refused before any disk access. */
+    b = slurp(&n0);
+    rc = boot(BOOT_TESTKEYS_IMAGE, 0, &r);
+    a = slurp(&n1);
+    CHECK(rc == CK_SB_E_TEST_KEYS && r.verdict == CK_SB_REFUSED && r.formatted == 0);
+    CHECK(same_bytes(b, n0, a, n1));
+    free(b);
+    free(a);
+
+    /* 3. A TEST-tier Store (made by the SEED-0B-PI5 image's policy, TEST keys + TEST uuid) is not a
+     * production Store: the unlock path finds no keyslot manifest and refuses, nothing written. */
+    rc = boot(BOOT_TESTKEYS_POLICY, 0, &r);
+    CHECK(rc == 0 && r.verdict == CK_SB_COMMITTED && r.formatted == 1 && r.identity_class == M5_ID_TEST);
+    b = slurp(&n0);
+    rc = boot(BOOT_UNLOCK, S, &r);
+    a = slurp(&n1);
+    CHECK(rc == CK_SB_E_NO_KEYSLOT && r.verdict == CK_SB_REFUSED && r.formatted == 0);
+    CHECK(same_bytes(b, n0, a, n1));
+    free(b);
+    free(a);
+    rc = boot(BOOT_TESTKEYS_IMAGE, 0, &r); /* and the image policy still refuses TEST keys on a Store that has TEST content */
+    CHECK(rc == CK_SB_E_TEST_KEYS);
+
+    /* Fresh blank card for the production path. */
+    CHECK(gw_write(g_path, 512, BLOCKS, gp, 2, 0) == 0);
+
+    /* 4. Blank card, entropy refused: no genesis, nothing written. */
+    b = slurp(&n0);
+    ck_host_entropy_refuse = 1;
+    rc = boot(BOOT_UNLOCK, S, &r);
+    ck_host_entropy_refuse = 0;
+    a = slurp(&n1);
+    CHECK(rc == CK_SB_E_ENTROPY && r.formatted == 0 && same_bytes(b, n0, a, n1));
+    free(b);
+    free(a);
+
+    /* 5. Blank card, secret S: formatted PRODUCTION-class Store under a drawn uuid (not the TEST uuid). */
+    rc = boot(BOOT_UNLOCK, S, &r);
+    CHECK(rc == 0 && r.verdict == CK_SB_COMMITTED && r.formatted == 1 && r.unlocked_genesis == 1);
+    CHECK(r.identity_class == M5_ID_PRODUCTION && r.boot_count_new == 1);
+    CHECK(r.key_source && strcmp(r.key_source, "recovery-keyslot") == 0);
+    CHECK(store_boot_store()->has_keyslot == 1 && store_boot_store()->keys.identity_class == M5_ID_PRODUCTION);
+    CHECK(memcmp(store_boot_store()->uuid, test_uuid, 16) != 0);
+    uint64_t g1 = r.gen_commit;
+
+    /* 6. Wrong secret: refused, nothing written. */
+    b = slurp(&n0);
+    rc = boot(BOOT_UNLOCK, W, &r);
+    a = slurp(&n1);
+    CHECK(rc == CK_SB_E_SECRET_REJECTED && r.verdict == CK_SB_REFUSED && r.formatted == 0);
+    CHECK(same_bytes(b, n0, a, n1));
+    free(b);
+    free(a);
+
+    /* 7. TEST keys on the production Store: refused by policy, nothing written. */
+    b = slurp(&n0);
+    rc = boot(BOOT_TESTKEYS_IMAGE, 0, &r);
+    a = slurp(&n1);
+    CHECK(rc == CK_SB_E_TEST_KEYS && same_bytes(b, n0, a, n1));
+    free(b);
+    free(a);
+
+    /* 8. Reboot, secret S: reopens, no reformat, generation advances, boot count 2. */
+    rc = boot(BOOT_UNLOCK, S, &r);
+    CHECK(rc == 0 && r.verdict == CK_SB_COMMITTED && r.formatted == 0 && r.unlocked_genesis == 0);
+    CHECK(r.boot_count_prev == 1 && r.boot_count_new == 2 && r.gen_open == g1 && r.gen_commit > g1);
+    CHECK(strcmp(r.prev_commit, "pi5-unlock-test") == 0 && r.identity_class == M5_ID_PRODUCTION);
+    CHECK(memcmp(store_boot_store()->uuid, test_uuid, 16) != 0);
+
+    /* 9. Card request file (cut 2) end to end: a malformed request gives no secret and the blank card
+     * stays blank; a well-formed one is taken once, formats on the first run and reopens on the second
+     * (each "run" has its own boot-time request, as pi5-run.sh places it). */
+    {
+        struct ck_unlock_req q;
+        uint8_t got[CK_SB_SECRET_LEN];
+        const char *why = 0;
+        CHECK(gw_write(g_path, 512, BLOCKS, gp, 2, 0) == 0);
+        memset(&q, 0, sizeof q);
+        memcpy(q.magic, CK_UNLOCK_REQ_MAGIC, 8);
+        q.version = CK_UNLOCK_REQ_VERSION;
+        memcpy(q.tag, "QUALIF-THROWAWAY", 16);
+        for (int i = 0; i < 32; i++) q.secret[i] = (uint8_t)(0x90 ^ (i * 5));
+        q.tag[0] = 'q'; /* not the tier tag: the stub refuses it, nothing is stored */
+        memset(&ck_unlock_req_boot, 0, sizeof ck_unlock_req_boot);
+        CHECK(ck_unlock_req_check(&q, &why) != 0);
+        b = slurp(&n0);
+        int have = ck_unlock_req_take(got) == 0;
+        rc = boot(BOOT_UNLOCK, have ? got : 0, &r);
+        a = slurp(&n1);
+        CHECK(!have && rc == CK_SB_E_BLOCKED_OPERATOR && same_bytes(b, n0, a, n1));
+        free(b);
+        free(a);
+        q.tag[0] = 'Q';
+        for (int run = 0; run < 2; run++) {
+            CHECK(ck_unlock_req_check(&q, &why) == 0);
+            ck_unlock_req_store(&q);
+            CHECK(ck_unlock_req_take(got) == 0);
+            rc = boot(BOOT_UNLOCK, got, &r);
+            CHECK(rc == 0 && r.verdict == CK_SB_COMMITTED && r.identity_class == M5_ID_PRODUCTION);
+            CHECK(r.formatted == (run == 0) && r.boot_count_new == (uint64_t)run + 1);
+            CHECK(ck_unlock_req_take(got) == -1); /* the request is single use per boot */
+        }
+        memset(&q, 0, sizeof q);
+        memset(got, 0, sizeof got);
+    }
+
+    memset(S, 0, sizeof S);
+    memset(W, 0, sizeof W);
+    unlink(g_path);
+    printf("pi5_unlock_test: %d checks, %d failures\n", checks, failures);
+    printf("CK_PI5_UNLOCK_HOST: %s\n", failures ? "FAIL" : "PASS");
+    return failures ? 1 : 0;
+}
diff --git a/native/kernel/stage.mk b/native/kernel/stage.mk
index b6f6d84a..1efb679a 100644
--- a/native/kernel/stage.mk
+++ b/native/kernel/stage.mk
@@ -175,3 +175,20 @@ 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
+
+# ---- AIENOS PI5-4 cut 1: the Pi unlock image's Store policy (dev/tests/pi5_unlock_test.c) ----
+# store_boot.c is compiled with -DCK_PI5_UNLOCK, as "make pi5-unlock" builds it: no TEST keys, no TEST uuid.
+PI5_UNLOCK_TEST_SRCS := $(filter-out %/disk_part_test.c,$(DISK_PART_TEST_SRCS)) $(STAGE_CONT_SRCS) $(STAGE_DIR)/core/pi5_marker.c $(STAGE_DIR)/core/unlock_req.c $(STAGE_DIR)/dev/tests/pi5_unlock_test.c
+$(STAGE_OUT)/pi5_unlock_test: $(PI5_UNLOCK_TEST_SRCS) $(DISK_PART_TEST_DEPS) $(STAGE_DIR)/core/pi5_marker.h
+	@mkdir -p $(@D)
+	$(STAGE_CC) $(STAGE_HOST_FLAGS) -DCK_PI5_UNLOCK=1 $(DISK_PART_INC) -o $@ $(PI5_UNLOCK_TEST_SRCS)
+$(STAGE_OUT)/pi5_unlock_test_san: $(PI5_UNLOCK_TEST_SRCS) $(DISK_PART_TEST_DEPS) $(STAGE_DIR)/core/pi5_marker.h
+	@mkdir -p $(@D)
+	$(STAGE_CC) $(STAGE_HOST_FLAGS) $(STAGE_SAN_FLAGS) -DCK_PI5_UNLOCK=1 $(DISK_PART_INC) -o $@ $(PI5_UNLOCK_TEST_SRCS)
+.PHONY: pi5-unlock-test pi5-unlock-sanitize
+pi5-unlock-test: $(STAGE_OUT)/pi5_unlock_test
+	$<
+pi5-unlock-sanitize: $(STAGE_OUT)/pi5_unlock_test_san
+	ASAN_OPTIONS=detect_leaks=1 UBSAN_OPTIONS=print_stacktrace=1 $<
+stage-test: pi5-unlock-test
+stage-sanitize: pi5-unlock-sanitize
diff --git a/native/kernel/svc/.crumb b/native/kernel/svc/.crumb
index cab092a8..0094d550 100644
--- a/native/kernel/svc/.crumb
+++ b/native/kernel/svc/.crumb
@@ -30,14 +30,14 @@
         }
       ],
       "children_root": "sha256:d835471b1405ca482a41beb34ed339d21e11064a59138599ee5754d198926878",
-      "compiled_at": "2026-10-12T20:56:51Z",
+      "compiled_at": "2026-10-13T13:47:59Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:f2ef5ffe9eae8f9119dd302b55989b8b50f68def6ad03a2db227e28dbd270ddd",
+      "digest": "sha256:1269af87b047348f0eec4bf57ba98cbff4fd643a8bb7a619fa1771183c95cf17",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 43,
-      "generated_at_commit": "04e39e7223149deef6c14e4175d40e80c63eee0a",
-      "source_tree": "sha256:8d9bbcbf03ff3204145e5708e278082fbaea58c8b02b12f2c4fbd1adee241633"
+      "generated_at_commit": "5ec8143c971e96ddca3aab21b30128ca9b122455",
+      "source_tree": "sha256:f9821387dc747782d77349245ac1145e74fc8da871f0aca910d16863c9af185f"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/kernel/svc/store_boot.c b/native/kernel/svc/store_boot.c
index 03e45ed2..4e3ec30b 100644
--- a/native/kernel/svc/store_boot.c
+++ b/native/kernel/svc/store_boot.c
@@ -24,6 +24,18 @@
 #if defined(CK_STORE_TEST_KEYS)
 #error "CK_STORE_TEST_KEYS (TEST Store keys, TEST uuid) cannot be combined with CK_HARDWARE_STAGING"
 #endif
+#if defined(CK_PI5_UNLOCK)
+#error "CK_PI5_UNLOCK cannot be combined with CK_HARDWARE_STAGING"
+#endif
+#define CK_SB_HW 1
+#elif defined(CK_PI5_UNLOCK)
+/* Pi unlock image (CK_PI5_UNLOCK): the Store opens only through the Slot 1 recovery-secret path
+ * (ck_store_pi5_unlock_run). No TEST keys, no TEST uuid are compiled, and the policy is the
+ * hardware one: TEST-identity keys are refused before any disk access. It needs no owner
+ * provisioning header (the store uuid is drawn at genesis or read from the manifest). */
+#if defined(CK_STORE_TEST_KEYS) || defined(CK_PI5_STORE) || defined(CK_TEST_STORE_CRASH) || defined(CK_SERVICE)
+#error "CK_PI5_UNLOCK cannot be combined with TEST keys, CK_PI5_STORE, CK_TEST_STORE_CRASH or CK_SERVICE"
+#endif
 #define CK_SB_HW 1
 #else
 #define CK_STORE_TEST_KEYS 1
@@ -703,6 +715,26 @@ static int service_continuity(void)
 }
 #endif
 
+#ifdef CK_PI5_UNLOCK
+/* Pi unlock image policy (ck_stage_store calls this, the host test pi5_unlock_test drives it).
+ * secret NULL (no source gave one): refused before the disk is read, nothing written. Otherwise the
+ * Slot 1 recovery path with the hardware policy: a wrong secret fails the K_vol unwrap tag before the
+ * disk is opened; a disk with no KeySlotManifest (for example a TEST-tier Store) is refused; a blank
+ * disk is formatted with a PRODUCTION-class Store under a freshly drawn uuid. */
+int ck_store_pi5_unlock_run(const disk_dev *d, const uint8_t *secret, const char *commit, ck_store_report *r)
+{
+    if (!secret) {
+        bz(r, sizeof *r);
+        bcp(r->prev_commit, "none", 5);
+        r->identity_class = M5_ID_PRODUCTION;
+        r->key_source = "recovery-keyslot";
+        return fail(r, "keyed", "no recovery secret source in this image; disk not read, not formatted",
+                    CK_SB_E_BLOCKED_OPERATOR);
+    }
+    return ck_store_unlock_boot(d, secret, 0, commit ? commit : "unknown", CK_SB_HW, r);
+}
+#endif
+
 /* Kernel stage. ck_dev_boot_disk comes from dev/devices.c. */
 const disk_dev *ck_dev_boot_disk(void);
 void ck_dev_nvme_release(void);
@@ -780,10 +812,23 @@ int ck_stage_store(void)
             "or the lifecycle stop order\n");
     (void)commit;
     return rc;
+#else
+#if defined(CK_PI5_UNLOCK)
+    {
+        uint8_t secret[CK_SB_SECRET_LEN];
+        const char *src = 0;
+        int have = ck_pi5_unlock_secret(secret, &src) == 0;
+        if (have) ck_printf("unlock_source: %s\n", src ? src : "unknown");
+        else ck_puts("unlock_source: none (no recovery secret given); Store not opened\n");
+        rc = ck_store_pi5_unlock_run(d, have ? secret : 0, commit, &r);
+        bz(secret, sizeof secret);
+        bz(&keys, sizeof keys);
+    }
 #else
     ck_store_test_keys(&keys);
     rc = store_boot_run(d, &keys, ck_store_test_uuid, commit ? commit : "unknown", &r);
 #endif
+#endif
 #endif
     bz(&keys, sizeof keys);
     store_boot_print(&r);
diff --git a/native/kernel/svc/store_boot.h b/native/kernel/svc/store_boot.h
index 5d3640e0..8cdb26fa 100644
--- a/native/kernel/svc/store_boot.h
+++ b/native/kernel/svc/store_boot.h
@@ -153,6 +153,14 @@ int ck_store_unlock_boot(const disk_dev *d, const uint8_t secret[CK_SB_SECRET_LE
  * nothing. Prints nothing. */
 int ck_store_rotate_recovery(const disk_dev *d, const uint8_t current[CK_SB_SECRET_LEN],
                              const uint8_t next[CK_SB_SECRET_LEN], ck_store_report *r);
+#ifdef CK_PI5_UNLOCK
+/* Pi unlock image only. The board glue (core/pi5.c) supplies the recovery secret source: returns 0 and
+ * fills out with the 32-byte secret, naming the source in *source (printed by the Store stage, never the
+ * secret); nonzero = no secret. ck_store_pi5_unlock_run: NULL secret refuses before any disk read; else the
+ * Slot 1 path with the hardware policy (TEST keys and TEST uuid do not exist in this image). Prints nothing. */
+int ck_pi5_unlock_secret(uint8_t out[CK_SB_SECRET_LEN], const char **source);
+int ck_store_pi5_unlock_run(const disk_dev *d, const uint8_t *secret, const char *commit, ck_store_report *r);
+#endif
 /* Print the report lines (also used by the host test). */
 void store_boot_print(const ck_store_report *r);
 /* The open Store of the last store_boot_run (valid only after it returned 0;
diff --git a/native/kernel/tests/.crumb b/native/kernel/tests/.crumb
index f231e838..42e786de 100644
--- a/native/kernel/tests/.crumb
+++ b/native/kernel/tests/.crumb
@@ -7,14 +7,14 @@
     "generated": {
       "children": [],
       "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "compiled_at": "2026-10-13T12:30:58Z",
+      "compiled_at": "2026-10-13T13:55:32Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:ae1566720e4d7f5c05d03a40297cbc77b0b8891acea51dedbbf181944e89f8a4",
+      "digest": "sha256:eeb3f3e295f20349daba59ddf7c896ef121edceb954342c2f04bf27233127f13",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "files": 156,
-      "generated_at_commit": "a01f365f16ea16bb4843f97b031ee72b4e028389",
-      "source_tree": "sha256:f2e4f41188e81134ea1d7138f1e6801b50941dc90bbd7fbee155372444af4e68"
+      "files": 157,
+      "generated_at_commit": "535421b0de0c44a5c614c90deffbb5736266bc7c",
+      "source_tree": "sha256:1c4ee373454f24cda3b5fac4610211b15edfb299bf55a6ebfd3cf37fb8f6810a"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/kernel/tests/test_unlock_req.c b/native/kernel/tests/test_unlock_req.c
new file mode 100644
index 00000000..f2bd5892
--- /dev/null
+++ b/native/kernel/tests/test_unlock_req.c
@@ -0,0 +1,86 @@
+/* test_unlock_req.c -- core/unlock_req.c: the card unlock request file of the Pi qualification
+ * image (CK_PI5_UNLOCK_CARD). Every malformed request is refused with a reason that never
+ * contains the secret; a well-formed one is handed out exactly once and then wiped. */
+#include <string.h>
+#include "ck_test.h"
+#include "unlock_req.h"
+
+_Static_assert(sizeof(struct ck_unlock_req) == CK_UNLOCK_REQ_SIZE, "request is exactly one sector");
+
+static struct ck_unlock_req good(void)
+{
+    struct ck_unlock_req q;
+    memset(&q, 0, sizeof q);
+    memcpy(q.magic, CK_UNLOCK_REQ_MAGIC, 8);
+    q.version = CK_UNLOCK_REQ_VERSION;
+    memcpy(q.tag, CK_UNLOCK_REQ_TAG, 16);
+    for (int i = 0; i < 32; i++)
+        q.secret[i] = (uint8_t)(0x30 + i * 3);
+    return q;
+}
+
+static int refused(const struct ck_unlock_req *q, const char *want)
+{
+    const char *why = 0;
+    int rc = ck_unlock_req_check(q, &why);
+    return rc != 0 && why && strstr(why, want) != 0;
+}
+
+int main(void)
+{
+    struct ck_unlock_req q = good();
+    const char *why = 0;
+    CHECK(ck_unlock_req_check(&q, &why) == 0 && why == 0);
+    CHECK(ck_unlock_req_check(0, &why) != 0);
+    CHECK(strlen(CK_UNLOCK_REQ_TAG) == 16);
+    CHECK(strstr(CK_UNLOCK_REQ_SOURCE, "QUALIFICATION ONLY, throwaway secret") != 0);
+
+    q = good(); q.magic[0] ^= 1;
+    CHECK(refused(&q, "magic"));
+    q = good(); q.version = 2;
+    CHECK(refused(&q, "version"));
+    q = good(); q.flags = 1;
+    CHECK(refused(&q, "flags"));
+    q = good(); q.tag[15] = 'X';
+    CHECK(refused(&q, "THROWAWAY")); /* a request that does not say throwaway is not accepted */
+    q = good(); memset(q.tag, 0, 16);
+    CHECK(refused(&q, "THROWAWAY"));
+    q = good(); memset(q.secret, 0, 32);
+    CHECK(refused(&q, "all zero"));
+    q = good(); memset(q.secret, 0x41, 32);
+    CHECK(refused(&q, "repeated byte"));
+    q = good(); q.secret[31] ^= 0x01; /* a one-bit change is still a valid (different) secret */
+    CHECK(ck_unlock_req_check(&q, &why) == 0);
+    q = good(); q.pad[0] = 1;
+    CHECK(refused(&q, "padding"));
+    q = good(); q.pad[sizeof q.pad - 1] = 1;
+    CHECK(refused(&q, "padding"));
+    /* the reason text never carries secret bytes */
+    q = good(); q.version = 7;
+    ck_unlock_req_check(&q, &why);
+    CHECK(why && !strstr(why, "0x") && strlen(why) < 64);
+
+    /* One-shot take. */
+    uint8_t out[32];
+    memset(&ck_unlock_req_boot, 0, sizeof ck_unlock_req_boot);
+    memset(out, 0xEE, sizeof out);
+    CHECK(ck_unlock_req_take(out) == -1);          /* nothing stored: refused */
+    int z = 0;
+    for (int i = 0; i < 32; i++) z |= out[i];
+    CHECK(z == 0);                                 /* and the caller's buffer is zeroed */
+    q = good();
+    ck_unlock_req_store(&q);
+    CHECK(ck_unlock_req_boot.state == CK_UNLOCK_REQ_FOUND);
+    CHECK(ck_unlock_req_take(out) == 0 && memcmp(out, q.secret, 32) == 0);
+    int left = 0;
+    for (int i = 0; i < 32; i++) left |= ck_unlock_req_boot.secret[i];
+    CHECK(left == 0 && ck_unlock_req_boot.state == CK_UNLOCK_REQ_NONE); /* the boot copy is wiped */
+    CHECK(ck_unlock_req_take(out) == -1);          /* a second take gets nothing */
+    /* ABSENT and REFUSED states hand out nothing even if bytes were somehow left. */
+    ck_unlock_req_boot.state = CK_UNLOCK_REQ_REFUSED;
+    memset(ck_unlock_req_boot.secret, 0x55, 32);
+    CHECK(ck_unlock_req_take(out) == -1);
+    ck_unlock_req_boot.state = CK_UNLOCK_REQ_ABSENT;
+    CHECK(ck_unlock_req_take(out) == -1);
+    return ck_t_verdict("test_unlock_req");
+}
diff --git a/scripts/.crumb b/scripts/.crumb
index 20fb80f7..b1a318f9 100644
--- a/scripts/.crumb
+++ b/scripts/.crumb
@@ -7,14 +7,14 @@
     "generated": {
       "children": [],
       "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "compiled_at": "2026-10-13T12:30:58Z",
+      "compiled_at": "2026-10-13T13:55:32Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:ebacb9a6843c9319ee3cb65d8af90e79b76b22398528626d71363a7d45b98d1a",
+      "digest": "sha256:f2439778c4be0d383e54636dc2364563ac9a3904b827de7c295041c764720d19",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "files": 93,
-      "generated_at_commit": "a01f365f16ea16bb4843f97b031ee72b4e028389",
-      "source_tree": "sha256:49654498fcaa2f5b45324f8fd47fdd36fc150a68a8bcc1252979f9cb38c17c23"
+      "files": 94,
+      "generated_at_commit": "535421b0de0c44a5c614c90deffbb5736266bc7c",
+      "source_tree": "sha256:8d889cc8678cd43b607625c2d81c44dffa42a6b3aaa6e2a0c1aba5161668fd7b"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/scripts/ck_pi5_build_check.sh b/scripts/ck_pi5_build_check.sh
index 305e780f..b9120121 100755
--- a/scripts/ck_pi5_build_check.sh
+++ b/scripts/ck_pi5_build_check.sh
@@ -32,4 +32,47 @@ 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; }
+# PI5-4 cut 1: the Pi unlock image opens the Store only through the Slot 1 recovery-secret path.
+make -C "${root}/native/kernel" pi5-unlock >/dev/null
+uo="${root}/target/native-kernel-pi5-unlock/full-pi5-unlock/aienos-ck.elf"
+for s in ck_stage_store ck_dev_boot_disk ck_store_unlock_boot ck_store_pi5_unlock_run ck_pi5_unlock_secret; do
+    if defined "${uo}" "${s}"; then echo "PASS pi5-unlock image defines ${s}"; else echo "FAIL pi5-unlock image lacks ${s}"; fail=1; fi
+done
+for s in ck_store_test_keys ck_store_test_uuid; do
+    if defined "${uo}" "${s}"; then echo "FAIL pi5-unlock image defines ${s}"; fail=1; else echo "PASS pi5-unlock image has no ${s}"; fi
+done
+uo_strings="$(strings -a "${uo}")"
+if grep -q "AIEN-TEST-BOOT" <<<"${uo_strings}" || grep -q "LANE18-TEST-KVOL" <<<"${uo_strings}" || grep -q "SEED-0B-PI5" <<<"${uo_strings}" || grep -q "SEED-0B-QEMU" <<<"${uo_strings}"; then
+    echo "FAIL pi5-unlock image carries a TEST uuid, TEST key label or TEST tier label"; fail=1
+else
+    echo "PASS pi5-unlock image carries no TEST uuid, TEST key label or TEST tier label"
+fi
+if defined "${ps}" ck_pi5_unlock_secret; then echo "FAIL pi5-store image defines ck_pi5_unlock_secret"; fail=1; else echo "PASS pi5-store image has no unlock secret source"; fi
+# The tier flags are mutually exclusive: the Makefile must refuse each combination.
+for combo in CK_PI5_STORE=1 CK_SERVICE=1 CK_HARDWARE_STAGING=1 CK_TEST_STORE_CRASH=1 CK_SERVICE_TEST_KEYS=1; do
+    if make -n -C "${root}/native/kernel" CK_PI5_UNLOCK=1 "${combo}" full >/dev/null 2>&1; then echo "FAIL Makefile accepts CK_PI5_UNLOCK=1 with ${combo}"; fail=1; else echo "PASS Makefile refuses CK_PI5_UNLOCK=1 with ${combo}"; fi
+done
+test -s "${root}/target/native-kernel-pi5-unlock/full-pi5-unlock/BOOTAA64.EFI" || { echo "FAIL no pi5-unlock BOOTAA64.EFI"; fail=1; }
+# PI5-4 cut 2: the card request source (QUALIFICATION ONLY) exists only in its own image.
+make -C "${root}/native/kernel" pi5-unlock-card >/dev/null
+uc="${root}/target/native-kernel-pi5-unlock-card/full-pi5-unlock-card/aienos-ck.elf"
+for s in ck_boot_unlock_req_find ck_unlock_req_take ck_unlock_req_check; do
+    if defined "${uc}" "${s}"; then echo "PASS pi5-unlock-card image defines ${s}"; else echo "FAIL pi5-unlock-card image lacks ${s}"; fail=1; fi
+    for other in "${uo}" "${ps}" "${pi5}" "${def}"; do
+        if defined "${other}" "${s}"; then echo "FAIL ${other} defines ${s}"; fail=1; fi
+    done
+done
+echo "PASS no other image (pi5-unlock, pi5-store, pi5, default) defines the card request reader"
+for s in ck_store_test_keys ck_store_test_uuid; do
+    if defined "${uc}" "${s}"; then echo "FAIL pi5-unlock-card image defines ${s}"; fail=1; else echo "PASS pi5-unlock-card image has no ${s}"; fi
+done
+uc_strings="$(strings -a "${uc}")"
+if grep -q "QUALIFICATION ONLY, throwaway secret" <<<"${uc_strings}" && ! grep -q "QUALIFICATION ONLY, throwaway secret" <<<"${uo_strings}"; then echo "PASS the loud unlock_source label is in the card image only"; else echo "FAIL unlock_source label placement"; fail=1; fi
+if grep -q "AIEN-TEST-BOOT\|LANE18-TEST-KVOL\|SEED-0B-" <<<"${uc_strings}"; then echo "FAIL pi5-unlock-card image carries a TEST label"; fail=1; else echo "PASS pi5-unlock-card image carries no TEST label"; fi
+if make -n -C "${root}/native/kernel" CK_PI5_UNLOCK_CARD=1 full >/dev/null 2>&1; then echo "FAIL Makefile accepts CK_PI5_UNLOCK_CARD=1 without CK_PI5_UNLOCK=1"; fail=1; else echo "PASS Makefile refuses CK_PI5_UNLOCK_CARD=1 without CK_PI5_UNLOCK=1"; fi
+for combo in "CK_PI5_UNLOCK=1 CK_PI5_UNLOCK_CARD=1 CK_PI5_PRODUCTION=1" "CK_PI5_UNLOCK=1 CK_PI5_PRODUCTION=1" "CK_PI5_PRODUCTION=1" "CK_PI5_STORE=1 CK_PI5_UNLOCK_CARD=1"; do
+    # shellcheck disable=SC2086
+    if make -n -C "${root}/native/kernel" ${combo} full >/dev/null 2>&1; then echo "FAIL Makefile accepts ${combo}"; fail=1; else echo "PASS Makefile refuses ${combo}"; fi
+done
+test -s "${root}/target/native-kernel-pi5-unlock-card/full-pi5-unlock-card/BOOTAA64.EFI" || { echo "FAIL no pi5-unlock-card BOOTAA64.EFI"; fail=1; }
 if [[ ${fail} == 0 ]]; then echo "CK_PI5_BUILD: PASS"; else echo "CK_PI5_BUILD: FAIL"; exit 1; fi
diff --git a/scripts/pi5_unlock_req.sh b/scripts/pi5_unlock_req.sh
new file mode 100755
index 00000000..526459d1
--- /dev/null
+++ b/scripts/pi5_unlock_req.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+# pi5_unlock_req.sh -- write a THROWAWAY unlock request file for the PI5-4 qualification image
+# (make pi5-unlock-card). QUALIFICATION ONLY. Layout: native/kernel/core/unlock_req.h
+# (512 bytes: magic AIENUNQ1, version 1, flags 0, tag QUALIF-THROWAWAY, 32-byte secret, zero padding).
+#
+#   pi5_unlock_req.sh <out file> [<secret file, exactly 32 bytes>]
+#
+# With no secret file, 32 random bytes come from /dev/urandom. Refuses an output path inside a git
+# checkout (a secret must never be committed) and an existing output file. The secret is never printed.
+# Use a different secret file to make a "wrong secret" request, or the same one to reopen.
+set -euo pipefail
+out="${1:?output file}"
+sec="${2:-}"
+[[ ! -e "${out}" ]] || { echo "refusing: ${out} exists" >&2; exit 1; }
+dir="$(cd "$(dirname "${out}")" && pwd)"
+if git -C "${dir}" rev-parse --git-dir >/dev/null 2>&1; then echo "refusing: ${dir} is inside a git checkout" >&2; exit 1; fi
+tmp="$(mktemp)"; trap 'rm -f "${tmp}"' EXIT
+if [[ -n "${sec}" ]]; then
+    [[ "$(stat -c %s "${sec}")" == 32 ]] || { echo "secret file must be exactly 32 bytes" >&2; exit 1; }
+    cp "${sec}" "${tmp}"
+else
+    head -c 32 /dev/urandom > "${tmp}"
+fi
+# not all zero, not one repeated byte (the kernel refuses those too)
+[[ "$(od -An -v -tx1 "${tmp}" | tr -s ' \n' '\n\n' | sort -u | grep -c .)" -gt 1 ]] || { echo "weak secret refused" >&2; exit 1; }
+umask 077
+{
+    printf 'AIENUNQ1\x01\x00\x00\x00\x00\x00\x00\x00QUALIF-THROWAWAY'
+    cat "${tmp}"
+    head -c 448 /dev/zero
+} > "${out}"
+[[ "$(stat -c %s "${out}")" == 512 ]] || { rm -f "${out}"; echo "internal error: size" >&2; exit 1; }
+echo "wrote ${out} (512 bytes, throwaway secret not shown)"