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/pi5/efi-commit.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 / pi5 / efi-commit.sh` 43 lines ยท 2067 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 # efi-commit.sh -- print the source commit stamp compiled into an AIENOS kernel EFI. 18 # 19 # efi-commit.sh 20 # 21 # The kernel prints its build stamp (native/kernel/Makefile AIENOS_COMMIT) as 22 # "aienos_commit: " in every report. The stamp is a plain 40-digit hex 23 # string in the image; a Pi build (CK_PI5=1) made from a tree whose tracked files 24 # differ from HEAD carries "<40 hex>-dirty" instead. This script greps the image 25 # for it (grep -a) so the stamp can be read without booting the image. 26 # 27 # Prints the stamp on stdout. Exit 0: exactly one stamp. 1: none found (for 28 # example a build without git, stamp "unknown"). 2: more than one distinct stamp. 29 # 3: the file cannot be read. 30 # Used by pi5-run.sh (logged in run.log) and scripts/ck_pi5_build_check.sh. 31 set -euo pipefail 32 efi="${1:?EFI file}" 33 [[ -r "${efi}" ]] || { echo "efi-commit: cannot read ${efi}" >&2; exit 3; } 34 # Runs of 40 or more hex digits (optionally followed by -dirty), then keep only 35 # exactly 40 digits: a longer run (a 64-digit SHA-256 in the image) is not a stamp. 36 stamps=$(LC_ALL=C grep -a -o -E '[0-9a-f]{40,}(-dirty)?' "${efi}" \ 37 | LC_ALL=C awk '/^[0-9a-f]{40}(-dirty)?$/' | LC_ALL=C sort -u || true) 38 n=$(printf '%s' "${stamps}" | grep -c . || true) 39 case "${n}" in 40 1) printf '%s\n' "${stamps}" ;; 41 0) echo "none"; exit 1 ;; 42 *) echo "ambiguous: $(printf '%s' "${stamps}" | tr '\n' ' ')"; exit 2 ;; 43 esac