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 / crates / aienos-artifact-tool / fixtures / p2_6 / assemble.sh
| 1 | #!/usr/bin/env bash |
| 2 | # Reassemble the P2-6 SEED-0B probe from probe.S into OUT_DIR/<probe>/code.bin. |
| 3 | # The committed code.bin is the qualification input; this proves it is |
| 4 | # exactly what probe.S assembles to, with no relocations. |
| 5 | set -euo pipefail |
| 6 | |
| 7 | here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 8 | out="${1:?usage: assemble.sh OUT_DIR}" |
| 9 | as_bin="${AS:-as}" |
| 10 | objcopy_bin="${OBJCOPY:-objcopy}" |
| 11 | if [[ "$(uname -m)" != "aarch64" ]]; then |
| 12 | as_bin="${AS:-aarch64-linux-gnu-as}" |
| 13 | objcopy_bin="${OBJCOPY:-aarch64-linux-gnu-objcopy}" |
| 14 | fi |
| 15 | |
| 16 | for probe in p26seed; do |
| 17 | mkdir -p "${out}/${probe}" |
| 18 | "${as_bin}" -o "${out}/${probe}/probe.o" "${here}/${probe}/probe.S" |
| 19 | if command -v readelf >/dev/null; then |
| 20 | if readelf -r "${out}/${probe}/probe.o" | grep -q "Relocation section"; then |
| 21 | echo "FAIL ${probe} has relocations" >&2 |
| 22 | exit 1 |
| 23 | fi |
| 24 | fi |
| 25 | "${objcopy_bin}" -O binary -j .text "${out}/${probe}/probe.o" "${out}/${probe}/code.bin" |
| 26 | done |