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_repro_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_repro_check.sh` 85 lines ยท 4834 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_repro_check.sh -- PI5-8 Q1, reproducible builds of every Raspberry Pi 5 image. 18 # 19 # scripts/ck_pi5_repro_check.sh [commit] (default: HEAD of this checkout) 20 # 21 # Makes two clean detached worktrees of the SAME commit at two DIFFERENT paths (so build-directory 22 # paths that leak into an image show up as a difference), builds every Pi image in each with the same 23 # toolchain, and compares the sha256 of each BOOTAA64.EFI and aienos-ck.elf byte for byte. Prints a 24 # table and PASS/FAIL (exit 0 only when every BOOTAA64.EFI and every stripped ELF matches; a raw ELF may differ only in Rust symbol-name hash suffixes, see below). Records the toolchain versions used. 25 # Env: REPRO_KEEP=1 keeps the worktrees; REPRO_TMP= sets where they go (default: mktemp -d). 26 set -euo pipefail 27 root="$(cd "$(dirname "$0")/.." && pwd)" 28 commit="$(git -C "${root}" rev-parse "${1:-HEAD}")" 29 tmp="${REPRO_TMP:-$(mktemp -d "${TMPDIR:-/tmp}/aienos-repro.XXXXXX")}" 30 mkdir -p "${tmp}" 31 cleanup() { 32 if [ "${REPRO_KEEP:-}" != 1 ]; then 33 for d in a/aienos-repro b/aienos-repro; do 34 git -C "${root}" worktree remove --force "${tmp}/${d}" 2>/dev/null || true 35 done 36 rm -rf "${tmp}" 37 fi 38 } 39 trap cleanup EXIT 40 # target name -> output directory (relative to the worktree) that holds BOOTAA64.EFI and aienos-ck.elf 41 images="pi5:target/native-kernel-pi5 42 pi5-store:target/native-kernel-pi5-store/full-pi5-store 43 pi5-unlock:target/native-kernel-pi5-unlock/full-pi5-unlock 44 pi5-unlock-card:target/native-kernel-pi5-unlock-card/full-pi5-unlock-card 45 pi5-fact:target/native-kernel-pi5-unlock-card-fact/full-pi5-unlock-card-fact 46 pi5-infer:target/native-kernel-pi5-infer 47 pi5-agent:target/native-kernel-pi5-unlock-card-agent/full-pi5-unlock-card-agent 48 pi5-lifecycle:target/native-kernel-pi5-unlock-card-lifecycle/full-pi5-unlock-card-lifecycle 49 pi5-artifact:target/native-kernel-pi5-artifact 50 pi5-pcie:target/native-kernel-pi5-pcie 51 pi5-net:target/native-kernel-pi5-net" 52 53 echo "commit: ${commit}" 54 echo "toolchain:" 55 for c in "make --version" "cc --version" "ld --version" "objcopy --version" "rustc -Vv" "cargo -V"; do 56 out="$(${c} 2>&1)"; printf " %s: %s\n" "${c%% *}" "${out%%$'\n'*}" 57 done 58 git -C "${root}" worktree prune 59 for d in a b; do 60 mkdir -p "${tmp}/${d}" 61 git -C "${root}" worktree add -q --detach "${tmp}/${d}/aienos-repro" "${commit}" 62 done 63 for d in a b; do 64 echo "== build set ${d} (${tmp}/${d}/aienos-repro)" 65 while IFS=: read -r tgt _; do 66 make -C "${tmp}/${d}/aienos-repro/native/kernel" "${tgt}" >"${tmp}/${d}.${tgt}.log" 2>&1 \ 67 || { echo "FAIL build ${tgt} in set ${d}; see ${tmp}/${d}.${tgt}.log"; REPRO_KEEP=1; tail -20 "${tmp}/${d}.${tgt}.log"; exit 2; } 68 done <<<"${images}" 69 done 70 fail=0 71 printf '%-16s %-10s %-64s %s\n' IMAGE FILE SHA256 RESULT 72 while IFS=: read -r tgt dir; do 73 for f in BOOTAA64.EFI aienos-ck.elf; do 74 pa="${tmp}/a/aienos-repro/${dir}/${f}"; pb="${tmp}/b/aienos-repro/${dir}/${f}" 75 if [ ! -s "${pa}" ] || [ ! -s "${pb}" ]; then printf '%-16s %-10s %-64s %s\n' "${tgt}" "${f}" "-" "MISSING"; fail=1; continue; fi 76 ha="$(sha256sum "${pa}" | cut -d' ' -f1)"; hb="$(sha256sum "${pb}" | cut -d' ' -f1)" 77 if [ "${ha}" = "${hb}" ]; then printf '%-16s %-10s %-64s %s\n' "${tgt}" "${f}" "${ha}" "match" 78 elif [ "${f}" = aienos-ck.elf ] && strip -s -o "${tmp}/sa.elf" "${pa}" && strip -s -o "${tmp}/sb.elf" "${pb}" && cmp -s "${tmp}/sa.elf" "${tmp}/sb.elf"; then 79 # Rust crate-hash suffixes in symbol NAMES (cargo hashes the absolute path of a path dependency outside the crate's 80 # own workspace). Symbols are not in BOOTAA64.EFI; the stripped ELF (all code and data) is byte-identical. 81 printf '%-16s %-10s %-64s %s\n' "${tgt}" "${f}" "${ha}/${hb}" "match-stripped (symbol-name hash suffix only)" 82 else printf '%-16s %-10s %-64s %s\n' "${tgt}" "${f}" "${ha}/${hb}" "DIFFER"; fail=1; fi 83 done 84 done <<<"${images}" 85 if [ "${fail}" = 0 ]; then echo "PASS ck_pi5_repro_check: every Pi image built twice from ${commit} is byte-identical (EFI exact; Rust-linked ELFs exact once stripped)"; else echo "FAIL ck_pi5_repro_check"; exit 1; fi