Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/scripts/ck_pi5_build_check.sh # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / scripts / ck_pi5_build_check.sh` 290 lines ยท 27624 bytes Raw Blame History 1 #!/usr/bin/env bash 2 # SPDX-License-Identifier: Apache-2.0 3 # Copyright 2026 Drake Stapleton (AIEN / aien-dev) 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 # ck_pi5_build_check.sh -- AIENOS-PI5 step 1, build only. 18 # 19 # Builds the Raspberry Pi 5 kernel image (make -C native/kernel pi5) and checks: 20 # 1. the Pi image defines the board glue: watchdog, SD host, card log slot; 21 # 2. the default image (make -C native/kernel all) defines none of it, so the 22 # Spark and QEMU builds carry no Pi code (the hooks are weak and absent). 23 # 3. the commit stamp (the "aienos_commit" string the kernel prints, read back 24 # out of the EFI with scripts/pi5/efi-commit.sh) tells the truth about the tree: 25 # - the default image always carries the bare HEAD hash (the QEMU gates 26 # compare "aienos_commit: "), dirty tree or not; 27 # - the Pi image carries the bare HEAD hash when no tracked file differs 28 # from HEAD, and "-dirty" when one does. The dirty case is built 29 # from a temporary appended line in native/kernel/README.md, restored 30 # afterwards, into its own OUT (deleted). With that same edit in place 31 # the default image is built too and must still carry the bare hash. 32 # If the tree already has uncommitted tracked changes when the script 33 # starts, the clean-tree and temporary-edit cases cannot be shown and are 34 # printed as NOT_RUN; the Pi image must then carry -dirty. 35 # The Pi image cannot boot in QEMU (its SD host and PM watchdog addresses are 36 # Pi 5 only); it is run on the hub Pi with the one-shot tryboot runner. 37 set -euo pipefail 38 root="$(cd "$(dirname "$0")/.." && pwd)" 39 make -C "${root}/native/kernel" all >/dev/null 40 make -C "${root}/native/kernel" pi5 >/dev/null 41 def="${root}/target/native-kernel/aienos-ck.elf" 42 pi5="${root}/target/native-kernel-pi5/aienos-ck.elf" 43 syms="ck_pi5_start ck_pi5_stage ck_pi5_before_reset ck_pi5_wdt_arm ck_pi5_wdt_pet ck_boot_klog_find sdhci_init ck_klog_put ck_klog_hdr_match ck_pi5_marker_run ck_pi5_rng_ops ck_rng200_read" 44 fail=0 45 defined() { nm "$1" | awk -v s="$2" '$3==s && $2 ~ /^[TtDdBbRrW]$/ {f=1} END {exit !f}'; } 46 for s in ${syms}; do 47 if defined "${pi5}" "${s}"; then echo "PASS pi5 image defines ${s}"; else echo "FAIL pi5 image lacks ${s}"; fail=1; fi 48 if defined "${def}" "${s}"; then echo "FAIL default image defines ${s}"; fail=1; else echo "PASS default image has no ${s}"; fi 49 done 50 test -s "${root}/target/native-kernel-pi5/BOOTAA64.EFI" || { echo "FAIL no Pi BOOTAA64.EFI"; fail=1; } 51 52 # CPU feature printout (PI5-6 cut 1) is on every arm64 image, not Pi only. 53 for img in "${def}" "${pi5}"; do 54 if defined "${img}" ck_cpufeat_decode; then echo "PASS ${img##*/../} defines ck_cpufeat_decode"; else echo "FAIL ${img} lacks ck_cpufeat_decode"; fail=1; fi 55 done 56 57 # Step 3b: the Pi image with the sealed Store stage in the TEST-key tier (SEED-0B-PI5). 58 make -C "${root}/native/kernel" pi5-store >/dev/null 59 ps="${root}/target/native-kernel-pi5-store/full-pi5-store/aienos-ck.elf" 60 for s in ck_stage_store ck_dev_boot_disk ck_store_test_keys; do 61 if defined "${ps}" "${s}"; then echo "PASS pi5-store image defines ${s}"; else echo "FAIL pi5-store image lacks ${s}"; fail=1; fi 62 if defined "${pi5}" "${s}"; then echo "FAIL plain pi5 image defines ${s}"; fail=1; else echo "PASS plain pi5 image has no ${s}"; fi 63 done 64 ps_strings="$(strings -a "${ps}")" # no early-exit pipe (SIGPIPE under pipefail) 65 if grep -q "SEED-0B-PI5" <<<"${ps_strings}" && ! grep -q "SEED-0B-QEMU" <<<"${ps_strings}"; then echo "PASS pi5-store image carries the SEED-0B-PI5 tier label only"; else echo "FAIL pi5-store tier label"; fail=1; fi 66 test -s "${root}/target/native-kernel-pi5-store/full-pi5-store/BOOTAA64.EFI" || { echo "FAIL no pi5-store BOOTAA64.EFI"; fail=1; } 67 68 # PI5-6 cut 2: the Pi image with the inference unit linked (make pi5-infer). Model source is the boot disk 69 # (MODEL.MAP) only: no fw_cfg code, and the Rust unit is present only here. 70 make -C "${root}/native/kernel" pi5-infer >/dev/null 71 pinf="${root}/target/native-kernel-pi5-infer/aienos-ck.elf" 72 for s in aienos_infer_session_open aienos_infer_run aienos_infer_heap_init ck_infer_run ck_pi5_start ck_cpufeat_decode; do 73 if defined "${pinf}" "${s}"; then echo "PASS pi5-infer image defines ${s}"; else echo "FAIL pi5-infer image lacks ${s}"; fail=1; fi 74 done 75 for s in aienos_infer_session_open aienos_infer_run aienos_infer_heap_init; do 76 if defined "${pi5}" "${s}" || defined "${ps}" "${s}" || defined "${def}" "${s}"; then echo "FAIL a non-inference image defines ${s}"; fail=1; else echo "PASS plain pi5, pi5-store and default images have no ${s}"; fi 77 done 78 pinf_strings="$(strings -a "${pinf}")" 79 if grep -q "infer_source_mode: boot-disk model" <<<"${pinf_strings}"; then echo "PASS pi5-infer image carries the boot-disk model source line"; else echo "FAIL pi5-infer boot-disk source line"; fail=1; fi 80 if grep -qE "opt/aienos/model|TEST-ONLY QEMU fw_cfg|fw_cfg" <<<"${pinf_strings}"; then echo "FAIL pi5-infer image carries fw_cfg code or strings"; fail=1; else echo "PASS pi5-infer image has no fw_cfg model ingest"; fi 81 if defined "${pinf}" ck_stage_store; then echo "FAIL pi5-infer image defines ck_stage_store"; fail=1; else echo "PASS pi5-infer image has no Store stage"; fi 82 test -s "${root}/target/native-kernel-pi5-infer/BOOTAA64.EFI" || { echo "FAIL no pi5-infer BOOTAA64.EFI"; fail=1; } 83 84 # AIENOS-PI5 network lane step 1: the Pi image with the PCIe2 / RP1 enumerator (make pi5-pcie). Read-only boot 85 # report; the plain pi5, pi5-store, pi5-infer and default images must carry none of it. 86 make -C "${root}/native/kernel" pi5-pcie >/dev/null 87 ppc="${root}/target/native-kernel-pi5-pcie/aienos-ck.elf" 88 for s in ck_pi5pcie_report ck_pi5pcie_cfg_read32 ck_pi5pcie_ib_verdict ck_dmaw_init ck_pi5_start; do 89 if defined "${ppc}" "${s}"; then echo "PASS pi5-pcie image defines ${s}"; else echo "FAIL pi5-pcie image lacks ${s}"; fail=1; fi 90 done 91 for s in ck_pi5pcie_report ck_pi5pcie_cfg_read32 ck_pi5pcie_ib_verdict ck_dmaw_init; do 92 if defined "${pi5}" "${s}" || defined "${ps}" "${s}" || defined "${pinf}" "${s}" || defined "${def}" "${s}"; then echo "FAIL a non-pcie image defines ${s}"; fail=1; else echo "PASS plain pi5, pi5-store, pi5-infer and default images have no ${s}"; fi 93 done 94 if grep -q "software-only DMA confinement (Pi 5, weaker than the Spark)" <<<"$(strings -a "${ppc}")"; then echo "PASS pi5-pcie image carries the ADR 0020 label"; else echo "FAIL pi5-pcie image lacks the ADR 0020 label"; fail=1; fi 95 test -s "${root}/target/native-kernel-pi5-pcie/BOOTAA64.EFI" || { echo "FAIL no pi5-pcie BOOTAA64.EFI"; fail=1; } 96 97 # AIENOS-PI5 network lane cut 2: the Pi image that narrows the inbound DMA window and reads the PHY ID (make pi5-net). 98 # No other image may carry it, and it must refuse every other Pi image flag. 99 make -C "${root}/native/kernel" pi5-net >/dev/null 100 pnet="${root}/target/native-kernel-pi5-net/aienos-ck.elf" 101 for s in ck_pi5net_run ck_pi5net_ib_plan ck_pi5net_ib_apply ck_rp1_phy_reset ck_gem_mdio_read ck_pi5pcie_ib_verdict ck_pi5_start; do 102 if defined "${pnet}" "${s}"; then echo "PASS pi5-net image defines ${s}"; else echo "FAIL pi5-net image lacks ${s}"; fail=1; fi 103 done 104 for s in ck_pi5net_run ck_pi5net_ib_plan ck_pi5net_ib_apply ck_rp1_phy_reset ck_gem_mdio_read; do 105 if defined "${pi5}" "${s}" || defined "${ps}" "${s}" || defined "${pinf}" "${s}" || defined "${def}" "${s}" || defined "${ppc}" "${s}"; then echo "FAIL a non-net image defines ${s}"; fail=1; else echo "PASS plain pi5, pi5-store, pi5-infer, pi5-pcie and default images have no ${s}"; fi 106 done 107 if grep -q "pi5_dma: hw_window %s=%s" <<<"$(strings -a "${pnet}")"; then echo "PASS pi5-net image carries the verdict line"; else echo "FAIL pi5-net image lacks the verdict line"; fail=1; fi 108 test -s "${root}/target/native-kernel-pi5-net/BOOTAA64.EFI" || { echo "FAIL no pi5-net BOOTAA64.EFI"; fail=1; } 109 # Cut 3: the GEM frame test (ck_gem_xfer, ck_pi5gem_run) lives only in the pi5-net image. 110 for s in ck_gem_xfer ck_pi5gem_run ck_pi5gem_bme_set; do 111 if defined "${pnet}" "${s}"; then echo "PASS pi5-net image defines ${s}"; else echo "FAIL pi5-net image lacks ${s}"; fail=1; fi 112 if defined "${pi5}" "${s}" || defined "${ps}" "${s}" || defined "${pinf}" "${s}" || defined "${def}" "${s}" || defined "${ppc}" "${s}"; then echo "FAIL a non-net image defines ${s}"; fail=1; else echo "PASS no other image defines ${s}"; fi 113 done 114 for other in CK_PI5_STORE=1 CK_PI5_INFER=1 CK_PI5_PCIE=1 CK_PI5_UNLOCK=1 CK_PI5_AGENT=1 CK_PI5_FACT=1 CK_SERVICE=1 CK_HARDWARE_STAGING=1 CK_PI5_NET=2; do 115 if make -n -C "${root}/native/kernel" CK_PI5_NET=1 ${other} full >/dev/null 2>&1; then echo "FAIL Makefile accepts CK_PI5_NET=1 with ${other}"; fail=1; else echo "PASS Makefile refuses CK_PI5_NET=1 with ${other}"; fi 116 done 117 118 # PI5-4 cut 1: the Pi unlock image opens the Store only through the Slot 1 recovery-secret path. 119 make -C "${root}/native/kernel" pi5-unlock >/dev/null 120 uo="${root}/target/native-kernel-pi5-unlock/full-pi5-unlock/aienos-ck.elf" 121 for s in ck_stage_store ck_dev_boot_disk ck_store_unlock_boot ck_store_pi5_unlock_run ck_pi5_unlock_secret; do 122 if defined "${uo}" "${s}"; then echo "PASS pi5-unlock image defines ${s}"; else echo "FAIL pi5-unlock image lacks ${s}"; fail=1; fi 123 done 124 for s in ck_store_test_keys ck_store_test_uuid; do 125 if defined "${uo}" "${s}"; then echo "FAIL pi5-unlock image defines ${s}"; fail=1; else echo "PASS pi5-unlock image has no ${s}"; fi 126 done 127 uo_strings="$(strings -a "${uo}")" 128 if grep -q "AIEN-TEST-BOOT" <<<"${uo_strings}" || grep -q "LANE18-TEST-KVOL" <<<"${uo_strings}" || grep -q "SEED-0B-PI5" <<<"${uo_strings}" || grep -q "SEED-0B-QEMU" <<<"${uo_strings}"; then 129 echo "FAIL pi5-unlock image carries a TEST uuid, TEST key label or TEST tier label"; fail=1 130 else 131 echo "PASS pi5-unlock image carries no TEST uuid, TEST key label or TEST tier label" 132 fi 133 if defined "${ps}" ck_pi5_unlock_secret; then echo "FAIL pi5-store image defines ck_pi5_unlock_secret"; fail=1; else echo "PASS pi5-store image has no unlock secret source"; fi 134 # The tier flags are mutually exclusive: the Makefile must refuse each combination. 135 for combo in CK_PI5_STORE=1 CK_SERVICE=1 CK_HARDWARE_STAGING=1 CK_TEST_STORE_CRASH=1 CK_SERVICE_TEST_KEYS=1; do 136 if make -n -C "${root}/native/kernel" CK_PI5_UNLOCK=1 "${combo}" full >/dev/null 2>&1; then echo "FAIL Makefile accepts CK_PI5_UNLOCK=1 with ${combo}"; fail=1; else echo "PASS Makefile refuses CK_PI5_UNLOCK=1 with ${combo}"; fi 137 done 138 test -s "${root}/target/native-kernel-pi5-unlock/full-pi5-unlock/BOOTAA64.EFI" || { echo "FAIL no pi5-unlock BOOTAA64.EFI"; fail=1; } 139 # PI5-4 cut 2: the card request source (QUALIFICATION ONLY) exists only in its own image. 140 make -C "${root}/native/kernel" pi5-unlock-card >/dev/null 141 uc="${root}/target/native-kernel-pi5-unlock-card/full-pi5-unlock-card/aienos-ck.elf" 142 for s in ck_boot_unlock_req_find ck_unlock_req_take ck_unlock_req_check; do 143 if defined "${uc}" "${s}"; then echo "PASS pi5-unlock-card image defines ${s}"; else echo "FAIL pi5-unlock-card image lacks ${s}"; fail=1; fi 144 for other in "${uo}" "${ps}" "${pi5}" "${def}"; do 145 if defined "${other}" "${s}"; then echo "FAIL ${other} defines ${s}"; fail=1; fi 146 done 147 done 148 echo "PASS no other image (pi5-unlock, pi5-store, pi5, default) defines the card request reader" 149 for s in ck_store_test_keys ck_store_test_uuid; do 150 if defined "${uc}" "${s}"; then echo "FAIL pi5-unlock-card image defines ${s}"; fail=1; else echo "PASS pi5-unlock-card image has no ${s}"; fi 151 done 152 uc_strings="$(strings -a "${uc}")" 153 if grep -q "QUALIFICATION ONLY, throwaway secret" <<<"${uc_strings}" && ! grep -q "QUALIFICATION ONLY, throwaway secret" <<<"${uo_strings}"; then echo "PASS the loud unlock_source label is in the card image only"; else echo "FAIL unlock_source label placement"; fail=1; fi 154 if grep -q "AIEN-TEST-BOOT\|LANE18-TEST-KVOL\|SEED-0B-" <<<"${uc_strings}"; then echo "FAIL pi5-unlock-card image carries a TEST label"; fail=1; else echo "PASS pi5-unlock-card image carries no TEST label"; fi 155 if make -n -C "${root}/native/kernel" CK_PI5_UNLOCK_CARD=1 full >/dev/null 2>&1; then echo "FAIL Makefile accepts CK_PI5_UNLOCK_CARD=1 without CK_PI5_UNLOCK=1"; fail=1; else echo "PASS Makefile refuses CK_PI5_UNLOCK_CARD=1 without CK_PI5_UNLOCK=1"; fi 156 for combo in "CK_PI5_UNLOCK=1 CK_PI5_UNLOCK_CARD=1 CK_PI5_PRODUCTION=1" "CK_PI5_UNLOCK=1 CK_PI5_PRODUCTION=1" "CK_PI5_PRODUCTION=1" "CK_PI5_STORE=1 CK_PI5_UNLOCK_CARD=1"; do 157 # shellcheck disable=SC2086 158 if make -n -C "${root}/native/kernel" ${combo} full >/dev/null 2>&1; then echo "FAIL Makefile accepts ${combo}"; fail=1; else echo "PASS Makefile refuses ${combo}"; fi 159 done 160 test -s "${root}/target/native-kernel-pi5-unlock-card/full-pi5-unlock-card/BOOTAA64.EFI" || { echo "FAIL no pi5-unlock-card BOOTAA64.EFI"; fail=1; } 161 # PI5-5: the Cortex fact stage and the FACT.REQ reader exist only in the pi5-fact image. 162 make -C "${root}/native/kernel" pi5-fact >/dev/null 163 uf="${root}/target/native-kernel-pi5-unlock-card-fact/full-pi5-unlock-card-fact/aienos-ck.elf" 164 for s in ck_pi5_fact_run ck_store_pi5_fact_stage ck_boot_fact_req_find ck_fact_req_check ck_store_pi5_unlock_run cx_open_with; do 165 if defined "${uf}" "${s}"; then echo "PASS pi5-fact image defines ${s}"; else echo "FAIL pi5-fact image lacks ${s}"; fail=1; fi 166 done 167 for s in ck_pi5_fact_run ck_store_pi5_fact_stage ck_boot_fact_req_find ck_fact_req_check cx_open_with; do 168 for other in "${uc}" "${uo}" "${ps}" "${pi5}" "${def}"; do 169 if defined "${other}" "${s}"; then echo "FAIL ${other} defines ${s}"; fail=1; fi 170 done 171 done 172 echo "PASS no other image (pi5-unlock-card, pi5-unlock, pi5-store, pi5, default) defines the fact stage or its request reader" 173 for s in ck_store_test_keys ck_store_test_uuid; do 174 if defined "${uf}" "${s}"; then echo "FAIL pi5-fact image defines ${s}"; fail=1; else echo "PASS pi5-fact image has no ${s}"; fi 175 done 176 uf_strings="$(strings -a "${uf}")" 177 if grep -q "AIEN-TEST-BOOT\|LANE18-TEST-KVOL\|SEED-0B-" <<<"${uf_strings}"; then echo "FAIL pi5-fact image carries a TEST label"; fail=1; else echo "PASS pi5-fact image carries no TEST label (production-class Store)"; fi 178 for combo in "CK_PI5_FACT=1" "CK_PI5_UNLOCK=1 CK_PI5_FACT=1" "CK_PI5_UNLOCK=1 CK_PI5_UNLOCK_CARD=1 CK_PI5_FACT=1 CK_PI5_STORE=1" "CK_PI5_UNLOCK=1 CK_PI5_UNLOCK_CARD=1 CK_PI5_FACT=1 CK_PI5_INFER=1" "CK_PI5_UNLOCK=1 CK_PI5_UNLOCK_CARD=1 CK_PI5_FACT=1 CK_PI5_PCIE=1" "CK_PI5_UNLOCK=1 CK_PI5_UNLOCK_CARD=1 CK_PI5_FACT=2"; do 179 # shellcheck disable=SC2086 180 if make -n -C "${root}/native/kernel" ${combo} full >/dev/null 2>&1; then echo "FAIL Makefile accepts ${combo}"; fail=1; else echo "PASS Makefile refuses ${combo}"; fi 181 done 182 for combo in CK_PI5_FACT=1; do 183 for other in CK_PI5_STORE=1 CK_PI5_INFER=1 CK_PI5_PCIE=1; do 184 # shellcheck disable=SC2086 185 if make -n -C "${root}/native/kernel" ${other} ${combo} full >/dev/null 2>&1; then echo "FAIL Makefile accepts ${other} ${combo}"; fail=1; else echo "PASS Makefile refuses ${other} ${combo}"; fi 186 done 187 done 188 test -s "${root}/target/native-kernel-pi5-unlock-card-fact/full-pi5-unlock-card-fact/BOOTAA64.EFI" || { echo "FAIL no pi5-fact BOOTAA64.EFI"; fail=1; } 189 # PI5-6 final cut: the agent stage (Store plus resident inference plus the persisted reply) exists only in the pi5-agent image. 190 make -C "${root}/native/kernel" pi5-agent >/dev/null 191 ua="${root}/target/native-kernel-pi5-unlock-card-agent/full-pi5-unlock-card-agent/aienos-ck.elf" 192 for s in ck_pi5_agent_run ck_store_pi5_agent_stage ck_infer_prompt ck_infer_resident_close ck_infer_model_sha256 ck_store_pi5_unlock_run ck_boot_unlock_req_find; do 193 if defined "${ua}" "${s}"; then echo "PASS pi5-agent image defines ${s}"; else echo "FAIL pi5-agent image lacks ${s}"; fail=1; fi 194 done 195 for s in ck_pi5_agent_run ck_store_pi5_agent_stage; do 196 for other in "${uf}" "${uc}" "${uo}" "${ps}" "${pi5}" "${pinf}" "${def}"; do 197 if defined "${other}" "${s}"; then echo "FAIL ${other} defines ${s}"; fail=1; fi 198 done 199 done 200 echo "PASS no other image (pi5-fact, pi5-unlock-card, pi5-unlock, pi5-store, pi5, pi5-infer, default) defines the agent stage" 201 for s in ck_store_test_keys ck_store_test_uuid ck_pi5_fact_run ck_boot_fact_req_find fw_dma_read fwcfg_from_dsdt; do 202 if defined "${ua}" "${s}"; then echo "FAIL pi5-agent image defines ${s}"; fail=1; else echo "PASS pi5-agent image has no ${s}"; fi 203 done 204 ua_strings="$(strings -a "${ua}")" 205 if grep -q "AIEN-TEST-BOOT\|LANE18-TEST-KVOL\|SEED-0B-" <<<"${ua_strings}"; then echo "FAIL pi5-agent image carries a TEST label"; fail=1; else echo "PASS pi5-agent image carries no TEST label (production-class Store)"; fi 206 if grep -q "infer_source_mode: boot-disk model" <<<"${ua_strings}" && ! grep -q "opt/aienos/model\|TEST-ONLY QEMU fw_cfg" <<<"${ua_strings}"; then echo "PASS pi5-agent image reads the model from the boot disk only (no fw_cfg source)"; else echo "FAIL pi5-agent image model source"; fail=1; fi 207 if grep -q "QUALIFICATION ONLY, throwaway secret" <<<"${ua_strings}"; then echo "PASS the loud unlock_source label is in the pi5-agent image"; else echo "FAIL pi5-agent image lacks the unlock_source label"; fail=1; fi 208 # the positive control: the flag set the image is built with is accepted (a dry run), so the refusals below are the flag under test. 209 if make -n -C "${root}/native/kernel" CK_PI5_UNLOCK=1 CK_PI5_UNLOCK_CARD=1 CK_PI5_AGENT=1 CK_INFER_LIB=/nonexistent/lib.a full >/dev/null 2>&1; then echo "PASS Makefile accepts CK_PI5_UNLOCK=1 CK_PI5_UNLOCK_CARD=1 CK_PI5_AGENT=1 CK_INFER_LIB="; else echo "FAIL Makefile refuses the pi5-agent flag set"; fail=1; fi 210 for combo in "CK_PI5_AGENT=1" "CK_PI5_UNLOCK=1 CK_PI5_AGENT=1 CK_INFER_LIB=/x/l.a" "CK_PI5_UNLOCK=1 CK_PI5_UNLOCK_CARD=1 CK_PI5_AGENT=1" "CK_PI5_UNLOCK=1 CK_PI5_UNLOCK_CARD=1 CK_PI5_AGENT=2 CK_INFER_LIB=/x/l.a" "CK_PI5_UNLOCK_CARD=1 CK_PI5_AGENT=1 CK_INFER_LIB=/x/l.a"; do 211 # shellcheck disable=SC2086 212 if make -n -C "${root}/native/kernel" ${combo} full >/dev/null 2>&1; then echo "FAIL Makefile accepts ${combo}"; fail=1; else echo "PASS Makefile refuses ${combo}"; fi 213 done 214 for other in CK_PI5_STORE=1 CK_PI5_INFER=1 CK_PI5_PCIE=1 CK_PI5_FACT=1 CK_SERVICE=1 CK_HARDWARE_STAGING=1 CK_TEST_FWCFG_ARTIFACTS=1; do 215 # shellcheck disable=SC2086 216 if make -n -C "${root}/native/kernel" ${other} CK_PI5_UNLOCK=1 CK_PI5_UNLOCK_CARD=1 CK_PI5_AGENT=1 CK_INFER_LIB=/x/l.a full >/dev/null 2>&1; then echo "FAIL Makefile accepts ${other} with CK_PI5_AGENT=1"; fail=1; else echo "PASS Makefile refuses ${other} with CK_PI5_AGENT=1"; fi 217 done 218 # the other direction: the older Pi tiers refuse the agent flag too. 219 for tier in CK_PI5_INFER=1 CK_PI5_PCIE=1 CK_PI5_FACT=1; do 220 # shellcheck disable=SC2086 221 if make -n -C "${root}/native/kernel" ${tier} CK_PI5_AGENT=1 CK_PI5_UNLOCK=1 CK_PI5_UNLOCK_CARD=1 CK_INFER_LIB=/x/l.a full >/dev/null 2>&1; then echo "FAIL Makefile accepts ${tier} with CK_PI5_AGENT=1"; fail=1; fi 222 done 223 test -s "${root}/target/native-kernel-pi5-unlock-card-agent/full-pi5-unlock-card-agent/BOOTAA64.EFI" || { echo "FAIL no pi5-agent BOOTAA64.EFI"; fail=1; } 224 # PI5-7 cut 2: the resident lifecycle driven by the card command script exists only in the pi5-lifecycle image. 225 make -C "${root}/native/kernel" pi5-lifecycle >/dev/null 226 ul="${root}/target/native-kernel-pi5-unlock-card-lifecycle/full-pi5-unlock-card-lifecycle/aienos-ck.elf" 227 for s in ck_lifecycle_run ck_boot_agent_cmd_find ck_agent_cmd_parse ck_cont_service_start ck_ctx_finish ck_infer_prompt ck_infer_resident_close ck_store_pi5_unlock_run ck_boot_unlock_req_find ck_slot_service_update cx_open_with; do 228 if defined "${ul}" "${s}"; then echo "PASS pi5-lifecycle image defines ${s}"; else echo "FAIL pi5-lifecycle image lacks ${s}"; fail=1; fi 229 done 230 for s in ck_lifecycle_run ck_boot_agent_cmd_find ck_agent_cmd_parse ck_cont_service_start ck_slot_service_update; do 231 for other in "${ua}" "${uf}" "${uc}" "${uo}" "${ps}" "${pi5}" "${pinf}" "${def}"; do 232 if defined "${other}" "${s}"; then echo "FAIL ${other} defines ${s}"; fail=1; fi 233 done 234 done 235 echo "PASS no other Pi image (pi5-agent, pi5-fact, pi5-unlock-card, pi5-unlock, pi5-store, pi5, pi5-infer) nor the default image defines the lifecycle or its script reader" 236 for s in ck_pi5_agent_run ck_store_pi5_agent_stage ck_pi5_fact_run ck_boot_fact_req_find ck_store_test_keys ck_store_test_uuid ck_slot_boot_capture ck_rc_inspect rc_inspect ck_cont_boot_stage fw_dma_read fwcfg_from_dsdt; do 237 if defined "${ul}" "${s}"; then echo "FAIL pi5-lifecycle image defines ${s}"; fail=1; else echo "PASS pi5-lifecycle image has no ${s}"; fi 238 done 239 ul_strings="$(strings -a "${ul}")" 240 if grep -q "AIEN-TEST-BOOT\|LANE18-TEST-KVOL\|SEED-0B-\|TEST-ONLY service image" <<<"${ul_strings}"; then echo "FAIL pi5-lifecycle image carries a TEST label"; fail=1; else echo "PASS pi5-lifecycle image carries no TEST label (production-class Store)"; fi 241 if grep -q "infer_source_mode: boot-disk model" <<<"${ul_strings}" && ! grep -q "opt/aienos/model\|TEST-ONLY QEMU fw_cfg" <<<"${ul_strings}"; then echo "PASS pi5-lifecycle image reads the model from the boot disk only (no fw_cfg source)"; else echo "FAIL pi5-lifecycle image model source"; fail=1; fi 242 if grep -q "QUALIFICATION ONLY, throwaway secret" <<<"${ul_strings}"; then echo "PASS the loud unlock_source label is in the pi5-lifecycle image"; else echo "FAIL pi5-lifecycle image lacks the unlock_source label"; fail=1; fi 243 if grep -q "card command script AGENT.CMD, QUALIFICATION ONLY" <<<"${ul_strings}"; then echo "PASS the loud command-script label is in the pi5-lifecycle image"; else echo "FAIL pi5-lifecycle image lacks the command-script label"; fail=1; fi 244 # the lifecycle image never reads the console: no serial input line in the image, the script is the only input. 245 if grep -q "operator input: serial" <<<"${ul_strings}"; then echo "FAIL pi5-lifecycle image carries the serial input path"; fail=1; else echo "PASS pi5-lifecycle image has no serial operator input"; fi 246 if make -n -C "${root}/native/kernel" CK_PI5_UNLOCK=1 CK_PI5_UNLOCK_CARD=1 CK_PI5_LIFECYCLE=1 CK_INFER_LIB=/nonexistent/lib.a full >/dev/null 2>&1; then echo "PASS Makefile accepts CK_PI5_UNLOCK=1 CK_PI5_UNLOCK_CARD=1 CK_PI5_LIFECYCLE=1 CK_INFER_LIB="; else echo "FAIL Makefile refuses the pi5-lifecycle flag set"; fail=1; fi 247 for combo in "CK_PI5_LIFECYCLE=1" "CK_PI5_UNLOCK=1 CK_PI5_LIFECYCLE=1 CK_INFER_LIB=/x/l.a" "CK_PI5_UNLOCK=1 CK_PI5_UNLOCK_CARD=1 CK_PI5_LIFECYCLE=1" "CK_PI5_UNLOCK=1 CK_PI5_UNLOCK_CARD=1 CK_PI5_LIFECYCLE=2 CK_INFER_LIB=/x/l.a" "CK_PI5_UNLOCK_CARD=1 CK_PI5_LIFECYCLE=1 CK_INFER_LIB=/x/l.a"; do 248 # shellcheck disable=SC2086 249 if make -n -C "${root}/native/kernel" ${combo} full >/dev/null 2>&1; then echo "FAIL Makefile accepts ${combo}"; fail=1; else echo "PASS Makefile refuses ${combo}"; fi 250 done 251 for other in CK_PI5_STORE=1 CK_PI5_INFER=1 CK_PI5_PCIE=1 CK_PI5_FACT=1 CK_PI5_AGENT=1 CK_SERVICE=1 CK_SERVICE_TEST_KEYS=1 CK_HARDWARE_STAGING=1 CK_TEST_FWCFG_ARTIFACTS=1; do 252 # shellcheck disable=SC2086 253 if make -n -C "${root}/native/kernel" ${other} CK_PI5_UNLOCK=1 CK_PI5_UNLOCK_CARD=1 CK_PI5_LIFECYCLE=1 CK_INFER_LIB=/x/l.a full >/dev/null 2>&1; then echo "FAIL Makefile accepts ${other} with CK_PI5_LIFECYCLE=1"; fail=1; else echo "PASS Makefile refuses ${other} with CK_PI5_LIFECYCLE=1"; fi 254 done 255 # the other direction: the older Pi tiers refuse the lifecycle flag too. 256 for tier in CK_PI5_INFER=1 CK_PI5_PCIE=1 CK_PI5_FACT=1 CK_PI5_AGENT=1; do 257 # shellcheck disable=SC2086 258 if make -n -C "${root}/native/kernel" ${tier} CK_PI5_LIFECYCLE=1 CK_PI5_UNLOCK=1 CK_PI5_UNLOCK_CARD=1 CK_INFER_LIB=/x/l.a full >/dev/null 2>&1; then echo "FAIL Makefile accepts ${tier} with CK_PI5_LIFECYCLE=1"; fail=1; fi 259 done 260 test -s "${root}/target/native-kernel-pi5-unlock-card-lifecycle/full-pi5-unlock-card-lifecycle/BOOTAA64.EFI" || { echo "FAIL no pi5-lifecycle BOOTAA64.EFI"; fail=1; } 261 # PI5-7 cut 3: the EL0 artifact qualification image (make pi5-artifact): the plain Pi core image whose candidates come from the card 262 # bundle, trusting the public TEST key only. Only this image (and its QEMU twin) defines the card reader. 263 make -C "${root}/native/kernel" pi5-artifact >/dev/null 264 pa="${root}/target/native-kernel-pi5-artifact/aienos-ck.elf" 265 for s in ck_boot_artifact_card_find ck_acard_parse ck_acard_boot ck_acard_buf ck_stage_disk_artifacts ck_pi5_start ck_cpufeat_decode; do 266 if defined "${pa}" "${s}"; then echo "PASS pi5-artifact image defines ${s}"; else echo "FAIL pi5-artifact image lacks ${s}"; fail=1; fi 267 done 268 for s in ck_boot_artifact_card_find ck_acard_parse ck_acard_boot ck_acard_buf; do 269 for other in "${ul}" "${ua}" "${uf}" "${uc}" "${uo}" "${ps}" "${pi5}" "${pinf}" "${def}"; do 270 if defined "${other}" "${s}"; then echo "FAIL ${other} defines ${s}"; fail=1; fi 271 done 272 done 273 echo "PASS no other Pi image nor the default image defines the card artifact reader" 274 for s in ck_stage_store ck_store_test_keys ck_store_pi5_unlock_run ck_boot_unlock_req_find ck_lifecycle_run fw_dma_read fwcfg_from_dsdt; do 275 if defined "${pa}" "${s}"; then echo "FAIL pi5-artifact image defines ${s}"; fail=1; else echo "PASS pi5-artifact image has no ${s}"; fi 276 done 277 pa_strings="$(strings -a "${pa}")" 278 if grep -q "artifact_trust: seed0b-test qualification build" <<<"${pa_strings}" && grep -q "SEED-0B-PI5" <<<"${pa_strings}"; then echo "PASS pi5-artifact image carries the TEST ONLY trust label and the SEED-0B-PI5 tier"; else echo "FAIL pi5-artifact image lacks the TEST ONLY label or tier"; fail=1; fi 279 if grep -qE "opt/aienos/artifacts|fw_cfg" <<<"${pa_strings}"; then echo "FAIL pi5-artifact image carries fw_cfg artifact code"; fail=1; else echo "PASS pi5-artifact image has no fw_cfg artifact code"; fi 280 if make -n -C "${root}/native/kernel" CK_PI5_ARTIFACT=1 all >/dev/null 2>&1; then echo "PASS Makefile accepts CK_PI5_ARTIFACT=1 (positive control)"; else echo "FAIL Makefile refuses CK_PI5_ARTIFACT=1"; fail=1; fi 281 for combo in "CK_ARTIFACT_CARD=1" "CK_PI5_ARTIFACT=2" "CK_PI5_ARTIFACT=1 CK_SEED0B_TEST_ANCHOR=" "CK_PI5_ARTIFACT=1 CK_HARDWARE_STAGING=1" "CK_PI5_ARTIFACT=1 CK_TEST_FWCFG_ARTIFACTS=1" "CK_PI5_ARTIFACT=1 CK_SERVICE=1" "CK_PI5_ARTIFACT=1 CK_INFER_LIB=/x/l.a" "CK_PI5_ARTIFACT=1 full"; do 282 # shellcheck disable=SC2086 283 if make -n -C "${root}/native/kernel" ${combo} >/dev/null 2>&1; then echo "FAIL Makefile accepts ${combo}"; fail=1; else echo "PASS Makefile refuses ${combo}"; fi 284 done 285 for other in CK_PI5_STORE=1 CK_PI5_INFER=1 CK_PI5_PCIE=1 CK_PI5_NET=1 CK_PI5_UNLOCK=1 CK_PI5_FACT=1 CK_PI5_AGENT=1 CK_PI5_LIFECYCLE=1; do 286 # shellcheck disable=SC2086 287 if make -n -C "${root}/native/kernel" ${other} CK_PI5_ARTIFACT=1 all >/dev/null 2>&1; then echo "FAIL Makefile accepts ${other} with CK_PI5_ARTIFACT=1"; fail=1; else echo "PASS Makefile refuses ${other} with CK_PI5_ARTIFACT=1"; fi 288 done 289 test -s "${root}/target/native-kernel-pi5-artifact/BOOTAA64.EFI" || { echo "FAIL no pi5-artifact BOOTAA64.EFI"; fail=1; } 290 if [[ ${fail} == 0 ]]; then echo "CK_PI5_BUILD: PASS"; else echo "CK_PI5_BUILD: FAIL"; exit 1; fi