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

closed derived 6314f8fec56dd67d #228

Imported from GitHub aien-dev/aienux#228 (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 855504965847932436d91822460b8aaaea092674 · Head 4037ce53adff1b8cee2262a43ccda1986b8c303c

Fetch it

A git bundle of the pull request's head, 49185 bytes.

curl -fsSL https://interplane.io/drakestapleton/aienux/patches/6314f8fec56dd67d.bundle -o 6314f8fec56dd67d.bundle
git fetch 6314f8fec56dd67d.bundle refs/pull/228/head

Raw bundle · 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
228
4037ce53adff1b8cee2262a43ccda1986b8c303c
{"kind":"github-import","owner":"aien-dev","repo":"aienux","number":228,"url":"https://github.com/aien-dev/aienux/pull/228","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:00Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/evidence/ck_gates_d80363cc871372963743ae85fc08c6fa4608f9870c4e06e8988f21950c73ace6.json b/evidence/ck_gates_d80363cc871372963743ae85fc08c6fa4608f9870c4e06e8988f21950c73ace6.json
new file mode 100644
index 00000000..740001cb
--- /dev/null
+++ b/evidence/ck_gates_d80363cc871372963743ae85fc08c6fa4608f9870c4e06e8988f21950c73ace6.json
@@ -0,0 +1,44 @@
+{
+  "schema": "aienos.ck_gates.v1",
+  "started_utc": "2026-10-01T18:45:24Z",
+  "finished_utc": "2026-10-01T18:48:47Z",
+  "commit": "741b2b8db7d41d4c521d388f26af524f4089ac23",
+  "commit_subject": "Merge origin/main (#221, #225) into hive/CK-4-disk-layout",
+  "tree_clean_before": true,
+  "tree_clean_after": true,
+  "quiet_flag": "/home/drakestapleton/workspace/.spark-quiet",
+  "quiet_flag_present_at_start": false,
+  "host": {"hostname": "spark-b87b", "arch": "aarch64", "kernel": "7.0.0-1019-nvidia", "cpu_model": "Cortex-A725;Cortex-X925"},
+  "qemu": {"binary": "/usr/bin/qemu-system-aarch64", "version": "QEMU emulator version 8.2.2 (Debian 1:8.2.2+ds-0ubuntu1.18)"},
+  "firmware": {"aavmf_code": "/usr/share/AAVMF/AAVMF_CODE.no-secboot.fd", "aavmf_code_sha256": "4a4cb7f6d8106bb2a7dd8c763fab14b1810152136fc4304e5b728f0043e84f12", "aavmf_vars": "/usr/share/AAVMF/AAVMF_VARS.fd", "aavmf_vars_sha256": "b3b855c5a80310168051164986855692d1bdb06e67619856177965cd87c6774f"},
+  "nvme_dma_mode": "Confined (QEMU SMMUv3 stage 1, out-of-window DMA faulted); no-SMMU boot denied (NoSmmu); TEST-ONLY bypass image checked separately",
+  "children": [
+    {"name": "boot", "script": "scripts/qemu_ck_boot_test.sh", "present": true, "script_sha256": "d17a7e0f00081e935a804c092c9b05c0bd1f319f5dd5c8bd90f3982e8939c3c8", "exit": "0", "seconds": 6, "log_sha256": "23cdaafddadab630421c50acbddccefc67f40a4b254a2d00e16fafcbf5bfbcec", "log_lines": 24},
+    {"name": "store", "script": "scripts/qemu_ck_store_test.sh", "present": true, "script_sha256": "0b31a44af9388302d5488fdef318a509c4f26c2420f82ceb2fa7f7b698647748", "exit": "0", "seconds": 92, "log_sha256": "f2a24e39076804d068679fdfd945298c03fee8d31c563a72a789adf7a12c92da", "log_lines": 612},
+    {"name": "net", "script": "scripts/qemu_ck_net_test.sh", "present": true, "script_sha256": "ea051cc946c206f92c0c1563b3463b6bebffbce04e361e76d51dd49c1be4a6cf", "exit": "0", "seconds": 18, "log_sha256": "91e142f9f267bd593f4259f5e839fdfa58746be997407652a01f314ec23656f2", "log_lines": 95},
+    {"name": "artifact", "script": "scripts/qemu_ck_artifact_test.sh", "present": true, "script_sha256": "e60f6c4aed822f693a530cb98b2fa4689b7b56e7c0efed5f9bf9ff4e9f75fc67", "exit": "0", "seconds": 32, "log_sha256": "3dc386145cda5a3b09fb2ac066d9b19ed999273b807130f88d99b7acdfb4f44f", "log_lines": 215},
+    {"name": "disk", "script": "scripts/qemu_ck_disk_layout_test.sh", "present": true, "script_sha256": "f490548245252b97518e9049ce8e7078f5297c81584b60f08f802cfea6bb3110", "exit": "0", "seconds": 55, "log_sha256": "9bd65c8191d702f2a4a31989eae970bf96d1965ff2fd30d86713874a44af300e", "log_lines": 264}
+  ],
+  "gates": [
+    {"id": "M1", "marker": "AIENOS_CK_M1", "source": "boot", "verdict": "PASS", "reason": "child reported PASS, exit 0"},
+    {"id": "M3", "marker": "AIENOS_CK_M3", "source": "boot", "verdict": "PASS", "reason": "child reported PASS, exit 0"},
+    {"id": "SMMU", "marker": "AIENOS_CK_SMMU", "source": "store", "verdict": "PASS", "reason": "child reported PASS, exit 0"},
+    {"id": "NVME_SHUTDOWN", "marker": "AIENOS_CK_NVME_SHUTDOWN", "source": "store", "verdict": "PASS", "reason": "child reported PASS, exit 0"},
+    {"id": "P2_ARTIFACT", "marker": "AIENOS_CK_P2_ARTIFACT", "source": "artifact", "verdict": "PASS", "reason": "child reported PASS, exit 0"},
+    {"id": "M0_ROLLBACK", "marker": "AIENOS_CK_M0_ROLLBACK", "source": "missing", "verdict": "NOT_RUN", "reason": "MISSING_IMPLEMENTATION: C loader signatures, A/B, BootNext and rollback are parked (native/boot/README.md)"},
+    {"id": "M4_NVME", "marker": "AIENOS_CK_M4_NVME", "source": "store", "verdict": "PASS", "reason": "SMMU-confined NVMe DMA in QEMU (iommu=smmuv3, default build); TEST-ONLY bypass build boot-checked separately"},
+    {"id": "M4_STORE", "marker": "AIENOS_CK_M4_STORE", "source": "store", "verdict": "PASS", "reason": "child reported PASS, exit 0"},
+    {"id": "M4_STORE_CRASH", "marker": "AIENOS_CK_M4_STORE_CRASH", "source": "missing", "verdict": "NOT_RUN", "reason": "MISSING_IMPLEMENTATION: no C Store crash/kill campaign (4 KiB or 512 B) and no slot reuse (C Store is append-only)"},
+    {"id": "M4_CONTINUITY", "marker": "AIENOS_CK_M4_CONTINUITY", "source": "missing", "verdict": "NOT_RUN", "reason": "MISSING_IMPLEMENTATION: no continuity core (ADR 0016 agent identity and memory) in the C kernel"},
+    {"id": "M4_RECOVERY", "marker": "AIENOS_CK_M4_RECOVERY", "source": "missing", "verdict": "NOT_RUN", "reason": "MISSING_IMPLEMENTATION: no Recovery Core (ADR 0006) in the C kernel"},
+    {"id": "ARGUS1_REVOKE", "marker": "AIENOS_CK_ARGUS1_REVOKE", "source": "store", "verdict": "PASS", "reason": "child reported PASS, exit 0"},
+    {"id": "KEYBOARD", "marker": "AIENOS_CK_KEYBOARD", "source": "missing", "verdict": "NOT_RUN", "reason": "MISSING_IMPLEMENTATION: no xHCI/USB HID keyboard driver in the C kernel"},
+    {"id": "NET", "marker": "AIENOS_CK_NET", "source": "net", "verdict": "PASS", "reason": "QEMU user networking (slirp), virtio-net with ACCESS_PLATFORM required behind the smmuv3 vIOMMU; this PASS covers: attach, UDP TX seen by the host helper, UDP reply RX parsed by M6-A, an out-of-window device DMA refused (F_TRANSLATION, page intact) and recovery by reset, as checked by this run only; QEMU, not hardware"},
+    {"id": "DISK_LAYOUT", "marker": "AIENOS_CK_DISK_LAYOUT", "source": "disk", "verdict": "PASS", "reason": "child reported PASS, exit 0"}
+  ],
+  "counts": {"total": 15, "pass": 10, "fail": 0, "not_run": 5},
+  "verdict": "NOT_ALL_GATES_PASS",
+  "parity": "native/kernel/GATES.md",
+  "physical": "NOT_RUN",
+  "physical_statement": "QEMU emulator runs only. Nothing here was run on Machine 1 or any GB10; no physical qualification is claimed."
+}
diff --git a/native/kernel/GATES.md b/native/kernel/GATES.md
index 616bfbb3..b5d1527e 100644
--- a/native/kernel/GATES.md
+++ b/native/kernel/GATES.md
@@ -22,7 +22,8 @@ C gates (one line each from `ck_gates.sh`): `M1` and `M3` (from
 `SMMU`, `NVME_SHUTDOWN` (from `scripts/qemu_ck_store_test.sh`; rows 21-24b, 47-72, 76 and
 96-101 were checked against its exact grep patterns), `P2_ARTIFACT` (from
 `scripts/qemu_ck_artifact_test.sh`, rows 33-41), `NET` (C-only, from
-`scripts/qemu_ck_net_test.sh`; rows 102-106 and 110-112; the script now also checks the virtio-net SMMU fence (ACCESS_PLATFORM required, out-of-window device DMA refused), rows 102 and 110-112 are QEMU PASS on this branch from the committed forge log `evidence/ck_net_qemu_8bdbc2e46b85d04c422f9d2830c1c4b263e254b3cfecfe21ff0063c9e33c86e8.log`, hardware NOT_RUN), the kernel entropy rows 107-109 (M1 via `scripts/lib_ck_m1_checks.sh`, ARGUS1_REVOKE and M4_STORE via the Store gate boot 7), and the NOT_RUN gates
+`scripts/qemu_ck_net_test.sh`; rows 102-106 and 110-112; the script now also checks the virtio-net SMMU fence (ACCESS_PLATFORM required, out-of-window device DMA refused), rows 102 and 110-112 are QEMU PASS on this branch from the committed forge log `evidence/ck_net_qemu_8bdbc2e46b85d04c422f9d2830c1c4b263e254b3cfecfe21ff0063c9e33c86e8.log`, hardware NOT_RUN), the kernel entropy rows 107-109 (M1 via `scripts/lib_ck_m1_checks.sh`, ARGUS1_REVOKE and M4_STORE via the Store gate boot 7),
+`DISK_LAYOUT` (C-only, from `scripts/qemu_ck_disk_layout_test.sh`, rows 118-123: QEMU PASS at 741b2b8 before the merge with main 8555049, rerun pending at the merged head; row 123 host test), and the NOT_RUN gates
 `SMP` (C-only, from `scripts/qemu_ck_smp_test.sh`, rows 113-117, NOT_RUN pending forge receipt), `M0_ROLLBACK`, `M4_STORE_CRASH` (now read from `scripts/qemu_ck_store_crash_test.sh`, rows 73-80; NOT_RUN until a forge receipt exists),
 `M4_CONTINUITY`, `M4_RECOVERY`, `KEYBOARD`.
 
@@ -460,9 +461,45 @@ No PASS without a forge receipt; hardware NOT_RUN (no GB10 core was started).
 | 116 | summary `smp: cpus=N started=N checked_in=N psci_errors=0 distinct_mpidrs=N wait_us=.. result=ok`, no `smp: FAIL`, kernel reaches `report_kind: final`, no panic or fault, QEMU exit 0, image is not the TEST-ONLY mutation | SMP | NOT_RUN (pending forge receipt) |
 | 117 | mutation: `make CK_TEST_SMP_SKIP_CPU=1` (TEST-ONLY, own OUT, announces itself, never calls CPU_ON for the last MADT secondary) must make the gate checks FAIL (`scripts/qemu_ck_smp_test.sh --mutation` ends `AIENOS_CK_SMP_MUTATION: PASS` when they do); the flag is refused with `CK_HARDWARE_STAGING` (Makefile `$(error)` and a `#error` in `core/smp.c`) and default images are checked to carry no trace of it (Makefile `smp_check`); canned-log failure modes in `scripts/qemu_ck_smp_test.sh --self-test` | SMP | NOT_RUN (pending forge receipt) |
 
+## DISK_LAYOUT: partition-aware disk footprint (C-only, audit R2) -> CK `DISK_LAYOUT` (scripts/qemu_ck_disk_layout_test.sh)
+
+No Rust QEMU gate exists for this; the Rust Store writes the whole disk. The C
+kernel parses the GPT read-only (UEFI 2.10 section 5.3: protective MBR,
+primary header at LBA 1, entry array, backup entry array and backup header at
+the end; CRC32 of both headers and both entry arrays) and selects the one
+partition whose type GUID is the AIENOS type
+`38DAAC89-5EAD-4B40-8B1E-3687A7418061` (dev/disk_part.h). The Store,
+torn-slot device and NVMe rw probe receive only that partition's view; every
+read, write and flush goes through the bounds-checked translation
+`ck_part_xlate` (partition LBA -> disk LBA). Without exactly one valid AIENOS
+partition the kernel prints `disk: no AIENOS partition, refusing writes (gpt:
+<reason>, rc=N)` and never writes; there is no whole-disk fallback. The only
+way around the translation is the TEST-ONLY mutation build
+`make full CK_TEST_DISK_XLATE_BYPASS=1` (refused with `CK_HARDWARE_STAGING`
+by the Makefile and by an `#error`). The Store, NET and artifact gates now
+boot GPT images from `native/kernel/tools/ck_gpt_image.c` (AIENOS partition
+[9,57) MiB of 64 MiB, filled sentinel partitions on both sides).
+
+Firmware caveat: EDK2/AAVMF may repair a GPT whose primary or backup copy
+alone is bad, so the QEMU hostile images corrupt both copies; single-copy
+corruption is covered only by the host test `dev/tests/disk_part_test.c`
+(`make -C native/kernel stage-test`, target `disk-part-test`).
+
+| # | C check | CK gate | Status |
+| --- | --- | --- | --- |
+| 118 | GPT parsed with CRC32 on both headers and both entry arrays; the AIENOS partition is found exactly where the image tool wrote it (`disk: gpt ok primary+backup crc32 entries=128 used=3 aienos_index=1 first_lba=F last_lba=L `), 512 B (2 boots) and 4096 B (1 boot) | DISK_LAYOUT | QEMU PASS (receipt `evidence/ck_gates_d80363cc871372963743ae85fc08c6fa4608f9870c4e06e8988f21950c73ace6.json`, full `ck_gates.sh` run at 741b2b8, log CK-4-184524.log; standalone `scripts/qemu_ck_disk_layout_test.sh` PASS with the bypass mutant killed, log CK-4-184423.log; hardware NOT_RUN) |
+| 119 | translation layer: partition LBA 0 -> partition start, past-end / straddling / overflowing LBAs refused (`disk: xlate part_lba=0 -> disk_lba=F (rc=0)`, `disk: write past partition end part_lba=N -> refused `); rw probe disk LBA inside [F,L] | DISK_LAYOUT | QEMU PASS (receipt `evidence/ck_gates_d80363cc871372963743ae85fc08c6fa4608f9870c4e06e8988f21950c73ace6.json`, full `ck_gates.sh` run at 741b2b8, log CK-4-184524.log; standalone `scripts/qemu_ck_disk_layout_test.sh` PASS with the bypass mutant killed, log CK-4-184423.log; hardware NOT_RUN) |
+| 120 | footprint: Store formats and commits inside the partition; every byte outside it (MBR, both GPT copies, both sentinels) unchanged (sha256 with the partition cut out), the partition itself written. Also checked on boots 1-3 of both geometries by `scripts/qemu_ck_store_test.sh` | DISK_LAYOUT (and M4_STORE) | QEMU PASS (receipt `evidence/ck_gates_d80363cc871372963743ae85fc08c6fa4608f9870c4e06e8988f21950c73ace6.json`, full `ck_gates.sh` run at 741b2b8, log CK-4-184524.log; standalone `scripts/qemu_ck_disk_layout_test.sh` PASS with the bypass mutant killed, log CK-4-184423.log; hardware NOT_RUN) |
+| 121 | hostile disks refused, image byte-identical, Store refused `step="no boot disk"`, no rw probe: no GPT, bad CRC32 on both headers, bad entry-array CRC32 on both arrays, AIENOS partition ending past the disk, no AIENOS partition; the host tool's own parser (`ck_gpt_image find`) must give the same reason | DISK_LAYOUT | QEMU PASS (receipt `evidence/ck_gates_d80363cc871372963743ae85fc08c6fa4608f9870c4e06e8988f21950c73ace6.json`, full `ck_gates.sh` run at 741b2b8, log CK-4-184524.log; standalone `scripts/qemu_ck_disk_layout_test.sh` PASS with the bypass mutant killed, log CK-4-184423.log; hardware NOT_RUN) |
+| 122 | mutation: the TEST-ONLY translation-bypass image announces itself and FAILs rows 118-120 (its translation self-check prints `NOT REFUSED`); the default image contains no bypass text | DISK_LAYOUT | QEMU PASS (receipt `evidence/ck_gates_d80363cc871372963743ae85fc08c6fa4608f9870c4e06e8988f21950c73ace6.json`, full `ck_gates.sh` run at 741b2b8, log CK-4-184524.log; standalone `scripts/qemu_ck_disk_layout_test.sh` PASS with the bypass mutant killed, log CK-4-184423.log; hardware NOT_RUN) |
+| 123 | host test: CRC32 known answer, good layouts at 512/4096, writes through the view never change bytes outside the partition, full Store boot on the view, single-copy corruption, header field patches, backup disagreement, overlap, two AIENOS partitions, too many entries; the bypass build of the same test must FAIL (`CK_DISK_PART_MUTANT: PASS`) | DISK_LAYOUT (host, `make stage-test`) | PASS (host test, `CK_DISK_PART_HOST: PASS` and `CK_DISK_PART_MUTANT: PASS`, log CK-4-light-181557.log at 25db390; not rerun at 741b2b8, but no file under native/kernel/dev or native/kernel/tools changed since; the bypass image's QEMU FAIL is row 122, receipt `evidence/ck_gates_d80363cc871372963743ae85fc08c6fa4608f9870c4e06e8988f21950c73ace6.json`; inspector note (non-blocking): since 25db390 the only change near this code is from main, `native/kernel/svc/security.c` +3 lines (#218, a TEST-only `argus: TEST machine id` print under `#ifndef CK_HARDWARE_STAGING`); `native/kernel/svc/security.h` is unchanged, and no file under native/kernel/dev, native/kernel/tools or the disk_part test changed; hardware NOT_RUN) |
+
+
 ## Summary counts
 
-**C kernel receipt tally (QEMU only, no physical run):** 9 of 15 CK gates PASS, 6 NOT_RUN (M0_ROLLBACK, M4_STORE_CRASH, M4_CONTINUITY, M4_RECOVERY, KEYBOARD; and SMP, added after that receipt, NOT_RUN pending forge receipt), 0 FAIL. The 9 PASS match `evidence/ck_gates_929f287e9c950c45c7dcd569c7caa03709ea62ecfe393635b435058afa969c54.json` (run at 41aa0e6, which adds the kernel entropy rows 107-109; that commit was then rebased onto #210, which changed only README.md and CONTRIBUTING.md). The row counts below are per Rust-parity row, not per gate.
+**C kernel receipt tally (QEMU only, no physical run):** 16 CK gates since the merge of main 8555049 (#224 adds `SMP`, #226 moves `M4_STORE_CRASH` to its own child script) into the CK-4 branch. The newest full receipt, `evidence/ck_gates_d80363cc871372963743ae85fc08c6fa4608f9870c4e06e8988f21950c73ace6.json` (full `ck_gates.sh` run at 741b2b8, the CK-4 branch after merging main #221 and #225; log CK-4-184524.log, `AIENOS_CK_GATES: NOT_ALL_GATES_PASS (pass=10 fail=0 not_run=5 of 15; physical NOT_RUN)`), predates that merge: by it, 10 of 16 CK gates PASS (the 9 of the earlier receipt plus `DISK_LAYOUT`), 6 NOT_RUN (M0_ROLLBACK, M4_STORE_CRASH, M4_CONTINUITY, M4_RECOVERY, KEYBOARD; and SMP, not in that receipt, NOT_RUN pending forge receipt), 0 FAIL. No `ck_gates.sh` run exists at the merged head yet; `M4_STORE_CRASH` stays NOT_RUN until a forge receipt. `DISK_LAYOUT` also PASSed alone (log CK-4-184423.log, translation-bypass mutant killed); the Store, NET and artifact gates boot GPT images now and PASS in the same receipt. The receipt before it was 9 of 14 CK gates PASS, 5 NOT_RUN, 0 FAIL (`evidence/ck_gates_929f287e9c950c45c7dcd569c7caa03709ea62ecfe393635b435058afa969c54.json`, run at 41aa0e6, which adds the kernel entropy rows 107-109; that commit was then rebased onto #210, which changed only README.md and CONTRIBUTING.md). The row counts below are per Rust-parity row, not per gate.
+
+Rows 118-123 (DISK_LAYOUT, C-only, CK-4; numbered 113-118 on the CK-4 branch before the merge with main, which gave 113-117 to SMP) are 5 QEMU PASS (118-122, receipt `ck_gates_d80363...` at 741b2b8, before the merge with main 8555049) and 1 host-test PASS (123), none NOT_RUN. With them, rows 1-123 plus the M4 continuity/recovery sub-rows: IDENTICAL 28, DIFFERS 39, NOT_RUN 91, PASS 6 (C-only DISK_LAYOUT, hardware NOT_RUN) (91 from the SMP line next; recounted from the table at the merge commit, status = each row's first status cell, escaped pipes read as text: 28 IDENTICAL, 39 DIFFERS, 87 NOT_RUN (82 + SMP 113-117), 9 QEMU PASS (NET 102, 110-112, counted as NOT_RUN as below, and DISK_LAYOUT 118-122), 1 PASS (123); sub-rows 24a and 24b not counted).
 
 Rows 113-117 (SMP, C-only, new in this change): 5 NOT_RUN (pending forge receipt), so rows 1-117 plus the M4 continuity/recovery sub-rows: IDENTICAL 28, DIFFERS 39, NOT_RUN 91 (86 from the line below plus these 5).
 
diff --git a/native/kernel/Makefile b/native/kernel/Makefile
index 9b0e0e93..92d2a3a0 100644
--- a/native/kernel/Makefile
+++ b/native/kernel/Makefile
@@ -40,7 +40,16 @@
 #                        the SMP gate must FAIL on it (scripts/qemu_ck_smp_test.sh
 #                        --mutation); refused with CK_HARDWARE_STAGING
 #   make store-image     host tool $(OUT)/host/ck_store_image: signed artifacts
-#                        into the sealed Store on a raw NVMe disk image
+#                        into the sealed Store inside the AIENOS GPT partition
+#                        of an NVMe disk image
+#   make gpt-image       host tool $(OUT)/host/ck_gpt_image: GPT boot-disk images
+#                        (AIENOS partition between two sentinels, hostile variants)
+#                        for the QEMU gates; "find" runs the kernel GPT parser
+#   make full CK_TEST_DISK_XLATE_BYPASS=1
+#                        TEST-ONLY mutation image for the DISK_LAYOUT gate: the
+#                        LBA translation layer (dev/disk_part.c) adds no partition
+#                        offset; $(OUT)/full-test-xlate-bypass/ (refused with
+#                        CK_HARDWARE_STAGING; never counted toward a PASS)
 #   make test            host unit tests            -> CK_CORE_HOST: PASS
 #                        (also builds the handoff_check reserved0 mutant
 #                        and requires test_handoff to FAIL against it)
@@ -221,6 +230,18 @@ $(error CK_OWNER_PUBKEYS and CK_MACHINE_ID are only used with CK_HARDWARE_STAGIN
 endif
 endif
 
+# TEST-ONLY DISK_LAYOUT mutation (dev/disk_part.h): the partition translation
+# layer is bypassed. Its own FULL_NAME; never with hardware staging.
+CK_TEST_DISK_XLATE_BYPASS ?=
+ifneq ($(strip $(CK_TEST_DISK_XLATE_BYPASS)),)
+ifneq ($(strip $(CK_TEST_DISK_XLATE_BYPASS)),1)
+$(error CK_TEST_DISK_XLATE_BYPASS must be empty or 1)
+endif
+ifneq ($(strip $(CK_HARDWARE_STAGING)),)
+$(error CK_TEST_DISK_XLATE_BYPASS (TEST-ONLY translation bypass mutation) cannot be combined with CK_HARDWARE_STAGING)
+endif
+endif
+
 # SEED-0B qualification build: trusts the RFC 8032 TEST 1 public key only.
 # TEST ONLY; never combined with hardware staging. Use its own OUT.
 CK_SEED0B_TEST_ANCHOR ?=
@@ -304,6 +325,10 @@ FULL_NAME := full-test-store-crash
 endif
 STAGE_DMA_FLAGS += -DCK_TEST_STORE_CRASH=1 $(STORE_MUTANT_FLAGS)
 endif
+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
 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)
@@ -573,6 +598,15 @@ $(STORE_IMG_TOOL): $(STORE_IMG_SRCS) $(STAGE_HDRS)
 	$(HOSTCC) $(STAGE_HOST_FLAGS) $(STAGE_INC) -o $@ $(STORE_IMG_SRCS)
 store-image: $(STORE_IMG_TOOL)
 
+# GPT boot-disk image tool (QEMU gates; hosted, never part of an image).
+GPT_IMG_TOOL := $(OUT)/host/ck_gpt_image
+GPT_IMG_SRCS := $(KDIR)/dev/disk_part.c $(NATIVE)/disk/disk.c $(NATIVE)/disk/disk_file.c \
+	$(KDIR)/tools/gpt_write.c $(KDIR)/tools/ck_gpt_image.c
+$(GPT_IMG_TOOL): $(GPT_IMG_SRCS) $(KDIR)/dev/disk_part.h $(KDIR)/tools/gpt_write.h $(NATIVE)/disk/disk.h
+	@mkdir -p $(dir $@)
+	$(HOSTCC) -std=gnu11 -O2 -Wall -Wextra -Werror -I$(KDIR)/dev -I$(KDIR)/tools -I$(NATIVE)/disk -o $@ $(GPT_IMG_SRCS)
+gpt-image: $(GPT_IMG_TOOL)
+
 # Owner provisioning generator (hosted; never part of an image) and the
 # generated header for the hardware staging image.
 OWNER_GEN := $(OUT)/host/ck_owner_gen
@@ -590,4 +624,4 @@ clean:
 	rm -rf $(OUT)
 
 FORCE:
-.PHONY: all full test sanitize handoff-mutant clean print-kcflags udp-echo tool store-image owner-gen continuity-mutants FORCE
+.PHONY: all full test sanitize handoff-mutant clean print-kcflags udp-echo tool store-image gpt-image owner-gen continuity-mutants FORCE
diff --git a/native/kernel/README.md b/native/kernel/README.md
index 6495d63b..ec883a60 100644
--- a/native/kernel/README.md
+++ b/native/kernel/README.md
@@ -26,6 +26,7 @@ QEMU qualifies nothing physical: a PASS here says nothing about real hardware.
     scripts/qemu_ck_store_test.sh    # QEMU NVMe + Store gate (full image, QEMU-only
                                      # CK_QEMU_UNSAFE_DMA=1 build), ends AIENOS_CK_M4_NVME,
                                      # AIENOS_CK_M4_STORE, AIENOS_CK_ARGUS1_REVOKE
+    scripts/qemu_ck_disk_layout_test.sh # QEMU GPT / AIENOS partition gate, ends AIENOS_CK_DISK_LAYOUT
 
 Toolchain: gcc, binutils (ld, objcopy, nm, readelf), make, shell. On a
 non-aarch64 host the Makefile uses the `aarch64-linux-gnu-` prefix.
@@ -166,6 +167,23 @@ low-water free bytes.
   `CK_HARDWARE_STAGING`) builds the unconfined bypass used only when no SMMU
   exists, and prints the `WARNING: UNSAFE NVME DMA BYPASS` lines.
 
+- The kernel writes only inside the AIENOS partition of the boot disk
+  (`dev/disk_part.h`, gate `DISK_LAYOUT`). The GPT is parsed read-only:
+  protective MBR, primary and backup headers and entry arrays, all CRC32
+  checked and required to agree. Exactly one partition must carry the AIENOS
+  type GUID `38DAAC89-5EAD-4B40-8B1E-3687A7418061` (on-disk bytes
+  `89 AC DA 38 AD 5E 40 4B 8B 1E 36 87 A7 41 80 61`), inside the usable range
+  and overlapping no other partition. The Store, torn-slot device and rw probe
+  get only that partition's `disk_dev` view, whose every read, write and
+  flush goes through `ck_part_xlate` (bounds-checked partition LBA -> disk
+  LBA). Otherwise the kernel prints `disk: no AIENOS partition, refusing
+  writes` and the Store reports `no boot disk`; there is no whole-disk mode.
+  `CK_TEST_DISK_XLATE_BYPASS=1` (TEST-ONLY mutation, refused with
+  `CK_HARDWARE_STAGING`) drops the partition offset so the gate can prove it
+  catches that. QEMU disk images come from `make gpt-image`
+  (`tools/ck_gpt_image.c`); `ck_store_image` also opens only the AIENOS
+  partition.
+
 ## Differences from the Rust kernel
 
 - `guard_page: ok fault=contained` is an addition: the C kernel proves its
diff --git a/native/kernel/dev/devices.c b/native/kernel/dev/devices.c
index 0cef877a..efe141ca 100644
--- a/native/kernel/dev/devices.c
+++ b/native/kernel/dev/devices.c
@@ -11,7 +11,9 @@
 static pci_system g_pci;
 static ck_nvme g_nvme;
 
-const disk_dev *ck_dev_boot_disk(void) { return g_nvme.bound ? &g_nvme.disk : 0; }
+/* Later stages get only the AIENOS partition view (dev/disk_part.h), never the
+ * whole namespace: every access they make goes through ck_part_xlate. */
+const disk_dev *ck_dev_boot_disk(void) { return g_nvme.bound && g_nvme.part.valid ? &g_nvme.part.dev : 0; }
 
 void ck_dev_nvme_release(void)
 {
diff --git a/native/kernel/dev/devices.h b/native/kernel/dev/devices.h
index 0011a6b2..5d2161ef 100644
--- a/native/kernel/dev/devices.h
+++ b/native/kernel/dev/devices.h
@@ -3,7 +3,9 @@
 #ifndef AIENOS_CK_DEVICES_H
 #define AIENOS_CK_DEVICES_H
 #include "disk.h"
-/* The bound NVMe disk, or NULL when the devices stage did not bind one. */
+/* The AIENOS partition of the bound NVMe disk (a bounds-checked partition
+ * view, dev/disk_part.h), or NULL when the devices stage bound no disk or the
+ * disk has no valid AIENOS partition. */
 const disk_dev *ck_dev_boot_disk(void);
 /* Revoke the NVMe function's bus mastering once the last disk user (the
  * Store stage) is done, or after a failed bind; prints the dma_gate line.
diff --git a/native/kernel/dev/disk_layout.h b/native/kernel/dev/disk_layout.h
index f52fe819..933933f7 100644
--- a/native/kernel/dev/disk_layout.h
+++ b/native/kernel/dev/disk_layout.h
@@ -1,10 +1,16 @@
 /* disk_layout.h -- how the AIENOS C kernel stages share the boot NVMe disk.
+ *
+ * Everything below is INSIDE the AIENOS GPT partition (dev/disk_part.h): unit
+ * numbers are relative to the partition's first LBA and every access goes
+ * through the bounds-checked translation layer ck_part_xlate. The rest of the
+ * disk (protective MBR, primary and backup GPT, other partitions) is only
+ * ever read (GPT parse), never written.
  *
  *   unit 0..3            sealed-Store anti-rollback anchor (torn_slot, 4 units)
  *   unit 4..U-2          Store v1 region (store_sealed / ADR 0015)
  *   unit U-1             scratch unit for the NVMe write/flush/read-back probe
  * A unit is 4096 bytes (8 blocks of 512 or 1 block of 4096); U = whole units
- * on the namespace. The probe only ever writes the last unit. */
+ * in the AIENOS partition. The probe only ever writes the partition's last unit. */
 #ifndef AIENOS_CK_DISK_LAYOUT_H
 #define AIENOS_CK_DISK_LAYOUT_H
 #include <stdint.h>
diff --git a/native/kernel/dev/disk_part.c b/native/kernel/dev/disk_part.c
new file mode 100644
index 00000000..3d7815d2
--- /dev/null
+++ b/native/kernel/dev/disk_part.c
@@ -0,0 +1,270 @@
+/* disk_part.c -- read-only GPT parser and the single bounds-checked LBA
+ * translation layer of the AIENOS C kernel (see disk_part.h). Freestanding:
+ * no libc, no heap; all disk reads go through disk_read on the parent. */
+#include "disk_part.h"
+
+/* 38DAAC89-5EAD-4B40-8B1E-3687A7418061 in GPT on-disk (mixed endian) order. */
+const uint8_t ck_aienos_part_type[16] = {0x89, 0xac, 0xda, 0x38, 0xad, 0x5e, 0x40, 0x4b,
+                                         0x8b, 0x1e, 0x36, 0x87, 0xa7, 0x41, 0x80, 0x61};
+
+#define GPT_BUF 4096u
+static uint8_t g_blk[GPT_BUF];  /* one block of the device being read */
+static uint8_t g_hdr[GPT_BUF];  /* primary header copy */
+static uint8_t g_bak[GPT_BUF];  /* backup header copy */
+static uint64_t g_used_first[CK_GPT_MAX_USED];
+static uint64_t g_used_last[CK_GPT_MAX_USED];
+
+static uint32_t get32(const uint8_t *p)
+{
+    return (uint32_t)p[0] | (uint32_t)p[1] << 8 | (uint32_t)p[2] << 16 | (uint32_t)p[3] << 24;
+}
+static uint64_t get64(const uint8_t *p)
+{
+    return (uint64_t)get32(p) | (uint64_t)get32(p + 4) << 32;
+}
+static int same(const uint8_t *a, const uint8_t *b, size_t n)
+{
+    uint8_t d = 0;
+    for (size_t i = 0; i < n; i++) d |= (uint8_t)(a[i] ^ b[i]);
+    return d == 0;
+}
+static int all_zero(const uint8_t *a, size_t n)
+{
+    uint8_t d = 0;
+    for (size_t i = 0; i < n; i++) d |= a[i];
+    return d == 0;
+}
+static void copy(uint8_t *d, const uint8_t *s, size_t n)
+{
+    for (size_t i = 0; i < n; i++) d[i] = s[i];
+}
+
+uint32_t ck_crc32(uint32_t crc, const uint8_t *p, size_t n)
+{
+    crc = ~crc;
+    for (size_t i = 0; i < n; i++) {
+        crc ^= p[i];
+        for (int k = 0; k < 8; k++) crc = (crc >> 1) ^ (0xedb88320u & (0u - (crc & 1u)));
+    }
+    return ~crc;
+}
+
+/* Header field offsets (UEFI 2.10 table 5-5). */
+enum {
+    H_SIG = 0, H_REV = 8, H_SIZE = 12, H_CRC = 16, H_MY = 24, H_ALT = 32, H_FIRST = 40, H_LAST = 48,
+    H_GUID = 56, H_ENT_LBA = 72, H_NUM = 80, H_ESIZE = 84, H_ECRC = 88
+};
+static const uint8_t gpt_sig[8] = {'E', 'F', 'I', ' ', 'P', 'A', 'R', 'T'};
+
+/* Read block lba of d into g_blk, then check signature, revision, size and
+ * CRC32; on success copy the header into out. */
+static int read_header(const disk_dev *d, uint64_t lba, uint8_t *out, int bad_crc_rc, int bad_rc)
+{
+    if (disk_read(d, lba, 1, g_blk) != DISK_OK) return CK_GPT_EIO;
+    uint32_t hsize = get32(g_blk + H_SIZE);
+    if (!same(g_blk + H_SIG, gpt_sig, 8) || get32(g_blk + H_REV) != 0x00010000u || hsize < CK_GPT_HDR_MIN ||
+        hsize > d->block_size)
+        return bad_rc;
+    uint32_t want = get32(g_blk + H_CRC);
+    static const uint8_t zero4[4] = {0, 0, 0, 0};
+    uint32_t crc = ck_crc32(0, g_blk, H_CRC);
+    crc = ck_crc32(crc, zero4, 4);
+    crc = ck_crc32(crc, g_blk + H_CRC + 4, hsize - H_CRC - 4u);
+    if (crc != want) return bad_crc_rc;
+    copy(out, g_blk, d->block_size);
+    return CK_GPT_OK;
+}
+
+typedef struct {
+    uint32_t num, esize, blocks, bytes;
+} ent_geom;
+
+/* Stream the entry array at lba: CRC32 over num*esize bytes; when scan is
+ * set, also check every used entry and find the AIENOS one. */
+static int scan_entries(const disk_dev *d, uint64_t lba, const ent_geom *g, int scan, uint32_t *crc_out,
+                        uint64_t first_usable, uint64_t last_usable, int *sem_rc, ck_part *p, ck_gpt_info *info)
+{
+    uint32_t crc = 0, left = g->bytes, idx = 0, used = 0, aienos = 0;
+    for (uint32_t b = 0; b < g->blocks; b++) {
+        if (disk_read(d, lba + b, 1, g_blk) != DISK_OK) return CK_GPT_EIO;
+        uint32_t take = left < d->block_size ? left : d->block_size;
+        crc = ck_crc32(crc, g_blk, take);
+        left -= take;
+        for (uint32_t off = 0; scan && off + g->esize <= take; off += g->esize, idx++) {
+            const uint8_t *e = g_blk + off;
+            if (all_zero(e, 16)) continue; /* unused entry */
+            uint64_t f = get64(e + 32), l = get64(e + 40);
+            if (*sem_rc == CK_GPT_OK && (f > l || f < first_usable || l > last_usable)) *sem_rc = CK_GPT_EOUTSIDE;
+            if (used >= CK_GPT_MAX_USED) {
+                if (*sem_rc == CK_GPT_OK) *sem_rc = CK_GPT_ETOOMANY;
+                continue;
+            }
+            g_used_first[used] = f;
+            g_used_last[used] = l;
+            used++;
+            if (same(e, ck_aienos_part_type, 16)) {
+                aienos++;
+                p->first_lba = f;
+                p->blocks = l - f + 1u; /* f <= l checked above before it is trusted */
+                info->part_index = idx;
+            }
+        }
+    }
+    *crc_out = crc;
+    if (scan) {
+        info->used = used;
+        for (uint32_t i = 0; *sem_rc == CK_GPT_OK && i < used; i++)
+            for (uint32_t j = i + 1; j < used; j++)
+                if (g_used_first[i] <= g_used_last[j] && g_used_first[j] <= g_used_last[i]) {
+                    *sem_rc = CK_GPT_EOVERLAP;
+                    break;
+                }
+        if (*sem_rc == CK_GPT_OK && aienos == 0) *sem_rc = CK_GPT_ENOPART;
+        if (*sem_rc == CK_GPT_OK && aienos > 1) *sem_rc = CK_GPT_EMULTI;
+    }
+    return CK_GPT_OK;
+}
+
+static int part_read(void *ctx, uint64_t lba, uint32_t count, uint8_t *buf)
+{
+    const ck_part *p = ctx;
+    uint64_t abs = 0;
+    int rc = ck_part_xlate(p, lba, count, &abs);
+    return rc ? rc : disk_read(p->parent, abs, count, buf);
+}
+static int part_write(void *ctx, uint64_t lba, uint32_t count, const uint8_t *buf)
+{
+    const ck_part *p = ctx;
+    uint64_t abs = 0;
+    int rc = ck_part_xlate(p, lba, count, &abs);
+    return rc ? rc : disk_write(p->parent, abs, count, buf);
+}
+static int part_flush(void *ctx)
+{
+    const ck_part *p = ctx;
+    if (!p || !p->valid || !p->parent) return DISK_ESTATE;
+    return disk_flush(p->parent);
+}
+
+static void part_invalid(ck_part *p, const disk_dev *d)
+{
+    p->parent = d;
+    p->first_lba = 0;
+    p->blocks = 0;
+    p->valid = 0;
+    p->dev.ctx = p;
+    p->dev.block_size = d ? d->block_size : 0;
+    p->dev.block_count = 0; /* disk_check refuses a zero-block device */
+    p->dev.read = part_read;
+    p->dev.write = part_write;
+    p->dev.flush = part_flush;
+    p->dev.max_blocks_per_io = d ? d->max_blocks_per_io : 0;
+}
+
+int ck_gpt_find_aienos(const disk_dev *d, ck_part *p, ck_gpt_info *info)
+{
+    if (!p || !info) return CK_GPT_EGEOM;
+    part_invalid(p, d);
+    for (size_t i = 0; i < sizeof *info; i++) ((uint8_t *)info)[i] = 0;
+    if (disk_check(d) != DISK_OK || d->block_size > GPT_BUF || d->block_count < 8u) return CK_GPT_EGEOM;
+    uint64_t last = d->block_count - 1u;
+    info->last_lba = last;
+
+    /* Protective MBR: boot signature and at least one 0xEE record. */
+    if (disk_read(d, 0, 1, g_blk) != DISK_OK) return CK_GPT_EIO;
+    int pmbr = g_blk[510] == 0x55 && g_blk[511] == 0xaa;
+    int ee = 0;
+    for (int i = 0; i < 4; i++) ee |= g_blk[446 + 16 * i + 4] == 0xee;
+    if (!pmbr || !ee) return CK_GPT_ENOMBR;
+
+    int rc = read_header(d, 1, g_hdr, CK_GPT_EHDR_CRC, CK_GPT_ESIG);
+    if (rc) return rc;
+    ent_geom g;
+    g.num = get32(g_hdr + H_NUM);
+    g.esize = get32(g_hdr + H_ESIZE);
+    if (g.num == 0 || g.num > CK_GPT_MAX_ENTRIES || (g.esize != 128u && g.esize != 256u && g.esize != 512u))
+        return CK_GPT_EENT;
+    g.bytes = g.num * g.esize; /* <= 1024 * 512: no overflow */
+    g.blocks = (g.bytes + d->block_size - 1u) / d->block_size;
+    uint64_t first_u = get64(g_hdr + H_FIRST), last_u = get64(g_hdr + H_LAST), ent_lba = get64(g_hdr + H_ENT_LBA);
+    if (get64(g_hdr + H_MY) != 1u || get64(g_hdr + H_ALT) != last) return CK_GPT_EHDR;
+    /* Every comparison below is against values <= last, so no sum overflows. */
+    if (ent_lba < 2u || ent_lba > last || g.blocks > last - ent_lba) return CK_GPT_EHDR;
+    if (first_u < ent_lba + g.blocks || first_u > last_u || last_u >= last) return CK_GPT_EHDR;
+    /* The backup array must fit between the usable range and the backup header. */
+    if (last - 1u - last_u < g.blocks) return CK_GPT_EHDR;
+
+    int sem = CK_GPT_OK;
+    uint32_t crc = 0;
+    rc = scan_entries(d, ent_lba, &g, 1, &crc, first_u, last_u, &sem, p, info);
+    if (rc) return rc;
+    if (crc != get32(g_hdr + H_ECRC)) return CK_GPT_EENT_CRC;
+
+    /* Backup header and backup entry array: both copies must be valid and agree. */
+    rc = read_header(d, last, g_bak, CK_GPT_EBACKUP, CK_GPT_EBACKUP);
+    if (rc) return rc == CK_GPT_EIO ? rc : CK_GPT_EBACKUP;
+    uint64_t bent = get64(g_bak + H_ENT_LBA);
+    if (get64(g_bak + H_MY) != last || get64(g_bak + H_ALT) != 1u || get64(g_bak + H_FIRST) != first_u ||
+        get64(g_bak + H_LAST) != last_u || !same(g_bak + H_GUID, g_hdr + H_GUID, 16) ||
+        get32(g_bak + H_NUM) != g.num || get32(g_bak + H_ESIZE) != g.esize ||
+        get32(g_bak + H_ECRC) != get32(g_hdr + H_ECRC) || bent <= last_u || bent >= last || g.blocks > last - bent)
+        return CK_GPT_EBACKUP;
+    uint32_t bcrc = 0;
+    rc = scan_entries(d, bent, &g, 0, &bcrc, first_u, last_u, &sem, p, info);
+    if (rc) return rc;
+    if (bcrc != get32(g_hdr + H_ECRC)) return CK_GPT_EBACKUP;
+
+    if (sem) {
+        p->first_lba = 0;
+        p->blocks = 0;
+        return sem;
+    }
+    info->first_usable = first_u;
+    info->last_usable = last_u;
+    info->entries = g.num;
+    info->entry_size = g.esize;
+    p->valid = 1;
+    p->dev.block_count = p->blocks;
+    return CK_GPT_OK;
+}
+
+int ck_part_xlate(const ck_part *p, uint64_t lba, uint32_t count, uint64_t *abs)
+{
+    if (!p || !p->valid || !p->parent || !abs) return DISK_ESTATE;
+    if (count == 0) return DISK_EARG;
+    uint64_t pc = p->parent->block_count;
+#if defined(CK_TEST_DISK_XLATE_BYPASS)
+    /* TEST-ONLY mutation: no partition offset, parent bounds only. */
+    if (lba >= pc || (uint64_t)count > pc - lba) return DISK_ERANGE;
+    *abs = lba;
+    return DISK_OK;
+#else
+    if (lba >= p->blocks || (uint64_t)count > p->blocks - lba) return DISK_ERANGE; /* GUARD:part-end */
+    uint64_t a = p->first_lba + lba;
+    if (a < p->first_lba || a >= pc || (uint64_t)count > pc - a) return DISK_ERANGE; /* GUARD:part-parent */
+    *abs = a;
+    return DISK_OK;
+#endif
+}
+
+const char *ck_gpt_strerror(int rc)
+{
+    switch (rc) {
+    case CK_GPT_OK: return "ok";
+    case CK_GPT_EIO: return "read error";
+    case CK_GPT_EGEOM: return "disk geometry";
+    case CK_GPT_ENOMBR: return "no protective MBR";
+    case CK_GPT_ESIG: return "no GPT header";
+    case CK_GPT_EHDR_CRC: return "primary header CRC32 mismatch";
+    case CK_GPT_EHDR: return "primary header fields invalid";
+    case CK_GPT_EENT_CRC: return "entry array CRC32 mismatch";
+    case CK_GPT_EENT: return "entry geometry refused";
+    case CK_GPT_EBACKUP: return "backup GPT invalid";
+    case CK_GPT_EOUTSIDE: return "partition outside the usable range";
+    case CK_GPT_EOVERLAP: return "overlapping partitions";
+    case CK_GPT_ENOPART: return "no AIENOS partition type";
+    case CK_GPT_EMULTI: return "more than one AIENOS partition";
+    case CK_GPT_ETOOMANY: return "too many used entries";
+    default: return "error";
+    }
+}
diff --git a/native/kernel/dev/disk_part.h b/native/kernel/dev/disk_part.h
new file mode 100644
index 00000000..07b5b1b9
--- /dev/null
+++ b/native/kernel/dev/disk_part.h
@@ -0,0 +1,99 @@
+/* disk_part.h -- the AIENOS C kernel's partition-aware disk footprint.
+ *
+ * The kernel never writes a whole NVMe namespace. At bind time it parses the
+ * disk's GUID Partition Table (UEFI 2.10, section 5.3) READ-ONLY and selects
+ * exactly one AIENOS partition by its fixed partition type GUID:
+ *
+ *     AIENOS partition type GUID  38DAAC89-5EAD-4B40-8B1E-3687A7418061
+ *     (generated once from /dev/urandom on 2026-10-01, version 4 / variant 1;
+ *      on-disk bytes, mixed endian: 89 AC DA 38 AD 5E 40 4B 8B 1E 36 87 A7 41 80 61)
+ *
+ * Every kernel disk access after that (rw probe, torn_slot anchor, Store)
+ * goes through ONE bounds-checked translation layer, ck_part_xlate, behind a
+ * disk_dev "partition view" (ck_part.dev): partition-relative LBA in,
+ * absolute LBA out, refused unless the whole transfer lies inside the
+ * partition. Nothing else in the kernel holds a writable whole-disk handle.
+ *
+ * Validation is strict and fails closed (no fallback to the whole disk):
+ * protective MBR (0x55AA, one 0xEE record), primary header (signature,
+ * revision 1.0, size, CRC32, MyLBA 1, AlternateLBA = last LBA, usable range),
+ * primary entry array CRC32, backup header (CRC32, MyLBA = last, AlternateLBA
+ * 1, same disk GUID / entry geometry / entry CRC) and the backup entry array
+ * CRC32; every used entry inside the usable range, no two used entries
+ * overlapping, exactly one AIENOS entry. Any failure: the caller prints
+ * "disk: no AIENOS partition, refusing writes" and never writes the disk.
+ *
+ * Freestanding: no libc, no heap; reads through disk_read only. Shared with
+ * the host tools (tools/ck_gpt_image.c, tools/ck_store_image.c) and the host
+ * test dev/tests/disk_part_test.c. */
+#ifndef AIENOS_CK_DISK_PART_H
+#define AIENOS_CK_DISK_PART_H
+#include <stddef.h>
+#include <stdint.h>
+#include "disk.h"
+
+/* TEST-ONLY mutation (scripts/qemu_ck_disk_layout_test.sh): the translation
+ * layer adds no partition offset and checks only the parent disk's bounds.
+ * It exists so the DISK_LAYOUT gate can prove it notices a bypass. Never
+ * with a hardware staging build. */
+#if defined(CK_TEST_DISK_XLATE_BYPASS) && defined(CK_HARDWARE_STAGING)
+#error "CK_TEST_DISK_XLATE_BYPASS (TEST-ONLY translation bypass mutation) cannot be combined with CK_HARDWARE_STAGING"
+#endif
+
+extern const uint8_t ck_aienos_part_type[16]; /* on-disk byte order */
+
+#define CK_GPT_MAX_ENTRIES 1024u   /* NumberOfPartitionEntries upper bound */
+#define CK_GPT_MAX_USED 128u       /* used (non-zero type) entries upper bound */
+#define CK_GPT_HDR_MIN 92u         /* HeaderSize lower bound (UEFI) */
+
+enum {
+    CK_GPT_OK = 0,
+    CK_GPT_EIO = -401,        /* a read failed */
+    CK_GPT_EGEOM = -402,      /* block size / disk too small for a GPT */
+    CK_GPT_ENOMBR = -403,     /* no protective MBR (no 0x55AA or no 0xEE record) */
+    CK_GPT_ESIG = -404,       /* primary header signature / revision / size */
+    CK_GPT_EHDR_CRC = -405,   /* primary header CRC32 mismatch */
+    CK_GPT_EHDR = -406,       /* primary header fields inconsistent */
+    CK_GPT_EENT_CRC = -407,   /* primary entry array CRC32 mismatch */
+    CK_GPT_EENT = -408,       /* entry geometry (count/size/overflow) refused */
+    CK_GPT_EBACKUP = -409,    /* backup header or backup entry array invalid */
+    CK_GPT_EOUTSIDE = -410,   /* a used entry lies outside the usable range */
+    CK_GPT_EOVERLAP = -411,   /* two used entries overlap */
+    CK_GPT_ENOPART = -412,    /* no AIENOS partition */
+    CK_GPT_EMULTI = -413,     /* more than one AIENOS partition */
+    CK_GPT_ETOOMANY = -414,   /* more than CK_GPT_MAX_USED used entries */
+};
+
+typedef struct {
+    uint64_t last_lba;        /* disk's last LBA */
+    uint64_t first_usable, last_usable;
+    uint32_t entries, entry_size;
+    uint32_t used;            /* used entries */
+    uint32_t part_index;      /* index of the AIENOS entry */
+} ck_gpt_info;
+
+typedef struct {
+    const disk_dev *parent;   /* whole namespace: read for the GPT, written only through ck_part_xlate */
+    uint64_t first_lba;       /* absolute first LBA of the AIENOS partition */
+    uint64_t blocks;          /* partition length in blocks */
+    int valid;                /* 1 only after ck_gpt_find_aienos succeeded */
+    disk_dev dev;             /* the partition view; dev.ctx == this */
+} ck_part;
+
+/* CRC32 (IEEE 802.3, reflected 0xEDB88320, init/xorout 0xFFFFFFFF), the
+ * GPT checksum. Chain: crc = ck_crc32(crc, p, n) starting from 0. */
+uint32_t ck_crc32(uint32_t crc, const uint8_t *p, size_t n);
+
+/* Parse and validate the GPT on d (reads only). On success fills *p (a valid
+ * partition view over d) and *info; on failure *p is invalid (every I/O
+ * through p->dev refused) and the CK_GPT_* code is returned. */
+int ck_gpt_find_aienos(const disk_dev *d, ck_part *p, ck_gpt_info *info);
+
+/* The single translation layer: partition-relative lba/count -> absolute
+ * LBA. DISK_ESTATE when p is not a valid partition, DISK_EARG for count 0,
+ * DISK_ERANGE when any block of the transfer would fall outside the
+ * partition (or the parent disk), including on overflow. */
+int ck_part_xlate(const ck_part *p, uint64_t lba, uint32_t count, uint64_t *abs);
+
+const char *ck_gpt_strerror(int rc);
+#endif
diff --git a/native/kernel/dev/nvme_bind.c b/native/kernel/dev/nvme_bind.c
index 1ecd00dd..ac56ee08 100644
--- a/native/kernel/dev/nvme_bind.c
+++ b/native/kernel/dev/nvme_bind.c
@@ -137,6 +137,10 @@ int ck_nvme_bind(ck_nvme *n, const pci_system *pci)
     n->stream_id = 0;
 #if CK_NVME_UNSAFE_BYPASS
     ck_printf("WARNING: UNSAFE NVME DMA BYPASS BUILD (CK_QEMU_UNSAFE_DMA=1, QEMU debug only, TEST-ONLY)\n");
+#endif
+#if defined(CK_TEST_DISK_XLATE_BYPASS)
+    ck_printf("WARNING: TEST-ONLY DISK TRANSLATION BYPASS BUILD (CK_TEST_DISK_XLATE_BYPASS=1, DISK_LAYOUT "
+              "mutation; never counts toward a PASS)\n");
 #endif
     const pci_func *f = pci_find_class(pci, 0x010802u, 0xffffffu);
     if (!f) {
@@ -220,11 +224,39 @@ int ck_nvme_bind(ck_nvme *n, const pci_system *pci)
     rc = disk_read(&n->disk, 0, 1, one);
     ck_printf("nvme: read lba=0 blocks=1 %s (rc=%d)\n", rc ? "FAIL" : "ok", rc);
     if (rc) return rc;
-    uint64_t lba = 0;
-    rc = ck_disk_rw_probe(&n->disk, (uint32_t)ck_time_us() ^ 0xa5a5a5a5u, &lba);
-    ck_printf("nvme: rw probe lba=%llu bytes=%u write+flush+readback %s (rc=%d)\n", (unsigned long long)lba,
-              CK_LAYOUT_UNIT, rc ? "FAIL" : "match", rc);
+    /* Partition-aware footprint (dev/disk_part.h, audit R2): the GPT is
+     * parsed read-only; without exactly one valid AIENOS partition nothing is
+     * ever written to this disk and there is no whole-disk fallback. */
+    ck_gpt_info gi;
+    rc = ck_gpt_find_aienos(&n->disk, &n->part, &gi);
+    if (rc) {
+        ck_printf("disk: no AIENOS partition, refusing writes (gpt: %s, rc=%d)\n", ck_gpt_strerror(rc), rc);
+        return rc;
+    }
+    ck_printf("disk: gpt ok primary+backup crc32 entries=%u used=%u aienos_index=%u first_lba=%llu "
+              "last_lba=%llu blocks=%llu\n",
+              gi.entries, gi.used, gi.part_index, (unsigned long long)n->part.first_lba,
+              (unsigned long long)(n->part.first_lba + n->part.blocks - 1u), (unsigned long long)n->part.blocks);
+    /* The translation layer itself (no I/O): partition LBA 0 maps to the
+     * partition start; past the end, straddling the end and an overflowing
+     * LBA are refused. Any of these not refused: stop before any write. */
+    uint64_t a0 = 0, ax = 0;
+    int x0 = ck_part_xlate(&n->part, 0, 1, &a0);
+    int x1 = ck_part_xlate(&n->part, n->part.blocks, 1, &ax);
+    int x2 = ck_part_xlate(&n->part, n->part.blocks - 1u, 2, &ax);
+    int x3 = ck_part_xlate(&n->part, ~(uint64_t)0, 1, &ax);
+    int xok = x0 == DISK_OK && x1 == DISK_ERANGE && x2 == DISK_ERANGE && x3 == DISK_ERANGE;
+    ck_printf("disk: xlate part_lba=0 -> disk_lba=%llu (rc=%d)\n", (unsigned long long)a0, x0);
+    ck_printf("disk: write past partition end part_lba=%llu -> %s (xlate rc=%d,%d,%d)\n", (unsigned long long)n->part.blocks,
+              xok ? "refused" : "NOT REFUSED", x1, x2, x3);
+    if (!xok) return DISK_ERANGE; /* not -1: devices.c reads -1 as "no NVMe present" */
+    uint64_t lba = 0, dlba = 0;
+    rc = ck_disk_rw_probe(&n->part.dev, (uint32_t)ck_time_us() ^ 0xa5a5a5a5u, &lba);
+    int xr = ck_part_xlate(&n->part, lba, CK_LAYOUT_UNIT / n->part.dev.block_size, &dlba);
+    ck_printf("nvme: rw probe part_lba=%llu disk_lba=%llu bytes=%u write+flush+readback %s (rc=%d)\n",
+              (unsigned long long)lba, (unsigned long long)dlba, CK_LAYOUT_UNIT, rc ? "FAIL" : "match", rc);
     if (rc) return rc;
+    if (xr) return DISK_ERANGE;
     if (n->confined) {
         rc = smmu_negative_test(n);
         if (rc) return DISK_EIO;
diff --git a/native/kernel/dev/nvme_bind.h b/native/kernel/dev/nvme_bind.h
index 1f1b1ec8..e20c54b8 100644
--- a/native/kernel/dev/nvme_bind.h
+++ b/native/kernel/dev/nvme_bind.h
@@ -5,6 +5,7 @@
 #include "disk.h"
 #include "disk_nvme.h"
 #include "pci.h"
+#include "disk_part.h"
 
 /* DMA region handed to the driver: 6 fixed pages + 128 KiB bounce. */
 #define CK_NVME_DMA_BYTES ((NVME_FIXED_PAGES * NVME_PAGE) + NVME_MAX_XFER)
@@ -19,13 +20,18 @@ typedef struct {
     int confined;      /* DMA confined by the SMMU (ck_dma_confine) */
     int shut;          /* normal shutdown already attempted (ck_nvme_shutdown_bound) */
     uint32_t stream_id; /* SMMU stream when confined */
+    ck_part part;      /* the AIENOS partition view (dev/disk_part.h): the only writable disk */
 } ck_nvme;
 
 /* Find the first class 01/08/02 function, gate DMA, map BAR0, init the
- * controller, fill n->disk, print identify/geometry/atomicity lines, then
- * run the probe (bounds refusal, read LBA 0, write+flush+read-back of the
- * last 4 KiB unit). Returns 0, or a negative NVME_E* / DISK_E* / -1 when
- * no NVMe function exists. */
+ * controller, fill n->disk, print identify/geometry/atomicity lines, run the
+ * read-only checks (bounds refusal, read LBA 0), parse the GPT read-only and
+ * select the AIENOS partition (n->part; none or an invalid GPT: print
+ * "disk: no AIENOS partition, refusing writes" and return the CK_GPT_* code
+ * with nothing written), check the translation layer refuses past the
+ * partition end, then run the write+flush+read-back probe on the last 4 KiB
+ * unit OF THE PARTITION. Returns 0, or a negative NVME_E* / DISK_E* /
+ * CK_GPT_* / -1 when no NVMe function exists. */
 int ck_nvme_bind(ck_nvme *n, const pci_system *pci);
 
 /* Normal NVMe shutdown (dev/nvme_shutdown.c) on the bound controller, run
@@ -34,8 +40,9 @@ int ck_nvme_bind(ck_nvme *n, const pci_system *pci);
  * Runs at most once per bind; returns the CK_NVME_SHUT_* code. */
 int ck_nvme_shutdown_bound(ck_nvme *n);
 
-/* Run the write/flush/read-back probe on the last whole unit of `d`
- * (shared with the host tests). `seed` varies the pattern per boot.
+/* Run the write/flush/read-back probe on the last whole unit of `d` (the
+ * kernel passes the AIENOS partition view, never the whole namespace;
+ * shared with the host tests). `*lba_out` is relative to `d`. `seed` varies the pattern per boot.
  * The unit's original bytes are read first and written back (flushed and
  * verified) afterwards, so a boot leaves the disk bytes as it found them. */
 int ck_disk_rw_probe(const disk_dev *d, uint32_t seed, uint64_t *lba_out);
diff --git a/native/kernel/dev/tests/disk_part_test.c b/native/kernel/dev/tests/disk_part_test.c
new file mode 100644
index 00000000..42e9ede9
--- /dev/null
+++ b/native/kernel/dev/tests/disk_part_test.c
@@ -0,0 +1,355 @@
+/* disk_part_test.c -- host tests for the GPT parser and the LBA translation
+ * layer (dev/disk_part.c), hostile inputs included, plus a whole sealed-Store
+ * boot on the AIENOS partition view proving nothing outside the partition
+ * changes. Hosted test code only.
+ *
+ * Built twice by stage.mk (make disk-part-test): normally (must PASS) and
+ * with -DCK_TEST_DISK_XLATE_BYPASS (the translation-layer bypass mutation,
+ * which must FAIL these checks). */
+#include <fcntl.h>
+#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 "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)
+
+static char g_path[256];
+#define MIB 64u
+
+static void put32(uint8_t *p, uint32_t v) { for (int i = 0; i < 4; i++) p[i] = (uint8_t)(v >> (8 * i)); }
+static void put64(uint8_t *p, uint64_t v) { for (int i = 0; i < 8; i++) p[i] = (uint8_t)(v >> (8 * i)); }
+
+/* Standard layout of tools/ck_gpt_image.c "aienos-middle" (MiB units). */
+static int make_image(uint32_t bs, const uint8_t *mid_type, const uint8_t *b_type, uint64_t mid_first_mib,
+                      uint64_t mid_end_mib, int nparts, unsigned flags, uint64_t *first, uint64_t *last)
+{
+    uint64_t per = (1024u * 1024u) / bs;
+    gw_part p[3] = {
+        {gw_linux_type, 1 * per, 9 * per - 1u, "sentinel-a", 0xa5},
+        {mid_type, mid_first_mib * per, mid_end_mib * per - 1u, "AIENOS", 0},
+        {b_type, (MIB - 7u) * per, (MIB - 1u) * per - 1u, "sentinel-b", 0x5a},
+    };
+    if (first) *first = p[1].first;
+    if (last) *last = p[1].last;
+    return gw_write(g_path, bs, MIB * per, p, nparts, flags);
+}
+static int good_image(uint32_t bs, uint64_t *first, uint64_t *last)
+{
+    return make_image(bs, ck_aienos_part_type, gw_linux_type, 9, MIB - 7u, 3, 0, first, last);
+}
+
+static int find(uint32_t bs, ck_part *p, disk_file *f, disk_dev *d)
+{
+    ck_gpt_info gi;
+    if (disk_file_open(f, d, g_path, bs, 0, 0)) return 9999;
+    return ck_gpt_find_aienos(d, p, &gi);
+}
+static int find_rc(uint32_t bs)
+{
+    static ck_part p;
+    disk_file f;
+    disk_dev d;
+    int rc = find(bs, &p, &f, &d);
+    if (rc != 9999) disk_file_close(&f);
+    return rc;
+}
+
+static uint8_t *slurp(size_t *len)
+{
+    FILE *fp = fopen(g_path, "rb");
+    if (!fp) return NULL;
+    fseek(fp, 0, SEEK_END);
+    long n = ftell(fp);
+    fseek(fp, 0, SEEK_SET);
+    uint8_t *b = malloc((size_t)n);
+    if (b && fread(b, 1, (size_t)n, fp) != (size_t)n) {
+        free(b);
+        b = NULL;
+    }
+    fclose(fp);
+    *len = (size_t)n;
+    return b;
+}
+
+/* Rewrite one GPT header in place (field patch) and fix its CRC32. */
+static void patch_header(uint32_t bs, uint64_t lba, size_t off, uint64_t v, int width)
+{
+    int fd = open(g_path, O_RDWR);
+    uint8_t h[4096];
+    if (fd < 0 || pread(fd, h, bs, (off_t)(lba * bs)) != (ssize_t)bs) {
+        CHECK(!"patch_header read");
+        if (fd >= 0) close(fd);
+        return;
+    }
+    if (width == 4) put32(h + off, (uint32_t)v); else put64(h + off, v);
+    uint32_t hs = h[12] | (uint32_t)h[13] << 8;
+    if (hs > bs) hs = 92;
+    put32(h + 16, 0);
+    put32(h + 16, ck_crc32(0, h, hs));
+    CHECK(pwrite(fd, h, bs, (off_t)(lba * bs)) == (ssize_t)bs);
+    close(fd);
+}
+
+/* Crafted GPT with num entries of esize bytes; `used` consecutive 8-block
+ * Linux partitions starting at first_usable; the last one is AIENOS. */
+static void craft(uint32_t bs, uint64_t blocks, uint32_t num, uint32_t esize, uint32_t used)
+{
+    uint64_t eb = ((uint64_t)num * esize + bs - 1u) / bs, last = blocks - 1u;
+    uint64_t fu = 2u + eb, lu = last - 1u - eb;
+    uint8_t *ent = calloc(eb, bs), *h = calloc(1, bs), *m = calloc(1, bs);
+    for (uint32_t i = 0; i < used && i < num; i++) {
+        uint8_t *e = ent + (size_t)i * esize;
+        memcpy(e, i + 1 == used ? ck_aienos_part_type : gw_linux_type, 16);
+        e[16] = (uint8_t)(i + 1);
+        put64(e + 32, fu + 8u * i);
+        put64(e + 40, fu + 8u * i + 7u);
+    }
+    uint32_t ec = ck_crc32(0, ent, (size_t)num * esize);
+    int fd = open(g_path, O_RDWR | O_CREAT | O_TRUNC, 0644);
+    CHECK(fd >= 0 && ftruncate(fd, (off_t)(blocks * bs)) == 0);
+    m[446 + 4] = 0xee;
+    put32(m + 446 + 8, 1);
+    m[510] = 0x55;
+    m[511] = 0xaa;
+    CHECK(pwrite(fd, m, bs, 0) == (ssize_t)bs);
+    for (int k = 0; k < 2; k++) {
+        uint64_t my = k ? last : 1, alt = k ? 1 : last, el = k ? last - eb : 2;
+        memset(h, 0, bs);
+        memcpy(h, "EFI PART", 8);
+        put32(h + 8, 0x00010000u);
+        put32(h + 12, 92);
+        put64(h + 24, my);
+        put64(h + 32, alt);
+        put64(h + 40, fu);
+        put64(h + 48, lu);
+        memcpy(h + 56, "CRAFTED-DISKGUID", 16);
+        put64(h + 72, el);
+        put32(h + 80, num);
+        put32(h + 84, esize);
+        put32(h + 88, ec);
+        put32(h + 16, ck_crc32(0, h, 92));
+        CHECK(pwrite(fd, h, bs, (off_t)(my * bs)) == (ssize_t)bs);
+        CHECK(pwrite(fd, ent, (size_t)(eb * bs), (off_t)(el * bs)) == (ssize_t)(eb * bs));
+    }
+    close(fd);
+    free(ent);
+    free(h);
+    free(m);
+}
+
+static void test_crc32(void)
+{
+    CHECK(ck_crc32(0, (const uint8_t *)"123456789", 9) == 0xcbf43926u); /* standard check value */
+    uint32_t c = ck_crc32(0, (const uint8_t *)"1234", 4);
+    CHECK(ck_crc32(c, (const uint8_t *)"56789", 5) == 0xcbf43926u); /* chaining */
+}
+
+static void test_good_and_xlate(uint32_t bs)
+{
+    uint64_t f0 = 0, l0 = 0;
+    CHECK(good_image(bs, &f0, &l0) == 0);
+    static ck_part p;
+    disk_file f;
+    disk_dev d;
+    CHECK(find(bs, &p, &f, &d) == CK_GPT_OK);
+    CHECK(p.valid == 1 && p.first_lba == f0 && p.blocks == l0 - f0 + 1u);
+    CHECK(p.dev.block_count == p.blocks && p.dev.block_size == bs && p.dev.ctx == &p);
+    uint64_t a = 0;
+    CHECK(ck_part_xlate(&p, 0, 1, &a) == DISK_OK && a == f0);
+    CHECK(ck_part_xlate(&p, p.blocks - 1u, 1, &a) == DISK_OK && a == l0);
+    CHECK(ck_part_xlate(&p, p.blocks, 1, &a) == DISK_ERANGE);
+    CHECK(ck_part_xlate(&p, p.blocks - 1u, 2, &a) == DISK_ERANGE);
+    CHECK(ck_part_xlate(&p, ~(uint64_t)0, 1, &a) == DISK_ERANGE);
+    CHECK(ck_part_xlate(&p, ~(uint64_t)0 - p.first_lba + 1u, 1, &a) == DISK_ERANGE); /* offset wrap */
+    CHECK(ck_part_xlate(&p, 0, 0, &a) == DISK_EARG);
+    ck_part bad = p;
+    bad.valid = 0;
+    CHECK(ck_part_xlate(&bad, 0, 1, &a) == DISK_ESTATE);
+
+    /* Real writes through the view: first and last partition block land at
+     * the partition's absolute first/last LBA; past the end is refused both
+     * by disk.c and by the translation layer itself (backend callback called
+     * directly); nothing outside [f0, l0] changes. */
+    size_t n0 = 0, n1 = 0;
+    disk_file_close(&f);
+    uint8_t *before = slurp(&n0);
+    CHECK(find(bs, &p, &f, &d) == CK_GPT_OK);
+    uint8_t *blk = malloc(bs);
+    memset(blk, 0xc3, bs);
+    CHECK(disk_write(&p.dev, 0, 1, blk) == DISK_OK);
+    CHECK(disk_write(&p.dev, p.blocks - 1u, 1, blk) == DISK_OK);
+    CHECK(disk_write(&p.dev, p.blocks, 1, blk) == DISK_ERANGE);
+    CHECK(p.dev.write(p.dev.ctx, p.blocks, 1, blk) == DISK_ERANGE);
+    CHECK(p.dev.write(p.dev.ctx, p.blocks - 1u, 2, blk) == DISK_ERANGE);
+    CHECK(p.dev.read(p.dev.ctx, p.blocks, 1, blk) == DISK_ERANGE);
+    CHECK(disk_flush(&p.dev) == DISK_OK);
+    disk_file_close(&f);
+    uint8_t *after = slurp(&n1);
+    CHECK(before && after && n0 == n1);
+    if (before && after && n0 == n1) {
+        CHECK(memcmp(before, after, (size_t)(f0 * bs)) == 0);                     /* MBR, primary GPT, sentinel-a */
+        CHECK(memcmp(before + (l0 + 1u) * bs, after + (l0 + 1u) * bs, n0 - (size_t)((l0 + 1u) * bs)) == 0); /* sentinel-b, backup */
+        CHECK(after[f0 * bs] == 0xc3 && after[l0 * bs] == 0xc3);
+    }
+    free(before);
+    free(after);
+    free(blk);
+    /* The image still parses after the writes (GPT untouched). */
+    CHECK(find_rc(bs) == CK_GPT_OK);
+}
+
+/* A whole sealed-Store boot (format + two commits) on the AIENOS partition
+ * view: the GPT, both sentinels and the backup stay byte-identical. */
+static void test_store_on_partition(uint32_t bs)
+{
+    uint64_t f0 = 0, l0 = 0;
+    CHECK(good_image(bs, &f0, &l0) == 0);
+    size_t n0 = 0, n1 = 0;
+    uint8_t *before = slurp(&n0);
+    static ck_part p;
+    disk_file f;
+    disk_dev d;
+    CHECK(find(bs, &p, &f, &d) == CK_GPT_OK);
+    ss_keys k;
+    ck_store_report r;
+    ck_store_test_keys(&k);
+    ck_host_quiet = 1;
+    int rc1 = store_boot_run(&p.dev, &k, ck_store_test_uuid, "disk-part-test", &r);
+    int fm = r.formatted;
+    int rc2 = store_boot_run(&p.dev, &k, ck_store_test_uuid, "disk-part-test", &r);
+    ck_host_quiet = 0;
+    CHECK(rc1 == 0 && fm == 1);
+    CHECK(rc2 == 0 && r.boot_count_new == 2 && r.anchor_lba == 0);
+    CHECK(r.store_units == p.blocks / (CK_LAYOUT_UNIT / bs) - CK_LAYOUT_ANCHOR_UNITS - CK_LAYOUT_PROBE_UNITS);
+    disk_file_close(&f);
+    uint8_t *after = slurp(&n1);
+    CHECK(before && after && n0 == n1);
+    if (before && after && n0 == n1) {
+        CHECK(memcmp(before, after, (size_t)(f0 * bs)) == 0);
+        CHECK(memcmp(before + (l0 + 1u) * bs, after + (l0 + 1u) * bs, n0 - (size_t)((l0 + 1u) * bs)) == 0);
+        CHECK(memcmp(before + f0 * bs, after + f0 * bs, (size_t)((l0 - f0 + 1u) * bs)) != 0); /* the Store wrote inside */
+    }
+    free(before);
+    free(after);
+    memset(&k, 0, sizeof k);
+    CHECK(find_rc(bs) == CK_GPT_OK);
+}
+
+static void test_hostile(uint32_t bs)
+{
+    uint64_t per = (1024u * 1024u) / bs, blocks = MIB * per, last = blocks - 1u;
+    /* No GPT at all (sentinel data only), and a GPT without a protective MBR. */
+    CHECK(make_image(bs, ck_aienos_part_type, gw_linux_type, 9, MIB - 7u, 3, GW_NO_GPT, 0, 0) == 0);
+    CHECK(find_rc(bs) == CK_GPT_ENOMBR);
+    CHECK(make_image(bs, ck_aienos_part_type, gw_linux_type, 9, MIB - 7u, 3, GW_NO_PMBR, 0, 0) == 0);
+    CHECK(find_rc(bs) == CK_GPT_ENOMBR);
+    /* CRC32: primary header (valid backup present: still refused, no fallback). */
+    CHECK(make_image(bs, ck_aienos_part_type, gw_linux_type, 9, MIB - 7u, 3, GW_BAD_PRIMARY_CRC, 0, 0) == 0);
+    CHECK(find_rc(bs) == CK_GPT_EHDR_CRC);
+    CHECK(make_image(bs, ck_aienos_part_type, gw_linux_type, 9, MIB - 7u, 3, GW_BAD_PRIMARY_CRC | GW_BAD_BACKUP_CRC, 0, 0) == 0);
+    CHECK(find_rc(bs) == CK_GPT_EHDR_CRC);
+    CHECK(make_image(bs, ck_aienos_part_type, gw_linux_type, 9, MIB - 7u, 3, GW_BAD_PRIMARY_ENT, 0, 0) == 0);
+    CHECK(find_rc(bs) == CK_GPT_EENT_CRC);
+    CHECK(make_image(bs, ck_aienos_part_type, gw_linux_type, 9, MIB - 7u, 3, GW_BAD_PRIMARY_ENT | GW_BAD_BACKUP_ENT, 0, 0) == 0);
+    CHECK(find_rc(bs) == CK_GPT_EENT_CRC);
+    CHECK(make_image(bs, ck_aienos_part_type, gw_linux_type, 9, MIB - 7u, 3, GW_BAD_BACKUP_CRC, 0, 0) == 0);
+    CHECK(find_rc(bs) == CK_GPT_EBACKUP);
+    CHECK(make_image(bs, ck_aienos_part_type, gw_linux_type, 9, MIB - 7u, 3, GW_BAD_BACKUP_ENT, 0, 0) == 0);
+    CHECK(find_rc(bs) == CK_GPT_EBACKUP);
+    /* Partition table semantics. */
+    CHECK(make_image(bs, gw_linux_type, gw_linux_type, 9, MIB - 7u, 3, 0, 0, 0) == 0);
+    CHECK(find_rc(bs) == CK_GPT_ENOPART);
+    CHECK(make_image(bs, ck_aienos_part_type, ck_aienos_part_type, 9, MIB - 7u, 3, 0, 0, 0) == 0);
+    CHECK(find_rc(bs) == CK_GPT_EMULTI);
+    CHECK(make_image(bs, ck_aienos_part_type, gw_linux_type, 9, MIB + 1u, 2, 0, 0, 0) == 0); /* ends past the disk */
+    CHECK(find_rc(bs) == CK_GPT_EOUTSIDE);
+    CHECK(make_image(bs, ck_aienos_part_type, gw_linux_type, 0, MIB - 7u, 2, 0, 0, 0) == 0); /* starts on the GPT */
+    CHECK(find_rc(bs) == CK_GPT_EOUTSIDE);
+    CHECK(make_image(bs, ck_aienos_part_type, gw_linux_type, 5, MIB - 7u, 3, 0, 0, 0) == 0); /* overlaps sentinel-a */
+    CHECK(find_rc(bs) == CK_GPT_EOVERLAP);
+
+    /* Header field attacks on an otherwise good image (CRC re-computed). */
+    struct { size_t off; uint64_t v; int w; int want; } hp[] = {
+        {80, 0xffffffffu, 4, CK_GPT_EENT},           /* entry count overflow */
+        {80, 0, 4, CK_GPT_EENT},                     /* no entries */
+        {84, 0x80000000u, 4, CK_GPT_EENT},           /* entry size overflow */
+        {84, 64, 4, CK_GPT_EENT},                    /* entry size below 128 */
+        {84, 136, 4, CK_GPT_EENT},                   /* entry size not 128 x 2^n */
+        {24, 2, 8, CK_GPT_EHDR},                     /* MyLBA not 1 */
+        {32, 7, 8, CK_GPT_EHDR},                     /* AlternateLBA not the last LBA */
+        {72, ~(uint64_t)0, 8, CK_GPT_EHDR},          /* entry LBA overflow */
+        {72, 1, 8, CK_GPT_EHDR},                     /* entries on the header */
+        {40, 3, 8, CK_GPT_EHDR},                     /* first usable inside the entry array */
+        {48, ~(uint64_t)0, 8, CK_GPT_EHDR},          /* last usable past the disk */
+        {12, 8192, 4, CK_GPT_ESIG},                  /* header size larger than a block */
+        {12, 91, 4, CK_GPT_ESIG},                    /* header size below 92 */
+        {8, 0x00020000u, 4, CK_GPT_ESIG},            /* unknown revision */
+    };
+    for (size_t i = 0; i < sizeof hp / sizeof hp[0]; i++) {
+        CHECK(good_image(bs, 0, 0) == 0);
+        patch_header(bs, 1, hp[i].off, hp[i].v, hp[i].w);
+        int rc = find_rc(bs);
+        if (rc != hp[i].want) printf("  header patch %zu: rc=%d want %d\n", i, rc, hp[i].want);
+        CHECK(rc == hp[i].want);
+    }
+    /* Backup header disagreeing with the primary (both CRCs valid). */
+    CHECK(good_image(bs, 0, 0) == 0);
+    patch_header(bs, last, 48, 100u, 8);
+    CHECK(find_rc(bs) == CK_GPT_EBACKUP);
+    /* Disk grown after partitioning: the backup is no longer at the last LBA. */
+    CHECK(good_image(bs, 0, 0) == 0);
+    CHECK(truncate(g_path, (off_t)((blocks + per) * bs)) == 0);
+    CHECK(find_rc(bs) == CK_GPT_EHDR);
+    /* Disk too small for any GPT. */
+    CHECK(truncate(g_path, (off_t)(4u * bs)) == 0);
+    CHECK(find_rc(bs) == CK_GPT_EGEOM);
+
+    /* Crafted tables (CRCs valid): 256 entries of 128 bytes with 129 used is
+     * over the used-entry bound; 256 x 128 with 3 used and 128 x 256 with 2
+     * used are accepted. */
+    craft(bs, blocks, 256, 128, 129);
+    CHECK(find_rc(bs) == CK_GPT_ETOOMANY);
+    craft(bs, blocks, 256, 128, 3);
+    CHECK(find_rc(bs) == CK_GPT_OK);
+    craft(bs, blocks, 128, 256, 2);
+    CHECK(find_rc(bs) == CK_GPT_OK);
+    /* A 1024 x 512-byte entry array (512 KiB) overruns the first usable LBA. */
+    CHECK(good_image(bs, 0, 0) == 0);
+    patch_header(bs, 1, 80, 1024, 4);
+    patch_header(bs, 1, 84, 512, 4);
+    CHECK(find_rc(bs) == CK_GPT_EHDR);
+}
+
+int main(void)
+{
+    snprintf(g_path, sizeof g_path, "/tmp/aienos-disk-part-test-%d.img", (int)getpid());
+#ifdef CK_TEST_DISK_XLATE_BYPASS
+    printf("disk_part_test: TEST-ONLY translation bypass mutation build (these checks must FAIL)\n");
+#endif
+    test_crc32();
+    for (uint32_t bs = 512; bs <= 4096; bs *= 8) {
+        test_good_and_xlate(bs);
+        test_store_on_partition(bs);
+        test_hostile(bs);
+    }
+    unlink(g_path);
+    printf("disk_part_test: %d checks, %d failures\n", checks, failures);
+    printf("CK_DISK_PART_HOST: %s\n", failures ? "FAIL" : "PASS");
+    return failures ? 1 : 0;
+}
diff --git a/native/kernel/stage.mk b/native/kernel/stage.mk
index e47d8814..2caa7435 100644
--- a/native/kernel/stage.mk
+++ b/native/kernel/stage.mk
@@ -3,6 +3,10 @@
 #   make -C native/kernel -f stage.mk stage-test       host tests (libc, pthreads)
 #   make -C native/kernel -f stage.mk stage-sanitize   same under ASan + UBSan
 #   make -C native/kernel -f stage.mk stage-free       freestanding compile + nm -u check
+#   make -C native/kernel -f stage.mk disk-part-test   GPT parser + LBA translation host test
+#        (dev/tests/disk_part_test.c), built normally (must PASS) and as the
+#        TEST-ONLY translation-bypass mutant (must FAIL); stage-test and
+#        stage-sanitize run it too
 # Exports for the kernel image build:
 #   STAGE_SRCS    every .c the stages need (own files + unmodified native/*)
 #   STAGE_CFLAGS  include paths and defines; add to the kernel's freestanding CFLAGS
@@ -15,7 +19,7 @@ STAGE_NATIVE := $(STAGE_DIR)/..
 STAGE_OUT ?= $(abspath $(STAGE_DIR)/../../target/stage)
 
 # Own sources (image).
-STAGE_OWN_SRCS := $(STAGE_DIR)/dev/pci.c $(STAGE_DIR)/dev/nvme_bind.c $(STAGE_DIR)/dev/nvme_shutdown.c $(STAGE_DIR)/dev/virtio_net.c \
+STAGE_OWN_SRCS := $(STAGE_DIR)/dev/pci.c $(STAGE_DIR)/dev/disk_part.c $(STAGE_DIR)/dev/nvme_bind.c $(STAGE_DIR)/dev/nvme_shutdown.c $(STAGE_DIR)/dev/virtio_net.c \
                   $(STAGE_DIR)/dev/net_bind.c $(STAGE_DIR)/dev/net_udp.c $(STAGE_DIR)/dev/xhci_fence.c \
                   $(STAGE_DIR)/dev/devices.c $(STAGE_DIR)/svc/security.c $(STAGE_DIR)/svc/store_boot.c \
                   $(STAGE_DIR)/svc/artifact_store.c $(STAGE_DIR)/svc/store_crash.c
@@ -71,7 +75,7 @@ $(foreach s,$(STAGE_SRCS),$(eval $(call stage_free_rule,$(s))))
 $(STAGE_OUT)/stage_all.o: $(STAGE_FREE_OBJS)
 	$(STAGE_LD) -r -o $@ $^
 
-.PHONY: stage-free stage-test stage-sanitize stage-clean
+.PHONY: stage-free stage-test stage-sanitize stage-clean disk-part-test disk-part-sanitize
 stage-free: $(STAGE_OUT)/stage_all.o
 	@bad=$$($(STAGE_NM) -u $< | awk '{print $$2}' | grep -vxF $(foreach a,$(STAGE_ALLOWED_U),-e $(a)) || true); \
 	if [ -n "$$bad" ]; then echo "CK_STAGE_FREE: FAIL undefined: $$bad"; exit 1; fi; \
@@ -102,3 +106,39 @@ stage-sanitize: $(STAGE_OUT)/stage_test_san
 
 stage-clean:
 	rm -rf $(STAGE_OUT)
+
+# ---- GPT parser / translation layer host test (dev/tests/disk_part_test.c) ----
+# Linked with the same stage sources as stage_test (a whole Store boot runs on
+# the partition view) plus the hosted GPT writer tools/gpt_write.c. The mutant
+# is the same test built with -DCK_TEST_DISK_XLATE_BYPASS (translation layer
+# adds no partition offset): it must FAIL, so the checks are shown to catch a
+# bypass.
+DISK_PART_TEST_SRCS := $(STAGE_OWN_SRCS) $(STAGE_NATIVE_SRCS) $(STAGE_NATIVE)/disk/disk_file.c \
+  $(STAGE_DIR)/svc/tests/ck_host.c $(STAGE_DIR)/tools/gpt_write.c $(STAGE_DIR)/dev/tests/disk_part_test.c
+DISK_PART_TEST_DEPS := $(DISK_PART_TEST_SRCS) $(wildcard $(STAGE_DIR)/dev/*.h $(STAGE_DIR)/svc/*.h \
+  $(STAGE_DIR)/include/*.h $(STAGE_DIR)/tools/*.h)
+DISK_PART_INC := $(STAGE_INC) -I$(STAGE_DIR)/tools -I$(STAGE_DIR)/svc/tests
+
+$(STAGE_OUT)/disk_part_test: $(DISK_PART_TEST_DEPS)
+	@mkdir -p $(@D)
+	$(STAGE_CC) $(STAGE_HOST_FLAGS) $(DISK_PART_INC) -o $@ $(DISK_PART_TEST_SRCS)
+$(STAGE_OUT)/disk_part_test_mutant: $(DISK_PART_TEST_DEPS)
+	@mkdir -p $(@D)
+	$(STAGE_CC) $(STAGE_HOST_FLAGS) -DCK_TEST_DISK_XLATE_BYPASS=1 $(DISK_PART_INC) -o $@ $(DISK_PART_TEST_SRCS)
+$(STAGE_OUT)/disk_part_test_san: $(DISK_PART_TEST_DEPS)
+	@mkdir -p $(@D)
+	$(STAGE_CC) $(STAGE_HOST_FLAGS) $(STAGE_SAN_FLAGS) $(DISK_PART_INC) -o $@ $(DISK_PART_TEST_SRCS)
+
+disk-part-test: $(STAGE_OUT)/disk_part_test $(STAGE_OUT)/disk_part_test_mutant
+	$(STAGE_OUT)/disk_part_test
+	@if $(STAGE_OUT)/disk_part_test_mutant >$(STAGE_OUT)/disk_part_test_mutant.log 2>&1; then \
+	  echo "CK_DISK_PART_MUTANT: FAIL (translation bypass mutant passed the host checks)"; exit 1; fi; \
+	n=$$(grep -c "^  FAIL " $(STAGE_OUT)/disk_part_test_mutant.log || true); \
+	if [ "$$n" -lt 1 ]; then echo "CK_DISK_PART_MUTANT: FAIL (mutant exited non-zero without a failing check: crash?)"; exit 1; fi; \
+	echo "CK_DISK_PART_MUTANT: PASS (translation bypass mutant caught by $$n failing checks)"
+
+disk-part-sanitize: $(STAGE_OUT)/disk_part_test_san
+	ASAN_OPTIONS=detect_leaks=1 UBSAN_OPTIONS=print_stacktrace=1 $<
+
+stage-test: disk-part-test
+stage-sanitize: disk-part-sanitize
diff --git a/native/kernel/svc/store_boot.h b/native/kernel/svc/store_boot.h
index b7fceb7d..39ba8b22 100644
--- a/native/kernel/svc/store_boot.h
+++ b/native/kernel/svc/store_boot.h
@@ -65,7 +65,8 @@ int ck_store_production_keys(ss_keys *k);
  * PRODUCTION always; TEST only when hardware_staging is 0. */
 int ck_store_keys_admissible(const ss_keys *k, int hardware_staging);
 
-/* One boot against disk d (whole namespace, layout of dev/disk_layout.h).
+/* One boot against disk d (the AIENOS partition view of dev/disk_part.h in the
+ * kernel, a whole file in host tests; layout of dev/disk_layout.h, relative to d).
  * commit is the image commit string recorded in the new boot record.
  * Prints nothing; ck_stage_store prints. */
 int store_boot_run(const disk_dev *d, const ss_keys *keys, const uint8_t uuid[16], const char *commit,
diff --git a/native/kernel/tools/ck_gpt_image.c b/native/kernel/tools/ck_gpt_image.c
new file mode 100644
index 00000000..098e535f
--- /dev/null
+++ b/native/kernel/tools/ck_gpt_image.c
@@ -0,0 +1,111 @@
+/* ck_gpt_image -- host tool: GPT boot-disk images for the C kernel's QEMU
+ * gates (scripts/qemu_ck_store_test.sh, qemu_ck_net_test.sh,
+ * qemu_ck_artifact_test.sh, qemu_ck_disk_layout_test.sh). Hosted C, test
+ * tooling only, never part of an image. No Python, no sgdisk.
+ *
+ *   ck_gpt_image create IMG BS MIB LAYOUT [CORRUPTION...]
+ *       BS 512|4096, MIB >= 16. LAYOUT (MiB offsets, M = MIB):
+ *         aienos-middle   sentinel-a [1,9) Linux type, filled with a pattern;
+ *                         AIENOS [9,M-7) all zero; sentinel-b [M-7,M-1) filled
+ *         no-aienos       same, middle partition has the Linux type
+ *         two-aienos      same, sentinel-b also has the AIENOS type
+ *         aienos-outside  sentinel-a, AIENOS [9, M+1): ends past the disk
+ *         aienos-overlap  sentinel-a [1,9), AIENOS [5,M-7), sentinel-b
+ *         no-gpt          sentinel fills only: no protective MBR, no GPT
+ *       CORRUPTION: bad-primary-crc bad-backup-crc bad-primary-entries
+ *         bad-backup-entries no-pmbr
+ *       Prints one line: "gpt_image bs=B blocks=N aienos_first_lba=F
+ *       aienos_last_lba=L" (the AIENOS range as WRITTEN, from this tool's own
+ *       layout, not from the kernel parser; 0 0 when the layout has none).
+ *   ck_gpt_image find IMG BS
+ *       Runs the kernel's own parser (dev/disk_part.c) read-only; prints
+ *       "aienos first_lba=F last_lba=L blocks=K" (exit 0) or
+ *       "refused: <reason> rc=N" (exit 1). */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "disk_file.h"
+#include "disk_part.h"
+#include "gpt_write.h"
+
+static int usage(void)
+{
+    fprintf(stderr, "usage: ck_gpt_image create IMG BS MIB LAYOUT [CORRUPTION...] | find IMG BS\n");
+    return 2;
+}
+
+static int cmd_create(int argc, char **argv)
+{
+    if (argc < 6) return usage();
+    uint32_t bs = (uint32_t)strtoul(argv[3], NULL, 10);
+    uint64_t mib = strtoull(argv[4], NULL, 10);
+    if ((bs != 512 && bs != 4096) || mib < 16 || mib > 1048576) return usage();
+    uint64_t per = (1024u * 1024u) / bs, blocks = mib * per;
+    const char *lay = argv[5];
+    unsigned flags = 0;
+    for (int i = 6; i < argc; i++) {
+        if (!strcmp(argv[i], "bad-primary-crc")) flags |= GW_BAD_PRIMARY_CRC;
+        else if (!strcmp(argv[i], "bad-backup-crc")) flags |= GW_BAD_BACKUP_CRC;
+        else if (!strcmp(argv[i], "bad-primary-entries")) flags |= GW_BAD_PRIMARY_ENT;
+        else if (!strcmp(argv[i], "bad-backup-entries")) flags |= GW_BAD_BACKUP_ENT;
+        else if (!strcmp(argv[i], "no-pmbr")) flags |= GW_NO_PMBR;
+        else return usage();
+    }
+    gw_part p[3];
+    int n = 3;
+    p[0] = (gw_part){gw_linux_type, 1 * per, 9 * per - 1u, "sentinel-a", 0xa5};
+    p[1] = (gw_part){ck_aienos_part_type, 9 * per, (mib - 7u) * per - 1u, "AIENOS", 0};
+    p[2] = (gw_part){gw_linux_type, (mib - 7u) * per, (mib - 1u) * per - 1u, "sentinel-b", 0x5a};
+    if (!strcmp(lay, "aienos-middle")) {
+    } else if (!strcmp(lay, "no-aienos")) {
+        p[1].type = gw_linux_type;
+    } else if (!strcmp(lay, "two-aienos")) {
+        p[2].type = ck_aienos_part_type;
+    } else if (!strcmp(lay, "aienos-outside")) {
+        p[1].last = (mib + 1u) * per - 1u;
+        n = 2;
+    } else if (!strcmp(lay, "aienos-overlap")) {
+        p[1].first = 5 * per;
+    } else if (!strcmp(lay, "no-gpt")) {
+        flags |= GW_NO_GPT;
+    } else {
+        return usage();
+    }
+    if (gw_write(argv[2], bs, blocks, p, n, flags)) return 1;
+    int has = strcmp(lay, "no-aienos") != 0;
+    printf("gpt_image bs=%u blocks=%llu aienos_first_lba=%llu aienos_last_lba=%llu\n", bs,
+           (unsigned long long)blocks, has ? (unsigned long long)p[1].first : 0ull,
+           has ? (unsigned long long)p[1].last : 0ull);
+    return 0;
+}
+
+static int cmd_find(int argc, char **argv)
+{
+    if (argc != 4) return usage();
+    uint32_t bs = (uint32_t)strtoul(argv[3], NULL, 10);
+    if (bs != 512 && bs != 4096) return usage();
+    disk_file f;
+    disk_dev d;
+    if (disk_file_open(&f, &d, argv[2], bs, 0, 0)) {
+        fprintf(stderr, "cannot open %s\n", argv[2]);
+        return 2;
+    }
+    static ck_part p;
+    ck_gpt_info gi;
+    int rc = ck_gpt_find_aienos(&d, &p, &gi);
+    if (rc)
+        printf("refused: %s rc=%d\n", ck_gpt_strerror(rc), rc);
+    else
+        printf("aienos first_lba=%llu last_lba=%llu blocks=%llu\n", (unsigned long long)p.first_lba,
+               (unsigned long long)(p.first_lba + p.blocks - 1u), (unsigned long long)p.blocks);
+    disk_file_close(&f);
+    return rc ? 1 : 0;
+}
+
+int main(int argc, char **argv)
+{
+    if (argc < 2) return usage();
+    if (!strcmp(argv[1], "create")) return cmd_create(argc, argv);
+    if (!strcmp(argv[1], "find")) return cmd_find(argc, argv);
+    return usage();
+}
diff --git a/native/kernel/tools/ck_store_image.c b/native/kernel/tools/ck_store_image.c
index cac30dcb..0bad6796 100644
--- a/native/kernel/tools/ck_store_image.c
+++ b/native/kernel/tools/ck_store_image.c
@@ -1,16 +1,17 @@
 /* ck_store_image -- host tool: put signed P2 artifacts into the sealed C Store
- * on a raw boot disk image, at image build time, so the C kernel's loader
+ * inside the AIENOS GPT partition of a boot disk image (made by
+ * tools/ck_gpt_image.c), at image build time, so the C kernel's loader
  * reads them from NVMe (svc/artifact_store.h). It reuses the kernel's own
  * Store code (store_boot.c formats and commits the boot record exactly as a
  * first boot would; artifact_store.c writes and reads the artifact objects),
  * so there is no second disk format. TEST identity and TEST keys only.
  *
- *   ck_store_image build IMG BLOCK_SIZE ENTRY...   IMG must exist and be blank
+ *   ck_store_image build IMG BLOCK_SIZE ENTRY...   IMG must hold a GPT whose AIENOS partition is blank
  *        ENTRY = path to a file (Store name = its basename, 1..32 bytes)
  *              | missing:NAME:LEN (index entry, no chunks: hostile case)
  *   ck_store_image list IMG BLOCK_SIZE             read back with the kernel reader
- *   ck_store_image locate IMG BLOCK_SIZE NAME      "offset=B length=L" of the
- *        sealed envelope holding chunk 0 of NAME (for the corrupt-disk case)
+ *   ck_store_image locate IMG BLOCK_SIZE NAME      "offset=B length=L" (B: byte offset in the
+ *        whole image file) of the sealed envelope holding chunk 0 of NAME (for the corrupt-disk case)
  * list and locate only read the image. Hosted C; test tooling, never in an
  * image. No Python, no outside libraries. */
 #include <stdio.h>
@@ -19,6 +20,7 @@
 #include "artifact_store.h"
 #include "disk_file.h"
 #include "disk_layout.h"
+#include "disk_part.h"
 #include "store_boot.h"
 
 static int usage(void)
@@ -45,7 +47,9 @@ static uint8_t *slurp(const char *path, size_t *len)
 
 typedef struct {
     disk_file f;
-    disk_dev d;
+    disk_dev raw;   /* the whole image: read for the GPT only */
+    ck_part part;   /* the AIENOS partition view (dev/disk_part.h) */
+    const disk_dev *d; /* == &part.dev: every Store access goes through ck_part_xlate */
     st_disk sd;
     st_dev sdev;
     ts_device tdev;
@@ -60,12 +64,23 @@ static int img_open(image *im, const char *path, const char *bs_s)
         return -1;
     }
     memset(im, 0, sizeof *im);
-    if (disk_file_open(&im->f, &im->d, path, bs, 0, 0)) {
+    if (disk_file_open(&im->f, &im->raw, path, bs, 0, 0)) {
         fprintf(stderr, "cannot open %s\n", path);
         return -1;
     }
+    /* Same rule as the kernel: the Store lives only inside the AIENOS GPT
+     * partition; no valid GPT or no AIENOS partition is refused. Images come
+     * from tools/ck_gpt_image.c. */
+    ck_gpt_info gi;
+    int grc = ck_gpt_find_aienos(&im->raw, &im->part, &gi);
+    if (grc) {
+        fprintf(stderr, "%s: no AIENOS partition, refusing writes (gpt: %s, rc=%d)\n", path, ck_gpt_strerror(grc), grc);
+        disk_file_close(&im->f);
+        return -1;
+    }
+    im->d = &im->part.dev;
     uint32_t bpu = CK_LAYOUT_UNIT / bs;
-    uint64_t units = im->d.block_count / bpu;
+    uint64_t units = im->d->block_count / bpu;
     if (units < CK_LAYOUT_ANCHOR_UNITS + CK_LAYOUT_MIN_STORE_UNITS + CK_LAYOUT_PROBE_UNITS) {
         fprintf(stderr, "image too small\n");
         disk_file_close(&im->f);
@@ -81,9 +96,9 @@ static int img_mount(image *im, ss_store *s, ss_workspace *ws)
 {
     ss_keys keys;
     ck_store_test_keys(&keys);
-    int rc = st_disk_bind(&im->sd, &im->d, im->base_lba, im->units, &im->sdev);
+    int rc = st_disk_bind(&im->sd, im->d, im->base_lba, im->units, &im->sdev);
     if (!rc) {
-        ss_ts_device(&im->d, &im->tdev);
+        ss_ts_device(im->d, &im->tdev);
         memset(s, 0, sizeof *s);
         rc = ss_open(s, &im->sdev, &im->tdev, 0, &keys, ws);
     }
@@ -131,7 +146,7 @@ static int cmd_build(int argc, char **argv)
     ss_keys keys;
     ck_store_report r;
     ck_store_test_keys(&keys);
-    int rc = store_boot_run(&im.d, &keys, ck_store_test_uuid, "ck_store_image", &r);
+    int rc = store_boot_run(im.d, &keys, ck_store_test_uuid, "ck_store_image", &r);
     memset(&keys, 0, sizeof keys);
     if (rc || !r.formatted) {
         fprintf(stderr, "%s: %s (the image must be blank: all zero)\n", argv[2],
@@ -140,7 +155,7 @@ static int cmd_build(int argc, char **argv)
         return 1;
     }
     rc = ck_art_write(store_boot_store(), in, n);
-    if (!rc) rc = disk_flush(&im.d);
+    if (!rc) rc = disk_flush(im.d);
     uint64_t gen = ss_generation(store_boot_store());
     disk_file_close(&im.f);
     if (rc) {
@@ -220,7 +235,7 @@ static int cmd_locate(int argc, char **argv)
             const sv1_entry *e = &st->ws->cat[st->root.cat_index][i];
             if (memcmp(e->object_id, sid, 32)) continue;
             printf("offset=%llu length=%llu\n",
-                   (unsigned long long)(im.base_lba * im.d.block_size + e->first_unit * CK_LAYOUT_UNIT),
+                   (unsigned long long)((im.part.first_lba + im.base_lba) * im.d->block_size + e->first_unit * CK_LAYOUT_UNIT),
                    (unsigned long long)e->byte_length);
             found = 1;
             break;
diff --git a/native/kernel/tools/gpt_write.c b/native/kernel/tools/gpt_write.c
new file mode 100644
index 00000000..1f494c00
--- /dev/null
+++ b/native/kernel/tools/gpt_write.c
@@ -0,0 +1,154 @@
+/* gpt_write.c -- hosted GPT image writer (see gpt_write.h). libc only. */
+#define _GNU_SOURCE
+#include "gpt_write.h"
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include "disk_part.h" /* ck_crc32 only */
+
+const uint8_t gw_linux_type[16] = {0xaf, 0x3d, 0xc6, 0x0f, 0x83, 0x84, 0x72, 0x47,
+                                   0x8e, 0x79, 0x3d, 0x69, 0xd8, 0x47, 0x7d, 0xe4};
+
+static void put32(uint8_t *p, uint32_t v)
+{
+    for (int i = 0; i < 4; i++) p[i] = (uint8_t)(v >> (8 * i));
+}
+static void put64(uint8_t *p, uint64_t v)
+{
+    for (int i = 0; i < 8; i++) p[i] = (uint8_t)(v >> (8 * i));
+}
+
+uint64_t gw_entry_blocks(uint32_t bs)
+{
+    return ((uint64_t)GW_ENTRIES * GW_ESIZE + bs - 1u) / bs;
+}
+
+static int pw(int fd, const void *b, size_t n, uint64_t off)
+{
+    const uint8_t *p = b;
+    while (n) {
+        ssize_t w = pwrite(fd, p, n, (off_t)off);
+        if (w <= 0) return -1;
+        p += w;
+        n -= (size_t)w;
+        off += (uint64_t)w;
+    }
+    return 0;
+}
+
+static void header(uint8_t *h, uint64_t my, uint64_t alt, uint64_t fu, uint64_t lu, uint64_t ent_lba,
+                   uint32_t ent_crc)
+{
+    static const uint8_t disk_guid[16] = {0x41, 0x49, 0x45, 0x4e, 0x2d, 0x47, 0x50, 0x54,
+                                          0x2d, 0x54, 0x45, 0x53, 0x54, 0x2d, 0x30, 0x31}; /* "AIEN-GPT-TEST-01" */
+    memcpy(h, "EFI PART", 8);
+    put32(h + 8, 0x00010000u);
+    put32(h + 12, 92);
+    put32(h + 16, 0);
+    put64(h + 24, my);
+    put64(h + 32, alt);
+    put64(h + 40, fu);
+    put64(h + 48, lu);
+    memcpy(h + 56, disk_guid, 16);
+    put64(h + 72, ent_lba);
+    put32(h + 80, GW_ENTRIES);
+    put32(h + 84, GW_ESIZE);
+    put32(h + 88, ent_crc);
+    put32(h + 16, ck_crc32(0, h, 92));
+}
+
+int gw_write(const char *path, uint32_t bs, uint64_t blocks, const gw_part *parts, int nparts, unsigned flags)
+{
+    if ((bs != 512 && bs != 4096) || blocks < 64 || nparts < 0 || nparts > GW_MAX_PARTS) {
+        fprintf(stderr, "gw_write: bad geometry\n");
+        return -1;
+    }
+    int fd = open(path, O_RDWR | O_CREAT | O_TRUNC, 0644);
+    if (fd < 0 || ftruncate(fd, (off_t)(blocks * bs)) != 0) {
+        fprintf(stderr, "gw_write: cannot create %s\n", path);
+        if (fd >= 0) close(fd);
+        return -1;
+    }
+    int rc = 0;
+    /* Partition fills (sentinels): fill ^ low byte of the LBA, so every block differs. */
+    enum { CHUNK = 256 };
+    uint8_t *buf = malloc((size_t)CHUNK * bs);
+    if (!buf) rc = -1;
+    for (int i = 0; !rc && i < nparts; i++) {
+        if (!parts[i].fill) continue;
+        uint64_t f = parts[i].first, l = parts[i].last < blocks ? parts[i].last : blocks - 1u;
+        for (uint64_t lba = f; !rc && lba <= l;) {
+            uint64_t n = l - lba + 1u < CHUNK ? l - lba + 1u : CHUNK;
+            for (uint64_t k = 0; k < n; k++) memset(buf + k * bs, parts[i].fill ^ (uint8_t)(lba + k), bs);
+            rc = pw(fd, buf, (size_t)(n * bs), lba * bs);
+            lba += n;
+        }
+    }
+    free(buf);
+    if (rc || (flags & GW_NO_GPT)) {
+        close(fd);
+        if (rc) fprintf(stderr, "gw_write: write failed\n");
+        return rc;
+    }
+
+    uint64_t last = blocks - 1u, eb = gw_entry_blocks(bs);
+    uint64_t fu = 2u + eb, lu = last - 1u - eb, bent = last - eb;
+    size_t ebytes = (size_t)GW_ENTRIES * GW_ESIZE;
+    uint8_t *ent = calloc(1, (size_t)eb * bs);
+    uint8_t *h = calloc(1, bs), *mbr = calloc(1, bs);
+    if (!ent || !h || !mbr) rc = -1;
+    for (int i = 0; !rc && i < nparts; i++) {
+        uint8_t *e = ent + (size_t)i * GW_ESIZE;
+        memcpy(e, parts[i].type, 16);
+        memcpy(e + 16, "AIEN-UNIQUE-PT", 14); /* unique GUID: fixed text + index */
+        e[30] = (uint8_t)'0';
+        e[31] = (uint8_t)('0' + i);
+        put64(e + 32, parts[i].first);
+        put64(e + 40, parts[i].last);
+        for (size_t c = 0; parts[i].name && parts[i].name[c] && c < 36; c++) e[56 + 2 * c] = (uint8_t)parts[i].name[c];
+    }
+    uint32_t ecrc = ck_crc32(0, ent, ebytes);
+    if (!rc && !(flags & GW_NO_PMBR)) {
+        uint8_t *r = mbr + 446;
+        r[1] = 0x00; r[2] = 0x02; r[3] = 0x00; /* CHS start 0/0/2 */
+        r[4] = 0xee;
+        r[5] = 0xff; r[6] = 0xff; r[7] = 0xff;
+        put32(r + 8, 1);
+        put32(r + 12, last > 0xffffffffu ? 0xffffffffu : (uint32_t)last);
+        mbr[510] = 0x55;
+        mbr[511] = 0xaa;
+        rc = pw(fd, mbr, bs, 0);
+    }
+    /* Primary. */
+    if (!rc) {
+        header(h, 1, last, fu, lu, 2, ecrc);
+        if (flags & GW_BAD_PRIMARY_CRC) h[16] ^= 0x01;
+        rc = pw(fd, h, bs, 1u * bs);
+    }
+    if (!rc) {
+        if (flags & GW_BAD_PRIMARY_ENT) ent[56] ^= 0x20; /* first entry's name, after the CRC */
+        rc = pw(fd, ent, (size_t)eb * bs, 2u * bs);
+        if (flags & GW_BAD_PRIMARY_ENT) ent[56] ^= 0x20;
+    }
+    /* Backup. */
+    if (!rc) {
+        if (flags & GW_BAD_BACKUP_ENT) ent[56] ^= 0x20;
+        rc = pw(fd, ent, (size_t)eb * bs, bent * bs);
+        if (flags & GW_BAD_BACKUP_ENT) ent[56] ^= 0x20;
+    }
+    if (!rc) {
+        memset(h, 0, bs);
+        header(h, last, 1, fu, lu, bent, ecrc);
+        if (flags & GW_BAD_BACKUP_CRC) h[16] ^= 0x01;
+        rc = pw(fd, h, bs, last * bs);
+    }
+    if (rc) fprintf(stderr, "gw_write: write failed\n");
+    free(ent);
+    free(h);
+    free(mbr);
+    if (fsync(fd) != 0) rc = -1;
+    close(fd);
+    return rc;
+}
diff --git a/native/kernel/tools/gpt_write.h b/native/kernel/tools/gpt_write.h
new file mode 100644
index 00000000..0ee70908
--- /dev/null
+++ b/native/kernel/tools/gpt_write.h
@@ -0,0 +1,46 @@
+/* gpt_write.h -- hosted GPT image writer for the C kernel's QEMU gates and
+ * host tests (tools/ck_gpt_image.c, dev/tests/disk_part_test.c). Test
+ * tooling only (libc), never part of an image. It writes the layout
+ * independently of the kernel parser (dev/disk_part.c); only the CRC32
+ * routine (ck_crc32) is shared, and the host test checks it against the
+ * standard check value.
+ *
+ * Layout written: protective MBR (one 0xEE record), primary header at LBA 1,
+ * 128 entries of 128 bytes from LBA 2, backup entries just below the last
+ * LBA, backup header at the last LBA (UEFI 2.10, section 5.3). */
+#ifndef AIENOS_CK_GPT_WRITE_H
+#define AIENOS_CK_GPT_WRITE_H
+#include <stdint.h>
+
+#define GW_ENTRIES 128u
+#define GW_ESIZE 128u
+#define GW_MAX_PARTS 8
+
+/* Linux filesystem data type GUID 0FC63DAF-8483-4772-8E79-3D69D8477DE4
+ * (on-disk byte order): used for the sentinel partitions. */
+extern const uint8_t gw_linux_type[16];
+
+typedef struct {
+    const uint8_t *type;  /* 16 on-disk bytes */
+    uint64_t first, last; /* inclusive LBAs as written into the entry */
+    const char *name;     /* ASCII, up to 36 characters */
+    uint8_t fill;         /* 0: leave zero; else fill the range with fill ^ (uint8_t)lba */
+} gw_part;
+
+enum {
+    GW_NO_GPT = 1u << 0,           /* write partition fills only: no MBR, no GPT */
+    GW_BAD_PRIMARY_CRC = 1u << 1,  /* primary header CRC32 field flipped */
+    GW_BAD_BACKUP_CRC = 1u << 2,   /* backup header CRC32 field flipped */
+    GW_BAD_PRIMARY_ENT = 1u << 3,  /* primary entry array changed after its CRC */
+    GW_BAD_BACKUP_ENT = 1u << 4,   /* backup entry array changed after its CRC */
+    GW_NO_PMBR = 1u << 5,          /* GPT written, protective MBR left zero */
+};
+
+/* Create (or truncate) path as a bs-byte-block image of `blocks` blocks and
+ * write the layout. Fills that fall outside the image are clipped. Returns 0
+ * or -1 (message on stderr). */
+int gw_write(const char *path, uint32_t bs, uint64_t blocks, const gw_part *parts, int nparts, unsigned flags);
+
+/* Entry array blocks for block size bs (128 x 128 bytes). */
+uint64_t gw_entry_blocks(uint32_t bs);
+#endif
diff --git a/scripts/ck_gates.sh b/scripts/ck_gates.sh
index 2685e6ec..de3c7d20 100755
--- a/scripts/ck_gates.sh
+++ b/scripts/ck_gates.sh
@@ -5,11 +5,12 @@
 # It refuses a dirty tree, runs the C kernel QEMU scripts that exist
 # (scripts/qemu_ck_boot_test.sh, scripts/qemu_ck_store_test.sh,
 # scripts/qemu_ck_net_test.sh, scripts/qemu_ck_artifact_test.sh,
-# scripts/qemu_ck_smp_test.sh, scripts/qemu_ck_store_crash_test.sh), and prints
+# scripts/qemu_ck_smp_test.sh, scripts/qemu_ck_store_crash_test.sh,
+# scripts/qemu_ck_disk_layout_test.sh), and prints
 # one line per gate:
 #     AIENOS_CK_<gate>: PASS|FAIL|NOT_RUN [(reason)]
 # for M1 M3 SMMU NVME_SHUTDOWN P2_ARTIFACT M0_ROLLBACK M4_NVME M4_STORE M4_STORE_CRASH
-# M4_CONTINUITY M4_RECOVERY ARGUS1_REVOKE KEYBOARD NET SMP. Gates with no C
+# M4_CONTINUITY M4_RECOVERY ARGUS1_REVOKE KEYBOARD NET SMP DISK_LAYOUT. Gates with no C
 # implementation print NOT_RUN (MISSING_IMPLEMENTATION: <reason>) and never
 # run anything. A missing child script, a child that reports NOT_RUN, a child
 # that prints no verdict line, or a PASS line contradicted by the child's exit
@@ -43,6 +44,7 @@ set -uo pipefail
 #         artifact -> verdict line from scripts/qemu_ck_artifact_test.sh
 #         smp   -> verdict line from scripts/qemu_ck_smp_test.sh
 #         crash -> verdict line from scripts/qemu_ck_store_crash_test.sh
+#         disk  -> verdict line from scripts/qemu_ck_disk_layout_test.sh
 #         missing -> NOT_RUN (MISSING_IMPLEMENTATION), never run, never PASS
 # ===========================================================================
 CK_GATE_TABLE='
@@ -61,8 +63,9 @@ ARGUS1_REVOKE|store|-
 KEYBOARD|missing|no xHCI/USB HID keyboard driver in the C kernel
 NET|net|-
 SMP|smp|-
+DISK_LAYOUT|disk|-
 '
-CHILDREN=(boot store net artifact smp crash)
+CHILDREN=(boot store net artifact smp crash disk)
 # ===========================================================================
 
 repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
@@ -106,6 +109,7 @@ set_default_children() {
         [artifact]="${repo_root}/scripts/qemu_ck_artifact_test.sh"
         [smp]="${repo_root}/scripts/qemu_ck_smp_test.sh"
         [crash]="${repo_root}/scripts/qemu_ck_store_crash_test.sh"
+        [disk]="${repo_root}/scripts/qemu_ck_disk_layout_test.sh"
     )
 }
 
@@ -335,11 +339,11 @@ self_test() {
     }
     expect_missing_all() {
         local g
-        for g in P2_ARTIFACT M0_ROLLBACK M4_STORE_CRASH M4_CONTINUITY M4_RECOVERY KEYBOARD; do expect "${g}" NOT_RUN; done  # P2_ARTIFACT: no artifact child in A..G; M4_STORE_CRASH: no crash child in A..J and R
+        for g in P2_ARTIFACT M0_ROLLBACK M4_STORE_CRASH M4_CONTINUITY M4_RECOVERY KEYBOARD DISK_LAYOUT; do expect "${g}" NOT_RUN; done  # P2_ARTIFACT: no artifact child in A..G; M4_STORE_CRASH: no crash child in A..J and R; DISK_LAYOUT: no disk child in A..S
     }
-    scenario() { # NAME BOOT_SCRIPT STORE_SCRIPT [NET_SCRIPT] [ARTIFACT_SCRIPT] [SMP_SCRIPT] [CRASH_SCRIPT] (absent: missing)
+    scenario() { # NAME BOOT_SCRIPT STORE_SCRIPT [NET_SCRIPT] [ARTIFACT_SCRIPT] [SMP_SCRIPT] [CRASH_SCRIPT] [DISK_SCRIPT] (absent: missing)
         scen="$1"
-        declare -gA child_script=([boot]="$2" [store]="$3" [net]="${4:-${tmp}/kids/net_not_present.sh}" [artifact]="${5:-${tmp}/kids/no_artifact_child.sh}" [smp]="${6:-${tmp}/kids/no_smp_child.sh}" [crash]="${7:-${tmp}/kids/no_crash_child.sh}")
+        declare -gA child_script=([boot]="$2" [store]="$3" [net]="${4:-${tmp}/kids/net_not_present.sh}" [artifact]="${5:-${tmp}/kids/no_artifact_child.sh}" [smp]="${6:-${tmp}/kids/no_smp_child.sh}" [crash]="${7:-${tmp}/kids/no_crash_child.sh}" [disk]="${8:-${tmp}/kids/no_disk_child.sh}")
         run_children 2>/dev/null
         evaluate_table >"${tmp}/${scen}.out"
     }
@@ -355,8 +359,8 @@ self_test() {
         "$(fake smpA 0 'PASS  3 secondary cores checked in' 'AIENOS_CK_SMP_MUTATION: FAIL' 'AIENOS_CK_SMP: PASS')"
     expect M1 PASS; expect M3 PASS; expect M4_NVME PASS; expect M4_STORE PASS; expect ARGUS1_REVOKE PASS; expect SMMU PASS; expect NVME_SHUTDOWN PASS; expect NET PASS; expect SMP PASS; expect_missing_all
     count_rows
-    [[ "${n_pass}/${n_fail}/${n_notrun}/${n_total}" == "9/0/6/15" && ${overall} == NOT_ALL_GATES_PASS ]] \
-        && ok "A: counts 9/0/6 of 15, verdict NOT_ALL_GATES_PASS" || bad "A: counts ${n_pass}/${n_fail}/${n_notrun}/${n_total} ${overall}"
+    [[ "${n_pass}/${n_fail}/${n_notrun}/${n_total}" == "9/0/7/16" && ${overall} == NOT_ALL_GATES_PASS ]] \
+        && ok "A: counts 9/0/7 of 16, verdict NOT_ALL_GATES_PASS" || bad "A: counts ${n_pass}/${n_fail}/${n_notrun}/${n_total} ${overall}"
     [[ "$(nvme_dma_mode)" == "Confined (QEMU SMMUv3 stage 1, out-of-window DMA faulted); no-SMMU boot denied (NoSmmu); TEST-ONLY bypass image checked separately" ]] && ok "A: confined DMA mode recorded from the store PASS lines" || bad "A: dma mode '$(nvme_dma_mode)'"
     grep -qxF "AIENOS_CK_M4_NVME: PASS (${M4_NVME_PASS_NOTE})" "${tmp}/A.out" \
         && ok "A: M4_NVME PASS line carries the confined-mode note" || bad "A: M4_NVME PASS line lacks the note"
@@ -364,7 +368,7 @@ self_test() {
         && ok "A: NET PASS line carries the QEMU slirp / SMMU fence note" || bad "A: NET PASS line lacks the note"
     grep -qx 'AIENOS_CK_KEYBOARD: NOT_RUN (MISSING_IMPLEMENTATION: no xHCI/USB HID keyboard driver in the C kernel)' "${tmp}/A.out" \
         && ok "A: missing gate prints NOT_RUN (MISSING_IMPLEMENTATION: reason)" || bad "A: KEYBOARD line wrong"
-    [[ "$(grep -c '^AIENOS_CK_[A-Z0-9_]*: ' "${tmp}/A.out")" == 15 ]] && ok "A: exactly 15 verdict lines" || bad "A: verdict line count"
+    [[ "$(grep -c '^AIENOS_CK_[A-Z0-9_]*: ' "${tmp}/A.out")" == 16 ]] && ok "A: exactly 16 verdict lines" || bad "A: verdict line count"
 
     # B: boot FAIL; store script missing -> its three gates NOT_RUN, never PASS.
     scenario B "$(fake bootB 1 'FAIL  kernel: alive' 'AIENOS_CK_M3: FAIL' 'AIENOS_CK_M1: FAIL')" "${tmp}/kids/does_not_exist.sh"
@@ -443,6 +447,19 @@ self_test() {
         "$(fake smpN 0 'AIENOS_CK_SMP_MUTATION: PASS (gate checks FAIL on the CPU_ON-skip image; mutation killed)')"
     expect SMP FAIL
 
+    # T: disk child (scripts/qemu_ck_disk_layout_test.sh) PASS -> DISK_LAYOUT PASS;
+    # a store gate it claims is ignored. U: disk child FAIL (mutant survived)
+    # -> FAIL; V: PASS line, exit 1 -> FAIL.
+    scenario T "$(fake bootT 0 'AIENOS_CK_M1: PASS')" "$(fake storeT 3 'AIENOS_CK_M4_STORE: NOT_RUN')" "" "" "" "" \
+        "$(fake diskT 0 'PASS  translation bypass makes DISK_LAYOUT fail (mutant killed)' 'AIENOS_CK_M4_STORE: PASS' 'AIENOS_CK_DISK_LAYOUT: PASS')"
+    expect DISK_LAYOUT PASS; expect M4_STORE NOT_RUN
+    scenario U "$(fake bootU 0 'AIENOS_CK_M1: PASS')" "$(fake storeU 0 'AIENOS_CK_M4_NVME: PASS')" "" "" "" "" \
+        "$(fake diskU 1 'FAIL  translation bypass mutant survived' 'AIENOS_CK_DISK_LAYOUT: FAIL')"
+    expect DISK_LAYOUT FAIL
+    scenario V "$(fake bootV 0 'AIENOS_CK_M1: PASS')" "$(fake storeV 0 'AIENOS_CK_M4_NVME: PASS')" "" "" "" "" \
+        "$(fake diskV 1 'AIENOS_CK_DISK_LAYOUT: PASS')"
+    expect DISK_LAYOUT FAIL
+
     # Receipt: named by its content hash, valid JSON, physical NOT_RUN, never overwritten.
     scenario R "$(fake bootR 0 'AIENOS_CK_M1: PASS')" "$(fake storeR 0 'AIENOS_CK_M4_NVME: PASS')"
     count_rows
@@ -456,10 +473,10 @@ self_test() {
         bad "receipt name does not match its content hash"
     fi
     if command -v jq >/dev/null; then
-        jq -e '.physical == "NOT_RUN" and (.gates | length) == 15 and .verdict == "NOT_ALL_GATES_PASS"
+        jq -e '.physical == "NOT_RUN" and (.gates | length) == 16 and .verdict == "NOT_ALL_GATES_PASS"
                and ([.gates[] | select(.id == "M1")][0].verdict == "PASS")
                and ([.gates[] | select(.id == "ARGUS1_REVOKE")][0].verdict == "FAIL")
-               and (.children | length) == 6 and .commit_subject == "quote \" backslash \\ tab\tend"' "${receipt_path}" >/dev/null \
+               and (.children | length) == 7 and .commit_subject == "quote \" backslash \\ tab\tend"' "${receipt_path}" >/dev/null \
             && ok "receipt is valid JSON (jq) with expected fields" || bad "receipt JSON invalid or fields wrong"
     else
         echo "SKIP  jq not installed; JSON validity not machine-checked"
@@ -472,18 +489,18 @@ self_test() {
         bad "an existing receipt was overwritten or the clash was not refused"
     fi
 
-    # The gate table parses: 15 rows, known sources, reasons only on missing rows.
+    # The gate table parses: 16 rows, known sources, reasons only on missing rows.
     local g s w rows=0 tbad=0
     while IFS='|' read -r g s w; do
         [[ -n "${g}" ]] || continue
         rows=$((rows + 1))
         case "${s}" in
-            boot|store|net|artifact|smp|crash) [[ "${w}" == - ]] || tbad=1 ;;
+            boot|store|net|artifact|smp|crash|disk) [[ "${w}" == - ]] || tbad=1 ;;
             missing) [[ -n "${w}" && "${w}" != - ]] || tbad=1 ;;
             *) tbad=1 ;;
         esac
     done <<<"${CK_GATE_TABLE}"
-    [[ ${tbad} == 0 && ${rows} == 15 ]] && ok "gate table: 15 rows well-formed" || bad "gate table malformed (${rows} rows)"
+    [[ ${tbad} == 0 && ${rows} == 16 ]] && ok "gate table: 16 rows well-formed" || bad "gate table malformed (${rows} rows)"
 
     # Dirty-tree refusal, end to end, on a private clone (never this tree).
     # Both runs stop before any child script (no QEMU).
@@ -517,7 +534,7 @@ main() {
         case "$1" in
             --out) [[ $# -ge 2 ]] || die "--out needs a directory"; out_arg="$2"; shift ;;
             --self-test) mode=self ;;
-            -h|--help) sed -n '2,35p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;
+            -h|--help) sed -n '2,36p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;
             *) die "unknown argument: $1" ;;
         esac
         shift
diff --git a/scripts/qemu_ck_artifact_test.sh b/scripts/qemu_ck_artifact_test.sh
index d1ce442b..833192d1 100755
--- a/scripts/qemu_ck_artifact_test.sh
+++ b/scripts/qemu_ck_artifact_test.sh
@@ -90,7 +90,7 @@ mk OUT="${out_prod}" full
 mk OUT="${out_qual}" CK_SEED0B_TEST_ANCHOR=1
 mk OUT="${out_qual}" CK_SEED0B_TEST_ANCHOR=1 full
 mk OUT="${out_fwcfg}" CK_TEST_FWCFG_ARTIFACTS=1
-make -s -C native/kernel OUT="${out_prod}" tool store-image >/dev/null
+make -s -C native/kernel OUT="${out_prod}" tool store-image gpt-image >/dev/null
 tool="${out_prod}/host/ck_artifact_tool"
 simg="${out_prod}/host/ck_store_image"
 
@@ -133,7 +133,8 @@ id_prefix() { awk -v n="$1" '$1 == n { print substr($2, 1, 16) }' "${work}/ids.t
 
 # ---- boot disk: signed artifacts into the sealed Store (image build time) ----
 disk="${work}/nvme.img"
-truncate -s 64M "${disk}"
+# GPT boot disk: the Store lives only inside its AIENOS partition (dev/disk_part.h).
+"${out_prod}/host/ck_gpt_image" create "${disk}" 512 64 aienos-middle >/dev/null || fail "GPT boot disk image created"
 if "${simg}" build "${disk}" 512 "${files[@]}" "missing:${missing}:${missing_len}" >"${work}/build.txt" 2>&1; then
     pass "boot disk built: $(head -1 "${work}/build.txt")"
 else
diff --git a/scripts/qemu_ck_disk_layout_test.sh b/scripts/qemu_ck_disk_layout_test.sh
new file mode 100755
index 00000000..87b4b780
--- /dev/null
+++ b/scripts/qemu_ck_disk_layout_test.sh
@@ -0,0 +1,270 @@
+#!/usr/bin/env bash
+# DISK_LAYOUT gate for the AIENOS C kernel (CK-4, audit row R2 of
+# track4-aienos-trust.md): the kernel writes to a disk only inside the one
+# partition whose GPT type GUID is the AIENOS type
+# 38DAAC89-5EAD-4B40-8B1E-3687A7418061 (native/kernel/dev/disk_part.h), and
+# every write goes through the bounds-checked translation layer ck_part_xlate.
+# QEMU AArch64 + UEFI (AAVMF) + NVMe, same base invocation as
+# scripts/qemu_ck_store_test.sh. QEMU is not hardware: a PASS here qualifies
+# nothing physical.
+#
+# Images (native/kernel/Makefile):
+#  - make full: the default (safe) image, booted with an SMMUv3.
+#  - make full CK_TEST_DISK_XLATE_BYPASS=1: TEST-ONLY mutation image whose
+#    translation layer drops the partition offset and checks only the whole
+#    disk's bounds (refused under CK_HARDWARE_STAGING by the Makefile and by
+#    an #error in dev/disk_part.h). It must make this gate's positive checks
+#    FAIL; it never counts toward a PASS.
+# Disk images: native/kernel/tools/ck_gpt_image.c, 64 MiB: protective MBR,
+# primary + backup GPT, sentinel-a [1,9) MiB filled, AIENOS [9,57) MiB all
+# zero, sentinel-b [57,63) MiB filled.
+#
+# Positive (default image): one 512 B disk booted twice, one 4096 B disk booted
+#   once. Each boot: M1 checks (scripts/lib_ck_m1_checks.sh); "disk: gpt ok"
+#   with the AIENOS range the image tool wrote; partition LBA 0 -> disk LBA =
+#   partition start; write past the partition end refused; the NVMe rw probe's
+#   disk LBA inside the partition; stage store ok and a Store commit; every
+#   byte outside the partition unchanged (sha256 with the partition cut out)
+#   and the partition itself changed (not all zero any more); no bypass text.
+# Hostile (default image, 512 B, each a fresh disk): no-gpt (no protective
+#   MBR, no GPT), bad CRC32 on BOTH headers, bad entry-array CRC32 on BOTH
+#   arrays, AIENOS partition ending past the disk, no AIENOS partition. Each:
+#   the host tool's own parser run ("ck_gpt_image find") refuses with the same
+#   reason; the kernel prints "disk: no AIENOS partition, refusing writes
+#   (gpt: <reason>, ...)", no "disk: gpt ok", no rw probe, the Store is
+#   refused with no boot disk, and the whole image sha256 is unchanged.
+#   Firmware caveat: EDK2/AAVMF PartitionDxe may repair a GPT when only ONE
+#   copy is bad (it rewrites it from the good copy), so the QEMU hostile images
+#   corrupt both copies. Single-copy corruption (bad primary CRC alone, bad
+#   primary entries alone, bad backup header or entries alone) is covered
+#   without firmware by the host test dev/tests/disk_part_test.c
+#   (make -C native/kernel stage-test).
+# Mutation: the bypass image on a fresh good 512 B disk must announce itself
+#   and must FAIL the positive checks (its translation self-check reports
+#   "NOT REFUSED", so the Store is never reached); the default image file must
+#   not contain the bypass warning text.
+#
+# Takes the machine quiet flag itself like qemu_ck_store_test.sh
+# (AIENOS_QUIET_FLAG / AIENOS_QUIET_TAG). Any QEMU exit status other than 0
+# fails (via the M1 checks). Final line: AIENOS_CK_DISK_LAYOUT:
+# PASS|FAIL|NOT_RUN. Needs qemu-system-aarch64 and AAVMF.
+set -euo pipefail
+
+repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+cd "${repo_root}"
+
+verdicts() { echo "AIENOS_CK_DISK_LAYOUT: $1"; }
+code_fd="${AAVMF_CODE:-/usr/share/AAVMF/AAVMF_CODE.no-secboot.fd}"
+vars_fd="${AAVMF_VARS:-/usr/share/AAVMF/AAVMF_VARS.fd}"
+command -v qemu-system-aarch64 >/dev/null || { echo "qemu-system-aarch64 not installed"; verdicts NOT_RUN; exit 2; }
+[[ -r "${code_fd}" && -r "${vars_fd}" ]] || { echo "AAVMF firmware not found"; verdicts NOT_RUN; exit 2; }
+
+cross=""
+if [ "$(uname -m)" != "aarch64" ]; then cross="aarch64-linux-gnu-"; fi
+commit="$(git rev-parse HEAD 2>/dev/null || echo unknown)"
+out="${repo_root}/target/native-kernel"
+make -s -C native/kernel CROSS="${cross}" OUT="${out}" AIENOS_COMMIT="${commit}" full CK_TEST_DISK_XLATE_BYPASS=1 >/dev/null
+make -s -C native/kernel CROSS="${cross}" OUT="${out}" AIENOS_COMMIT="${commit}" full >/dev/null
+make -s -C native/kernel OUT="${out}" gpt-image >/dev/null
+gpt_tool="${out}/host/ck_gpt_image"
+safe_efi="${out}/full/BOOTAA64.EFI"
+bypass_efi="${out}/full-test-xlate-bypass/BOOTAA64.EFI"
+
+# Machine quiet flag: one heavy run at a time on the Spark.
+quiet_flag="${AIENOS_QUIET_FLAG:-${HOME}/workspace/.spark-quiet}"
+quiet_tag="${AIENOS_QUIET_TAG:-qemu_ck_disk_layout_test $$}"
+if ! ( set -C; echo "${quiet_tag}" > "${quiet_flag}" ) 2>/dev/null; then
+    echo "NOT_RUN  quiet flag ${quiet_flag} is held: $(head -c 200 "${quiet_flag}" 2>/dev/null || true)"
+    verdicts NOT_RUN
+    exit 3
+fi
+own_flag=1
+release_flag() {
+    if [[ "${own_flag}" == 1 ]]; then
+        own_flag=0
+        if [[ -f "${quiet_flag}" ]] && grep -qxF -- "${quiet_tag}" "${quiet_flag}"; then rm -f "${quiet_flag}"; fi
+    fi
+}
+top="$(mktemp -d)"
+cleanup() {
+    rm -rf "${top}"
+    release_flag
+}
+trap cleanup EXIT
+
+# shellcheck source=scripts/lib_ck_m1_checks.sh
+source "${repo_root}/scripts/lib_ck_m1_checks.sh"
+mib=64
+gate_fail=0
+fail_into_gate() { if [[ "${failed}" != 0 ]]; then gate_fail=1; fi; failed=0; }
+sha() { sha256sum "$1" | cut -d' ' -f1; }
+
+# new_disk IMG BS LAYOUT [CORRUPTION...]: create it; sets part_first/part_last
+# (the AIENOS range as WRITTEN by the tool; 0 0 when the layout has none).
+new_disk() {
+    local img="$1" bs="$2" lay="$3" l re='^gpt_image bs=[0-9]+ blocks=[0-9]+ aienos_first_lba=([0-9]+) aienos_last_lba=([0-9]+)$'
+    shift 3
+    l=$("${gpt_tool}" create "${img}" "${bs}" "${mib}" "${lay}" "$@") || l=""
+    if [[ "${l}" =~ ${re} ]]; then part_first="${BASH_REMATCH[1]}"; part_last="${BASH_REMATCH[2]}"
+    else echo "FAIL  GPT disk image ${lay} not created (${l})"; part_first=0; part_last=0; gate_fail=1; fi
+}
+# outside_sha IMG BS: sha256 of the image with the AIENOS partition cut out.
+outside_sha() {
+    { head -c $(( part_first * $2 )) "$1"; tail -c +$(( (part_last + 1) * $2 + 1 )) "$1"; } | sha256sum | cut -d' ' -f1
+}
+# inside_sha IMG BS: sha256 of the AIENOS partition bytes only.
+inside_sha() {
+    # head reads the file itself and tail drains all of head's output, so no
+    # producer is cut off early (a "tail | head" pipe dies of SIGPIPE under pipefail).
+    head -c $(( (part_last + 1) * $2 )) "$1" | tail -c $(( (part_last - part_first + 1) * $2 )) | sha256sum | cut -d' ' -f1
+}
+# zero_sha BS: sha256 of an all-zero AIENOS partition of the current size.
+zero_sha() {
+    head -c $(( (part_last - part_first + 1) * $1 )) /dev/zero | sha256sum | cut -d' ' -f1
+}
+
+# boot <name> <efi> <disk image> <block bytes>: one QEMU boot with an SMMUv3;
+# leaves the serial text in ${work}/serial.txt and the exit status in
+# qemu_status, then runs the M1 checks (into failed).
+boot() {
+    work="${top}/$1"
+    mkdir -p "${work}/esp/EFI/BOOT" "${work}/esp/EFI/AIENOS"
+    touch "${work}/esp/EFI/AIENOS/BOOTREPORT.TXT"
+    cp "$2" "${work}/esp/EFI/BOOT/BOOTAA64.EFI"
+    cp "${vars_fd}" "${work}/vars.fd"
+    local nvme_dev="nvme,drive=nvme0,serial=aienos-disk-layout"
+    [[ "$4" == 512 ]] || nvme_dev="${nvme_dev},logical_block_size=$4,physical_block_size=$4"
+    set +e
+    # Issue #61: single-threaded TCG (see qemu_boot_test.sh).
+    timeout "${AIENOS_QEMU_TIMEOUT:-180}" qemu-system-aarch64 \
+        -M virt,virtualization=on,gic-version=3,iommu=smmuv3 -accel tcg,thread=single -cpu max -smp 4 -m 2048 \
+        -drive if=pflash,format=raw,readonly=on,file="${code_fd}" \
+        -drive if=pflash,format=raw,file="${work}/vars.fd" \
+        -drive if=none,id=esp,format=raw,file=fat:rw:"${work}/esp" \
+        -device virtio-blk-pci,drive=esp \
+        -drive if=none,id=nvme0,format=raw,file="$3" \
+        -device "${nvme_dev}" \
+        -device ramfb -display none -nic none \
+        -serial file:"${work}/serial.log" -no-reboot
+    qemu_status=$?
+    set -e
+    tr -d '\r' <"${work}/serial.log" >"${work}/serial.txt"
+    [[ -z "${AIENOS_LOG_DIR:-}" ]] || cp "${work}/serial.txt" "${AIENOS_LOG_DIR}/qemu_ck_disk_layout_$1.log"
+    echo "== boot $1: qemu exit ${qemu_status}"
+    failed=0
+    ck_m1_checks
+}
+
+# positive_checks BS IMG OUTSIDE_REF ZERO_INSIDE_REF FIRST_BOOT(1|0): the
+# partition-aware footprint on a good disk. Sets failed=1 on any failure.
+positive_checks() {
+    local bs="$1" img="$2" oref="$3" zref="$4" first="$5"
+    check "GPT parsed (primary+backup CRC32), AIENOS partition found where the image tool wrote it" \
+        "^disk: gpt ok primary+backup crc32 entries=128 used=3 aienos_index=1 first_lba=${part_first} last_lba=${part_last} "
+    check "partition LBA 0 translates to the partition start" "^disk: xlate part_lba=0 -> disk_lba=${part_first} (rc=0)$"
+    check "write past the partition end refused by the translation layer" \
+        "^disk: write past partition end part_lba=[0-9]* -> refused "
+    check_absent "no AIENOS-partition refusal on the good disk" "disk: no AIENOS partition"
+    local pre='^nvme: rw probe part_lba=([0-9]+) disk_lba=([0-9]+) bytes=4096 write\+flush\+readback match \(rc=0\)$'
+    local pl; pl=$(grep -E "${pre}" "${work}/serial.txt" | tail -1 || true)
+    if [[ "${pl}" =~ ${pre} ]] && (( BASH_REMATCH[2] == BASH_REMATCH[1] + part_first )) \
+        && (( BASH_REMATCH[2] >= part_first && BASH_REMATCH[2] + 4096 / bs - 1 <= part_last )); then
+        echo "PASS  rw probe landed inside the AIENOS partition (disk_lba ${BASH_REMATCH[2]})"
+    else
+        echo "FAIL  rw probe not inside [${part_first},${part_last}] or not matched (${pl:-no line})"; failed=1
+    fi
+    check "NVMe bound by the devices stage" "devices: pci=ok nvme=bound"
+    check "stage devices ok" "stage devices: ok"
+    check "stage store ok" "stage store: ok"
+    check_absent "Store not refused" "store: REFUSED"
+    check "Store committed a generation on the partition" "^store: committed generation=[0-9]* boot_count=[0-9]*$"
+    if [[ "${first}" == 1 ]]; then
+        check "blank partition formatted as a TEST store" "store: blank disk (all-zero anchor + Store head): formatted TEST store"
+    else
+        check_absent "existing Store on the partition not reformatted" "formatted TEST store"
+    fi
+    local now; now=$(outside_sha "${img}" "${bs}")
+    [[ "${now}" == "${oref}" ]] && echo "PASS  MBR, primary+backup GPT and both sentinel partitions byte-identical" \
+        || { echo "FAIL  bytes outside the AIENOS partition changed (${oref:0:16} -> ${now:0:16})"; failed=1; }
+    now=$(inside_sha "${img}" "${bs}")
+    [[ "${now}" != "${zref}" ]] && echo "PASS  the AIENOS partition itself was written" \
+        || { echo "FAIL  the AIENOS partition is still all zero"; failed=1; }
+}
+
+# --- Positive -------------------------------------------------------------
+for bs in 512 4096; do
+    image="${top}/good-${bs}.img"
+    new_disk "${image}" "${bs}" aienos-middle
+    oref=$(outside_sha "${image}" "${bs}")
+    zref=$(zero_sha "${bs}")
+    [[ "$(inside_sha "${image}" "${bs}")" == "${zref}" ]] || { echo "FAIL  fresh AIENOS partition not all zero"; gate_fail=1; }
+    nboots=1; [[ "${bs}" == 512 ]] && nboots=2
+    for (( k = 1; k <= nboots; k++ )); do
+        boot "good-${bs}-boot${k}" "${safe_efi}" "${image}" "${bs}"
+        positive_checks "${bs}" "${image}" "${oref}" "${zref}" "$(( k == 1 ))"
+        check_absent "no translation-bypass text in this image" "DISK TRANSLATION BYPASS"
+        fail_into_gate
+    done
+done
+
+# --- Hostile --------------------------------------------------------------
+# name | layout and corruptions | reason printed by ck_gpt_strerror (dev/disk_part.c)
+hostile=(
+    "no-gpt|no-gpt|no protective MBR"
+    "bad-header-crc|aienos-middle bad-primary-crc bad-backup-crc|primary header CRC32 mismatch"
+    "bad-entry-crc|aienos-middle bad-primary-entries bad-backup-entries|entry array CRC32 mismatch"
+    "aienos-outside|aienos-outside|partition outside the usable range"
+    "no-aienos|no-aienos|no AIENOS partition type"
+)
+for row in "${hostile[@]}"; do
+    IFS='|' read -r name spec reason <<<"${row}"
+    image="${top}/hostile-${name}.img"
+    # shellcheck disable=SC2086 # spec is a layout plus corruption words
+    new_disk "${image}" 512 ${spec}
+    host=$("${gpt_tool}" find "${image}" 512 || true)
+    [[ "${host}" == "refused: ${reason} rc="* ]] && echo "PASS  host parser refuses ${name}: ${reason}" \
+        || { echo "FAIL  host parser on ${name}: expected '${reason}', got '${host}'"; gate_fail=1; }
+    before=$(sha "${image}")
+    boot "hostile-${name}" "${safe_efi}" "${image}" 512
+    check "NVMe LBA 0 read before the GPT decision" "nvme: read lba=0 blocks=1 ok"
+    check "${name}: refused, fail closed" "^disk: no AIENOS partition, refusing writes (gpt: ${reason}, rc=-4[0-9][0-9])$"
+    check_absent "${name}: no partition accepted" "^disk: gpt ok"
+    check_absent "${name}: no rw probe (nothing written)" "nvme: rw probe"
+    check "${name}: NVMe not bound" "devices: pci=ok nvme=unbound"
+    check "${name}: stage devices fails" "^stage devices: FAIL rc=-4[0-9][0-9]$"
+    check "${name}: Store refused without a boot disk" 'store: REFUSED proof=io step="no boot disk"'
+    check_absent "${name}: nothing committed" "store: committed"
+    after=$(sha "${image}")
+    [[ "${after}" == "${before}" ]] && echo "PASS  ${name}: whole image byte-identical after the boot" \
+        || { echo "FAIL  ${name}: image changed (${before:0:16} -> ${after:0:16})"; failed=1; }
+    fail_into_gate
+done
+
+# --- Mutation -------------------------------------------------------------
+if grep -qaF "DISK TRANSLATION BYPASS" "${safe_efi}"; then
+    echo "FAIL  default image contains the translation-bypass text"; gate_fail=1
+else
+    echo "PASS  default image has no translation-bypass text"
+fi
+image="${top}/mutant-512.img"
+new_disk "${image}" 512 aienos-middle
+oref=$(outside_sha "${image}" 512)
+zref=$(zero_sha 512)
+boot "mutant-xlate-bypass" "${bypass_efi}" "${image}" 512
+check "mutant image announces the TEST-ONLY translation bypass" \
+    "WARNING: TEST-ONLY DISK TRANSLATION BYPASS BUILD (CK_TEST_DISK_XLATE_BYPASS=1"
+mutant_boot="${failed}"
+fail_into_gate
+echo "-- positive checks against the mutant (must FAIL):"
+positive_checks 512 "${image}" "${oref}" "${zref}" 1
+if [[ "${mutant_boot}" == 0 && "${failed}" != 0 ]]; then
+    echo "PASS  translation bypass makes DISK_LAYOUT fail (mutant killed)"
+else
+    echo "FAIL  translation bypass mutant survived the positive checks (or did not boot cleanly)"; gate_fail=1
+fi
+failed=0
+
+echo
+if [[ "${gate_fail}" == 0 ]]; then verdicts PASS; exit 0; fi
+verdicts FAIL
+exit 1
diff --git a/scripts/qemu_ck_net_test.sh b/scripts/qemu_ck_net_test.sh
index 34e6dc65..aa2e6818 100755
--- a/scripts/qemu_ck_net_test.sh
+++ b/scripts/qemu_ck_net_test.sh
@@ -79,7 +79,7 @@ if [ "$(uname -m)" != "aarch64" ]; then cross="aarch64-linux-gnu-"; fi
 commit="$(git rev-parse HEAD 2>/dev/null || echo unknown)"
 out="${repo_root}/target/native-kernel"
 make -s -C native/kernel CROSS="${cross}" OUT="${out}" AIENOS_COMMIT="${commit}" full >/dev/null
-make -s -C native/kernel OUT="${out}" udp-echo >/dev/null
+make -s -C native/kernel OUT="${out}" udp-echo gpt-image >/dev/null
 efi="${out}/full/BOOTAA64.EFI"
 echo_bin="${out}/host/ck_udp_echo"
 port="$(sed -nE 's/^#define CK_NET_ECHO_PORT ([0-9]+)u.*/\1/p' native/kernel/dev/net_udp.h)"
@@ -131,7 +131,9 @@ echo "PASS  UDP echo helper listening on 127.0.0.1:${port} (token ${token})"
 source "${repo_root}/scripts/lib_ck_m1_checks.sh"
 img_bytes=67108864
 image="${top}/nvme.img"
-truncate -s "${img_bytes}" "${image}"
+# GPT boot disk with an AIENOS partition (native/kernel/tools/ck_gpt_image.c):
+# the kernel binds NVMe only when it finds one (dev/disk_part.h).
+"${out}/host/ck_gpt_image" create "${image}" 512 $(( img_bytes / 1048576 )) aienos-middle >/dev/null
 net_fail=0; m1_fail=0
 
 # boot <name> [smmu|nosmmu] [nic options]: one QEMU boot; serial text in
diff --git a/scripts/qemu_ck_store_crash_test.sh b/scripts/qemu_ck_store_crash_test.sh
index 721ae4b4..40fe2398 100755
--- a/scripts/qemu_ck_store_crash_test.sh
+++ b/scripts/qemu_ck_store_crash_test.sh
@@ -13,7 +13,8 @@
 #                                  CK_HARDWARE_STAGING and CK_QEMU_UNSAFE_DMA.
 #
 # Power-cut model. The host writes a crash plan into the last 4096-byte unit
-# of the disk (the rw-probe scratch unit, restored by the devices stage):
+# of the AIENOS partition (the rw-probe scratch unit, restored by the devices
+# stage; the kernel sees only that partition, dev/disk_part.h):
 # "AIENCRSH v1 cp=<checkpoint> policy=<drop|all|newest|torn>". The TEST image
 # then runs the Store on a volatile write cache: nothing reaches the disk until
 # the Store flushes. At the planned checkpoint it lands, per policy, none / all
@@ -33,7 +34,10 @@
 #   after_final_flush, before_anchor            root durable, anchor behind
 #   after_anchor                                commit and anchor durable
 #
-# Campaign, per geometry (512 B and 4096 B namespaces, fresh 64 MiB image) and
+# Campaign, per geometry (512 B and 4096 B namespaces, fresh 64 MiB GPT image
+# from native/kernel/tools/ck_gpt_image.c, AIENOS partition [9,57) MiB, as in
+# scripts/qemu_ck_store_test.sh; all Store offsets below are partition offsets
+# plus the partition start) and
 # per settle (0: the crash boot formats a blank disk; 3: three default boots
 # first, as the Rust settle 3): every checkpoint with policy=all, plus
 # after_commit_record/newest and after_inactive_superblock drop/newest/torn.
@@ -105,6 +109,15 @@ unit=4096
 units=$(( img_bytes / unit ))
 plan_unit=$(( units - 1 ))
 store_off=16384            # 4 anchor units (dev/disk_layout.h; qemu_ck_store_test.sh checks it)
+# set_part BS FIRST_LBA LAST_LBA: the AIENOS partition of a GPT image. Sets
+# sb_base (image byte offset of the Store region: partition start + store_off)
+# and plan_unit (the last 4096-byte unit of the partition). Default: the whole
+# image is the partition (self-test synthetic images).
+sb_base=${store_off}
+set_part() {
+    sb_base=$(( $2 * $1 + store_off ))
+    plan_unit=$(( ($3 + 1) * $1 / unit - 1 ))
+}
 sb_gen_off=56              # superblock generation (native/store/store_engine.c st_open gen_of)
 sb_crc_off=168             # SV1_SB_CRC_OFFSET (native/store/store_v1.h)
 cps=(before_first_write after_payload_objects after_catalog after_commit_record after_first_flush
@@ -233,11 +246,11 @@ u64_at() { od --endian=little -An -tu8 -j "$2" -N 8 "$1" | tr -d ' '; }
 tear_closure() {
     local b="$1" a="$2" n="$3" diffs slots s off
     tc_why=""; tc_slot=""
-    diffs="$(cmp -l "${b}" "${a}" 2>/dev/null | awk -v lo="${store_off}" -v hi="$(( store_off + 2 * unit ))" '$1-1 >= lo && $1-1 < hi {print $1-1}')"
+    diffs="$(cmp -l "${b}" "${a}" 2>/dev/null | awk -v lo="${sb_base}" -v hi="$(( sb_base + 2 * unit ))" '$1-1 >= lo && $1-1 < hi {print $1-1}')"
     [[ -n "${diffs}" ]] || { tc_why="no superblock slot changed"; return 1; }
-    slots="$(awk -v lo="${store_off}" -v u="${unit}" '{print int(($1 - lo) / u)}' <<<"${diffs}" | sort -u)"
+    slots="$(awk -v lo="${sb_base}" -v u="${unit}" '{print int(($1 - lo) / u)}' <<<"${diffs}" | sort -u)"
     [[ "$(grep -c . <<<"${slots}")" == 1 ]] || { tc_why="both superblock slots changed"; return 1; }
-    s="${slots}"; off=$(( store_off + s * unit ))
+    s="${slots}"; off=$(( sb_base + s * unit ))
     awk -v o="${off}" '$1 - o >= 512 {bad=1} END {exit bad}' <<<"${diffs}" \
         || { tc_why="slot ${s} changed beyond its first 512-byte sector"; return 1; }
     [[ "$(u64_at "${a}" $(( off + sb_gen_off )))" == $(( n + 1 )) ]] \
@@ -292,6 +305,11 @@ self_test() {
     cmp -s <(dd if="${t}/img" bs="${unit}" skip="${plan_unit}" count=1 status=none) <(plan_bytes after_anchor all) \
         && [[ "$(stat -c %s "${t}/img")" == "${img_bytes}" ]] && ok "plan written into the last unit only" || bad "plan placement"
     clear_plan "${t}/img"; cmp -s "${t}/img" <(head -c "${img_bytes}" /dev/zero) && ok "plan cleared" || bad "plan clear"
+    # GPT disks: the plan goes into the last unit of the AIENOS partition
+    # [9,57) MiB and the Store region starts store_off into it.
+    ( set_part 512 18432 116735; [[ "${plan_unit}" == 14591 && "${sb_base}" == $(( 9 * 1048576 + store_off )) ]] ) \
+        && ( set_part 4096 2304 14591; [[ "${plan_unit}" == 14591 && "${sb_base}" == $(( 9 * 1048576 + store_off )) ]] ) \
+        && ok "partition plan unit and Store base (512 B and 4096 B GPT layouts)" || bad "set_part offsets"
 
     # crash judge
     n=4; s="${t}/crash.txt"
@@ -404,6 +422,11 @@ else
     crash_efi="${out}/full-test-store-crash/BOOTAA64.EFI"
     plain_efi="${out}/full/BOOTAA64.EFI"
 fi
+# GPT boot disk tool (native/kernel/tools/ck_gpt_image.c): the kernel binds
+# NVMe only when it finds exactly one AIENOS partition (dev/disk_part.h).
+if ! make -s -C native/kernel OUT="${out}" gpt-image >/dev/null; then
+    echo "GPT image tool build failed"; verdict NOT_RUN; exit 2
+fi
 
 quiet_flag="${AIENOS_QUIET_FLAG:-${HOME}/workspace/.spark-quiet}"
 quiet_tag="${AIENOS_QUIET_TAG:-qemu_ck_store_crash_test $$}"
@@ -518,10 +541,19 @@ run_case() {
     [[ "${ok}" == 1 ]] || { fail=1; geo_ok[${bs}]=0; }
 }
 
+# new_disk BS: the fresh GPT template image for geometry BS (sentinel-a, AIENOS
+# all zero, sentinel-b), and set_part from the range the tool WROTE.
+new_disk() {
+    local l re='^gpt_image bs=[0-9]+ blocks=[0-9]+ aienos_first_lba=([0-9]+) aienos_last_lba=([0-9]+)$'
+    gpt_tmpl="${top}/gpt-$1.img"
+    l=$("${out}/host/ck_gpt_image" create "${gpt_tmpl}" "$1" $(( img_bytes / 1048576 )) aienos-middle) || l=""
+    if [[ "${l}" =~ ${re} ]]; then set_part "$1" "${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}"; return 0; fi
+    echo "FAIL  GPT boot disk image not created (bs $1: ${l})"; fail=1; geo_ok[$1]=0; return 1
+}
 # setup_image BS SETTLE -> path of an image after SETTLE default-image boots
 setup_image() {
     local bs="$1" settle="$2" img="${top}/setup-${1}-${2}.img" k
-    truncate -s "${img_bytes}" "${img}"
+    cp "${gpt_tmpl}" "${img}"
     for (( k = 1; k <= settle; k++ )); do
         if ! boot_full "${bs}-setup${settle}-${k}" "${plain_efi}" "${img}" "${bs}" \
             || ! grep -q "^store: committed generation=$(( k + 1 )) boot_count=${k}$" "${work}/serial.txt"; then
@@ -541,7 +573,7 @@ injected_case() {
         return
     fi
     img="${top}/inject.img"; cp "${crashed}" "${img}"
-    off=$(( store_off + tc_slot * unit + sb_crc_off ))
+    off=$(( sb_base + tc_slot * unit + sb_crc_off ))
     printf "\\$(printf '%03o' $(( $(od -An -tu1 -j "${off}" -N 1 "${img}") ^ 0x01 )))" \
         | dd of="${img}" bs=1 seek="${off}" conv=notrunc status=none
     cmp -s "${img}" "${crashed}" && { echo "FAIL  bs=${bs} CRC byte flip did not change the image"; inject_ok=0; return; }
@@ -572,6 +604,7 @@ fi
 mutant_hit=0; mutant_cases=0
 for bs in "${gate_geos[@]}"; do
     echo "=== ${bs}-byte LBA ==="
+    new_disk "${bs}" || continue
     for settle in "${gate_settles[@]}"; do
         if [[ "${mode}" == mutant && "${mutant}" == accept_bad_root_crc && "${settle}" == 0 ]]; then continue; fi
         base="$(setup_image "${bs}" "${settle}")"
diff --git a/scripts/qemu_ck_store_test.sh b/scripts/qemu_ck_store_test.sh
index c26e839e..4bfb5428 100755
--- a/scripts/qemu_ck_store_test.sh
+++ b/scripts/qemu_ck_store_test.sh
@@ -13,8 +13,13 @@
 #    DMA bypass, kept so the bypass path stays honest (boot 6 only).
 #
 # Per NVMe geometry (512 B blocks like qemu_nvme_test.sh, 4 KiB blocks like
-# qemu_store_crash_test.sh / qemu_continuity_test.sh), on one fresh 64 MiB
-# all-zero disk image:
+# qemu_store_crash_test.sh / qemu_continuity_test.sh), on one fresh 64 MiB GPT
+# disk image from native/kernel/tools/ck_gpt_image.c (protective MBR, primary
+# and backup GPT, sentinel-a [1,9) MiB filled, AIENOS partition [9,57) MiB all
+# zero, sentinel-b [57,63) MiB filled). The kernel works only inside the AIENOS
+# partition (dev/disk_part.h); boots 1-3 also check the GPT line, the
+# translation-layer lines and that every byte outside the partition is
+# unchanged (sha256 of the image with the partition cut out):
 #  boots 1-3  same image each time. Every boot must pass all M1 checks
 #             (scripts/lib_ck_m1_checks.sh, the same checks as
 #             qemu_ck_boot_test.sh), stage devices/security/store ok, the NVMe
@@ -107,6 +112,8 @@ commit="$(git rev-parse HEAD 2>/dev/null || echo unknown)"
 out="${repo_root}/target/native-kernel"
 make -s -C native/kernel CROSS="${cross}" OUT="${out}" AIENOS_COMMIT="${commit}" full CK_QEMU_UNSAFE_DMA=1 >/dev/null
 make -s -C native/kernel CROSS="${cross}" OUT="${out}" AIENOS_COMMIT="${commit}" full >/dev/null
+make -s -C native/kernel OUT="${out}" gpt-image >/dev/null
+gpt_tool="${out}/host/ck_gpt_image"
 unsafe_efi="${out}/full-qemu-unsafe-dma/BOOTAA64.EFI"
 safe_efi="${out}/full/BOOTAA64.EFI"
 
@@ -142,6 +149,34 @@ fail_into() { # bucket variable name: move the current failed flag into it
     failed=0
 }
 sha() { sha256sum "$1" | cut -d' ' -f1; }
+# GPT boot disk (tools/ck_gpt_image.c): sentinel-a, AIENOS (all zero), sentinel-b.
+# new_disk IMG BS: create it, set part_first/part_last (as WRITTEN by the tool)
+# and outside_ref (sha256 of every byte outside the AIENOS partition: MBR,
+# primary + backup GPT and both sentinels).
+new_disk() {
+    local l re='^gpt_image bs=[0-9]+ blocks=[0-9]+ aienos_first_lba=([0-9]+) aienos_last_lba=([0-9]+)$'
+    l=$("${gpt_tool}" create "$1" "$2" $(( img_bytes / 1048576 )) aienos-middle) || l=""
+    if [[ "${l}" =~ ${re} ]]; then part_first="${BASH_REMATCH[1]}"; part_last="${BASH_REMATCH[2]}"
+    else echo "FAIL  GPT boot disk image not created (${l})"; part_first=0; part_last=0; m1_fail=1; fi
+    outside_ref=$(outside_sha "$1" "$2")
+}
+# outside_sha IMG BS: sha256 of the image with the AIENOS partition cut out.
+outside_sha() {
+    { head -c $(( part_first * $2 )) "$1"; tail -c +$(( (part_last + 1) * $2 + 1 )) "$1"; } | sha256sum | cut -d' ' -f1
+}
+# layout_checks BS: the kernel found the AIENOS partition where the tool wrote
+# it, its translation refuses past the end, and nothing outside it changed.
+layout_checks() {
+    check "GPT parsed, AIENOS partition found where the image tool wrote it (C only)" \
+        "^disk: gpt ok primary+backup crc32 entries=128 used=3 aienos_index=1 first_lba=${part_first} last_lba=${part_last} "
+    check "partition LBA 0 translates to the partition start (C only)" "^disk: xlate part_lba=0 -> disk_lba=${part_first} (rc=0)$"
+    check "write past the partition end refused by the translation layer (C only)" \
+        "^disk: write past partition end part_lba=[0-9]* -> refused "
+    check_absent "no AIENOS-partition refusal on the good disk (C only)" "disk: no AIENOS partition"
+    local now; now=$(outside_sha "$2" "$1")
+    [[ "${now}" == "${outside_ref}" ]] && echo "PASS  MBR, primary+backup GPT and both sentinel partitions byte-identical (C only)" \
+        || { echo "FAIL  bytes outside the AIENOS partition changed (${outside_ref:0:16} -> ${now:0:16})"; failed=1; }
+}
 
 qemu_cpu="${AIENOS_QEMU_CPU:-max}"
 boot_cpu="${qemu_cpu}"
@@ -211,7 +246,8 @@ nvme_checks() { # block bytes, confined|bypass: the bound NVMe path
     check "read past the namespace end is rejected before any command (differs)" \
         "nvme: bounds read lba=${count} -> refused"
     check "LBA 0 read (differs)" "nvme: read lba=0 blocks=1 ok"
-    check "scratch unit write+flush+readback matched (differs)" "nvme: rw probe lba=[0-9]* bytes=4096 write+flush+readback match"
+    check "scratch unit (last unit of the AIENOS partition) write+flush+readback matched (differs)" \
+        "nvme: rw probe part_lba=[0-9]* disk_lba=[0-9]* bytes=4096 write+flush+readback match"
     check "NVMe bound by the devices stage (differs)" "devices: pci=ok nvme=bound"
     check "stage devices ok (differs)" "stage devices: ok"
     check "NVMe bus master revoked after the read phase" "dma_gate: nvme bus master revoked"
@@ -270,11 +306,13 @@ store_fail_msg() { echo "FAIL  $1"; store_fail=1; }
 for bs in 512 4096; do
     if [[ "${bs}" == 512 ]]; then serial=aienos-nvme-test; else serial=aienos-continuity; fi
     image="${top}/nvme-${bs}.img"
-    truncate -s "${img_bytes}" "${image}"
+    new_disk "${image}" "${bs}"
     prev_gen=""
     for k in 1 2 3; do
         boot "${bs}-boot${k}" "${safe_efi}" "${image}" "${bs}" "${serial}" smmu
         nvme_checks "${bs}" confined
+        layout_checks "${bs}" "${image}"
+        fail_into nvme_fail
         shutdown_checks
         argus_checks
         check "stage store ok (differs)" "stage store: ok"
@@ -322,11 +360,13 @@ for bs in 512 4096; do
 
     # Boot 4: corrupt the Store superblock on the host image.
     store_lba=$(field '^store: TEST identity.* store lba=([0-9]+) ')
+    # store lba is relative to the AIENOS partition (dev/disk_layout.h).
     soff=$(( ${store_lba:-0} * bs ))
     if [[ -z "${store_lba}" || "${soff}" != 16384 ]]; then
-        store_fail_msg "Store region offset ${soff} (lba ${store_lba:-?}), expected byte 16384 (4 anchor units)"
+        store_fail_msg "Store region offset ${soff} in the partition (lba ${store_lba:-?}), expected byte 16384 (4 anchor units)"
         soff=16384
     fi
+    soff=$(( part_first * bs + soff ))
     sha_clean=$(sha "${image}")
     # XOR 0xa5 over 2 x 4096 bytes, as svc/tests/stage_test.c does (shell only).
     fmt=""
@@ -387,7 +427,7 @@ done
 # fallback entropy source, so the office token must be refused and the
 # security stage must fail closed; the Store still opens (keyed nonces).
 image="${top}/nvme-nornd.img"
-truncate -s "${img_bytes}" "${image}"
+new_disk "${image}" 512
 boot_cpu=neoverse-n1
 ck_m1_entropy=absent
 boot "boot7-no-rndr" "${safe_efi}" "${image}" 512 aienos-nvme-test smmu