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 / native / omega / allen / build-one.sh
| 1 | #!/bin/sh |
| 2 | # External development orchestration. Every compiler invocation verifies its pin. |
| 3 | set -eu |
| 4 | [ "$#" = 2 ] || { echo 'usage: build-one.sh SOURCE OUTPUT' >&2; exit 64; } |
| 5 | root=$(CDPATH= cd -- "$(dirname "$0")/../../.." && pwd) |
| 6 | compiler=${OMEGA_COMPILER:-"$root/build/allen-toolchain/seed/out/omc"} |
| 7 | [ -f "$compiler" ] && [ -x "$compiler" ] || { |
| 8 | echo 'pinned compiler missing; follow native/omega/allen/README.md' >&2 |
| 9 | exit 69 |
| 10 | } |
| 11 | # Pin: omega-mv b8bd1d03 (local branch fix/imac-net-L974-snp on 81ab1900; compiler change pending its own review): register slots, live-slot calls, the efi 11 file word, const/bitcast, the site tables and the efi 8 link keep. AArch64 output is byte-identical to 81ab1900. |
| 12 | [ "$(sha256sum "$compiler" | cut -d' ' -f1)" = 2eeab5147deb8320cb1bc7f86a5f3de534955ff89f76be2832155348706e0164 ] || { |
| 13 | echo 'compiler digest differs from the qualified pin' >&2 |
| 14 | exit 65 |
| 15 | } |
| 16 | [ ! -e "$2" ] && [ ! -L "$2" ] || { echo 'fresh output required' >&2; exit 73; } |
| 17 | temporary=$(mktemp "${2}.build.XXXXXX") |
| 18 | trap 'rm -f -- "$temporary" "$temporary.header" "$temporary.dynamic"' EXIT |
| 19 | trap 'exit 74' HUP INT TERM |
| 20 | "$compiler" < "$1" > "$temporary" |
| 21 | [ -s "$temporary" ] |
| 22 | readelf -h "$temporary" > "$temporary.header" |
| 23 | grep -q 'Machine:.*AArch64' "$temporary.header" |
| 24 | grep -q 'Type:.*EXEC' "$temporary.header" |
| 25 | readelf -l -d "$temporary" > "$temporary.dynamic" |
| 26 | if grep -Eq 'INTERP|NEEDED' "$temporary.dynamic"; then exit 65; fi |
| 27 | chmod 700 "$temporary" |
| 28 | # Atomic no-replace publication also refuses a link created during compilation. |
| 29 | ln -T -- "$temporary" "$2" |