boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

seed-accept-boot5.sh (2099B)


      1 #!/bin/sh
      2 ## seed-accept-boot5.sh — acceptance: run boot5 under DRIVER=seed and
      3 ## assert byte-identical outputs vs build/aarch64/boot5/'s podman-built
      4 ## artefacts. Mirrors scripts/seed-accept-boot34.sh.
      5 ##
      6 ## Prereqs (build first):
      7 ##   - build/aarch64/boot6/Image   (run ./scripts/boot.sh aarch64
      8 ##     under DRIVER=podman to produce the tcc-built seed kernel)
      9 ##   - build/aarch64/boot{0..5}/        (same boot.sh run populates these
     10 ##     references)
     11 ##
     12 ## What it does:
     13 ##   1. Stash existing podman-built build/aarch64/boot5/ as ref/.
     14 ##   2. DRIVER=seed scripts/boot5.sh aarch64 — one qemu boot, scheme1
     15 ##      drives ~1300 (run "tcc" …) calls from a generated run.scm.
     16 ##   3. cmp -s each output (libc.a, crt1.o, crti.o, crtn.o, hello) vs
     17 ##      the podman reference; fail on diff.
     18 ##
     19 ## Usage:  scripts/seed-accept-boot5.sh
     20 
     21 set -eu
     22 
     23 ARCH=aarch64
     24 ROOT=$(cd "$(dirname "$0")/.." && pwd)
     25 cd "$ROOT"
     26 
     27 KERNEL=build/$ARCH/boot6/Image
     28 [ -f "$KERNEL" ] || { echo "missing $KERNEL — run ./scripts/boot.sh $ARCH (default DRIVER=podman) first" >&2; exit 1; }
     29 [ -d build/$ARCH/boot5 ] || { echo "build/$ARCH/boot5 missing — run scripts/boot5.sh aarch64" >&2; exit 1; }
     30 for f in libc.a crt1.o crti.o crtn.o hello; do
     31     [ -e build/$ARCH/boot5/$f ] || { echo "build/$ARCH/boot5/$f missing — run scripts/boot5.sh aarch64" >&2; exit 1; }
     32 done
     33 
     34 REF=build/$ARCH/boot5-ref
     35 rm -rf "$REF"
     36 cp -R build/$ARCH/boot5 "$REF"
     37 
     38 echo "[seed-accept-boot5] DRIVER=seed scripts/boot5.sh $ARCH"
     39 DRIVER=seed scripts/boot5.sh $ARCH
     40 
     41 fails=0
     42 for f in libc.a crt1.o crti.o crtn.o hello; do
     43     seed_size=$(wc -c < build/$ARCH/boot5/$f)
     44     ref_size=$(wc -c < $REF/$f)
     45     if cmp -s build/$ARCH/boot5/$f $REF/$f; then
     46         echo "[seed-accept-boot5] $f: byte-identical ($seed_size bytes)"
     47     else
     48         echo "[seed-accept-boot5] $f: DIFF (seed=$seed_size ref=$ref_size)"
     49         fails=$((fails + 1))
     50     fi
     51 done
     52 
     53 if [ $fails -eq 0 ]; then
     54     echo "[seed-accept-boot5] PASS — all 5 outputs byte-identical"
     55     exit 0
     56 else
     57     echo "[seed-accept-boot5] FAIL — $fails outputs differ" >&2
     58     exit 4
     59 fi