aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / scripts / pi5_fact_req.sh
| 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 | # pi5_fact_req.sh -- write a fact request file for the PI5-5 Cortex qualification image (make pi5-fact). |
| 18 | # QUALIFICATION ONLY. Layout: native/kernel/core/fact_req.h (512 bytes: magic AIENFCT1, version 1, flags 0, |
| 19 | # tag QUALIF-FACT-DATA, length 1..48, reserved 0, printable ASCII text, zero padding). |
| 20 | # |
| 21 | # pi5_fact_req.sh <out file> "<fact text, 1..48 printable ASCII characters>" |
| 22 | # |
| 23 | # Refuses an existing output file. A fact is not a secret; do not put one in it anyway. |
| 24 | set -euo pipefail |
| 25 | out="${1:?output file}" |
| 26 | txt="${2:?fact text}" |
| 27 | [[ ! -e "${out}" ]] || { echo "refusing: ${out} exists" >&2; exit 1; } |
| 28 | n=${#txt} |
| 29 | (( n >= 1 && n <= 48 )) || { echo "fact must be 1..48 characters (got ${n})" >&2; exit 1; } |
| 30 | LC_ALL=C |
| 31 | [[ "${txt}" =~ ^[\ -~]+$ ]] || { echo "fact must be printable ASCII" >&2; exit 1; } |
| 32 | { |
| 33 | printf 'AIENFCT1\x01\x00\x00\x00\x00\x00\x00\x00QUALIF-FACT-DATA' |
| 34 | printf "\\x$(printf '%02x' "${n}")\\x00\\x00\\x00\\x00\\x00\\x00\\x00" |
| 35 | printf '%s' "${txt}" |
| 36 | head -c $((48 - n)) /dev/zero |
| 37 | head -c 424 /dev/zero |
| 38 | } > "${out}" |
| 39 | [[ "$(stat -c %s "${out}")" == 512 ]] || { rm -f "${out}"; echo "internal error: size" >&2; exit 1; } |
| 40 | echo "wrote ${out} (512 bytes, fact of ${n} characters)" |