boot2

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

commit 0ff7891d3dbe43aae2d5fc549d86b2e7e01ab029
parent fed5b453a02918feaa85f39db309333c159b337b
Author: Ryan Sepassi <rsepassi@gmail.com>
Date:   Wed,  6 May 2026 12:07:21 -0700

A3: per-driver output trees at build/$ARCH/$DRIVER/bootN

Insert $DRIVER into every bootN output and staging path so podman and
seed driver trees coexist on disk. boot.sh now wipes only its own
$DRIVER subtree and the seed driver consumes the kernel directly from
build/$ARCH/podman/boot6/$KERNEL_NAME — no .seed-bootstrap stash.

Verified end-to-end on aarch64: all 19 artifacts across boot0..boot6
are byte-identical between DRIVER=podman and DRIVER=seed.

Diffstat:
MMakefile | 3++-
Mscripts/boot.sh | 26+++++++++-----------------
Mscripts/boot0.sh | 6+++---
Mscripts/boot1.sh | 10+++++-----
Mscripts/boot2.sh | 14+++++++-------
Mscripts/boot3.sh | 16++++++++--------
Mscripts/boot4.sh | 20++++++++++----------
Mscripts/boot5.sh | 18+++++++++---------
Mscripts/boot6.sh | 16++++++++--------
Mscripts/lib-arch.sh | 5++++-
Mscripts/seed-accept-boot34.sh | 50+++++++++++++++++++++-----------------------------
Mscripts/seed-accept-boot5.sh | 38+++++++++++++++++---------------------
Mscripts/seed-accept.sh | 7++++---
13 files changed, 107 insertions(+), 122 deletions(-)

diff --git a/Makefile b/Makefile @@ -61,7 +61,8 @@ # 3. M1pp + hex2pp -> every other ELF (.P1pp pipeline) (boot-build-p1pp.sh) # # Standalone host-side entrypoints (not used by this Makefile, but they -# build the same artifacts in build/$ARCH/bootN/ for inspection): +# build the same artifacts in build/$ARCH/$DRIVER/bootN/ for inspection; +# DRIVER ∈ {podman, seed}, default podman): # scripts/boot0.sh <arch> -> hex2 / M0 / catm # scripts/boot1.sh <arch> -> m1pp / hex2pp # scripts/boot2.sh <arch> -> scheme1 diff --git a/scripts/boot.sh b/scripts/boot.sh @@ -6,13 +6,13 @@ ## DRIVER=podman scripts/boot.sh <amd64|aarch64|riscv64> ## ## DRIVER (default podman) is exported and consumed by each bootN.sh. -## DRIVER=seed runs the build pipeline on build/$ARCH/boot6/{Image,kernel.elf} -## — the tcc3-built seed kernel produced by boot6. First-time setup -## therefore requires one prior podman pass to produce that kernel: +## Outputs land at build/$ARCH/$DRIVER/bootN/, so the two driver trees +## coexist on disk. DRIVER=seed runs the build pipeline on top of the +## podman-built boot6 kernel at build/$ARCH/podman/boot6/{Image,kernel.elf}; +## first-time setup therefore requires one prior podman pass: ## ./scripts/boot.sh <arch> # default DRIVER=podman ## DRIVER=seed ./scripts/boot.sh <arch> # re-run on tcc-built kernel -## Subsequent DRIVER=seed runs reuse the Image from the prior boot6 -## (stashed across the build/$ARCH wipe below). +## Subsequent DRIVER=seed runs reuse the Image directly — no stashing. set -e @@ -20,25 +20,17 @@ set -e bootlib_init boot "${1:-}" if [ "$DRIVER" = seed ]; then - KERNEL=build/$ARCH/boot6/$KERNEL_NAME + KERNEL=build/$ARCH/podman/boot6/$KERNEL_NAME if [ ! -f "$KERNEL" ]; then echo "[$BOOT_TAG] missing $KERNEL" >&2 echo "[$BOOT_TAG] run './scripts/boot.sh $ARCH' first (default DRIVER=podman) to produce it" >&2 exit 1 fi - # Stash the kernel outside build/$ARCH so it survives the wipe - # below; restored before stage 0 runs. - STASH=build/.seed-bootstrap/$ARCH - mkdir -p "$STASH" - cp "$KERNEL" "$STASH/$KERNEL_NAME" fi -rm -rf build/$ARCH - -if [ "$DRIVER" = seed ]; then - mkdir -p build/$ARCH/boot6 - cp build/.seed-bootstrap/$ARCH/$KERNEL_NAME build/$ARCH/boot6/$KERNEL_NAME -fi +# Wipe only this driver's tree so the other driver's outputs survive +# (the seed driver consumes build/$ARCH/podman/boot6/$KERNEL_NAME). +rm -rf build/$ARCH/$DRIVER T0=$(date +%s) trap 'echo "[$BOOT_TAG] elapsed at exit: $(($(date +%s) - T0))s"' EXIT diff --git a/scripts/boot0.sh b/scripts/boot0.sh @@ -10,7 +10,7 @@ ## catm.hex2, M0.hex2, ELF.hex2} ## ## ─── Outputs ────────────────────────────────────────────────────────── -## build/$ARCH/boot0/{hex2, catm, M0} +## build/$ARCH/$DRIVER/boot0/{hex2, catm, M0} ## ## Usage: scripts/boot0.sh <arch> ## <arch> ∈ {aarch64, amd64, riscv64} for either DRIVER (default podman). @@ -22,8 +22,8 @@ bootlib_init boot0 "${1:-}" driver_init scratch SEED=vendor/seed/$ARCH -OUT=build/$ARCH/boot0 -STAGE=build/$ARCH/.boot0-stage +OUT=build/$ARCH/$DRIVER/boot0 +STAGE=build/$ARCH/$DRIVER/.boot0-stage . scripts/lib-pipeline.sh pipeline_init "$STAGE" "$OUT" "$DRIVER" diff --git a/scripts/boot1.sh b/scripts/boot1.sh @@ -10,10 +10,10 @@ ## P1/P1-$ARCH.M1, vendor/seed/$ARCH/ELF.hex2 ## ## ─── Inputs (binaries from prior stages) ────────────────────────────── -## build/$ARCH/boot0/{hex2, M0, catm} +## build/$ARCH/$DRIVER/boot0/{hex2, M0, catm} ## ## ─── Outputs ────────────────────────────────────────────────────────── -## build/$ARCH/boot1/{M1pp, hex2pp} +## build/$ARCH/$DRIVER/boot1/{M1pp, hex2pp} ## ## Usage: scripts/boot1.sh <arch> ## <arch> ∈ {aarch64, amd64, riscv64} for either DRIVER (default podman). @@ -24,9 +24,9 @@ set -eu bootlib_init boot1 "${1:-}" driver_init scratch -BOOT0=build/$ARCH/boot0 -OUT=build/$ARCH/boot1 -STAGE=build/$ARCH/.boot1-stage +BOOT0=build/$ARCH/$DRIVER/boot0 +OUT=build/$ARCH/$DRIVER/boot1 +STAGE=build/$ARCH/$DRIVER/.boot1-stage require_prev "$BOOT0" hex2 M0 catm diff --git a/scripts/boot2.sh b/scripts/boot2.sh @@ -12,11 +12,11 @@ ## vendor/seed/$ARCH/ELF.hex2 ## ## ─── Inputs (binaries from prior stages) ────────────────────────────── -## build/$ARCH/boot0/catm (only to bootstrap catm.P1pp build) -## build/$ARCH/boot1/{M1pp, hex2pp} +## build/$ARCH/$DRIVER/boot0/catm (only to bootstrap catm.P1pp build) +## build/$ARCH/$DRIVER/boot1/{M1pp, hex2pp} ## ## ─── Outputs ────────────────────────────────────────────────────────── -## build/$ARCH/boot2/{catm, scheme1} +## build/$ARCH/$DRIVER/boot2/{catm, scheme1} ## ## Usage: scripts/boot2.sh <arch> ## <arch> ∈ {aarch64, amd64, riscv64} for either DRIVER (default podman). @@ -27,10 +27,10 @@ set -eu bootlib_init boot2 "${1:-}" driver_init scratch -BOOT0=build/$ARCH/boot0 -BOOT1=build/$ARCH/boot1 -OUT=build/$ARCH/boot2 -STAGE=build/$ARCH/.boot2-stage +BOOT0=build/$ARCH/$DRIVER/boot0 +BOOT1=build/$ARCH/$DRIVER/boot1 +OUT=build/$ARCH/$DRIVER/boot2 +STAGE=build/$ARCH/$DRIVER/.boot2-stage require_prev "$BOOT0" catm require_prev "$BOOT1" M1pp hex2pp diff --git a/scripts/boot3.sh b/scripts/boot3.sh @@ -30,8 +30,8 @@ ## vendor/seed/$ARCH/ELF.hex2 — ELF header fragment ## ## ─── Inputs (binaries from prior stages) ────────────────────────────── -## build/$ARCH/boot1/{M1pp, hex2pp} — built by scripts/boot1.sh -## build/$ARCH/boot2/{catm, scheme1} — built by scripts/boot2.sh +## build/$ARCH/$DRIVER/boot1/{M1pp, hex2pp} — built by scripts/boot1.sh +## build/$ARCH/$DRIVER/boot2/{catm, scheme1} — built by scripts/boot2.sh ## ## ─── Tools ──────────────────────────────────────────────────────────── ## In container: scratch + busybox (no libc, no /etc, no resolver). @@ -42,8 +42,8 @@ ## asm step is required. ## ## ─── Outputs ────────────────────────────────────────────────────────── -## build/$ARCH/boot3/tcc0 — cc.scm-built bootstrap tcc, consumed by -## scripts/boot4.sh +## build/$ARCH/$DRIVER/boot3/tcc0 — cc.scm-built bootstrap tcc, consumed +## by scripts/boot4.sh ## ## Usage: scripts/boot3.sh <arch> ## <arch> ∈ {aarch64, amd64, riscv64} for either DRIVER (default podman). @@ -54,10 +54,10 @@ set -eu bootlib_init boot3 "${1:-}" driver_init empty -BOOT1=build/$ARCH/boot1 -BOOT2=build/$ARCH/boot2 -OUT=build/$ARCH/boot3 -STAGE=build/$ARCH/.boot3-stage +BOOT1=build/$ARCH/$DRIVER/boot1 +BOOT2=build/$ARCH/$DRIVER/boot2 +OUT=build/$ARCH/$DRIVER/boot3 +STAGE=build/$ARCH/$DRIVER/.boot3-stage TCC_VENDOR=build/$ARCH/vendor/tcc TCC_DIR=$TCC_VENDOR/tcc-0.9.26-1147-gee75a10c diff --git a/scripts/boot4.sh b/scripts/boot4.sh @@ -47,7 +47,7 @@ ## scripts/boot-hello.c — smoke binary ## ## ─── Inputs (binaries from prior stages) ────────────────────────────── -## build/$ARCH/boot3/tcc0 — built by scripts/boot3.sh +## build/$ARCH/$DRIVER/boot3/tcc0 — built by scripts/boot3.sh ## ## ─── Tools ──────────────────────────────────────────────────────────── ## In container: scratch + busybox (no libc, no /etc, no resolver). @@ -62,16 +62,16 @@ ## tcc-0.9.26 (see docs/TCC-ARM64-ASM.md). ## ## ─── Outputs ────────────────────────────────────────────────────────── -## build/$ARCH/boot4/tcc3 — final fixed-point self-host tcc -## build/$ARCH/boot4/crt1.o +## build/$ARCH/$DRIVER/boot4/tcc3 — final fixed-point self-host tcc +## build/$ARCH/$DRIVER/boot4/crt1.o ## — tcc2-built startup object, kept outside ## libc.a because it must lead link lines -## build/$ARCH/boot4/libc.a +## build/$ARCH/$DRIVER/boot4/libc.a ## — tcc2-built archive of sys_stubs.o + mem.o ## + libc.o -## build/$ARCH/boot4/libtcc1.a +## build/$ARCH/$DRIVER/boot4/libtcc1.a ## — tcc2-built tcc compiler helper archive -## build/$ARCH/boot4/hello — mes-libc-linked smoke binary +## build/$ARCH/$DRIVER/boot4/hello — mes-libc-linked smoke binary ## tcc2 and tcc3 are byte-identical (asserted at the end of this ## script) — that equality is the fixed-point check. ## @@ -90,10 +90,10 @@ case "$ARCH" in riscv64) LIBTCC1_C_SRCS="lib-arm64.c"; LIBTCC1_ASM_SRCS="" ;; esac -BOOT2=build/$ARCH/boot2 -BOOT3=build/$ARCH/boot3 -OUT=build/$ARCH/boot4 -STAGE=build/$ARCH/.boot4-stage +BOOT2=build/$ARCH/$DRIVER/boot2 +BOOT3=build/$ARCH/$DRIVER/boot3 +OUT=build/$ARCH/$DRIVER/boot4 +STAGE=build/$ARCH/$DRIVER/.boot4-stage TCC_VENDOR=build/$ARCH/vendor/tcc TCC_DIR=$TCC_VENDOR/tcc-0.9.26-1147-gee75a10c diff --git a/scripts/boot5.sh b/scripts/boot5.sh @@ -8,9 +8,9 @@ ## attribute(alias) weak refs, _Complex, x86_64 SSE/x87 inline asm). ## ## ─── Inputs ────────────────────────────────────────────────────────── -## build/$ARCH/boot4/tcc3 +## build/$ARCH/$DRIVER/boot4/tcc3 ## — boot4's verified self-host tcc -## build/$ARCH/boot4/libtcc1.a +## build/$ARCH/$DRIVER/boot4/libtcc1.a ## — boot4's tcc runtime archive ## vendor/upstream/musl-1.2.5.tar.gz ## — pristine musl source @@ -41,9 +41,9 @@ ## seed kernel). Same run.scm drives both. ## ## ─── Outputs ───────────────────────────────────────────────────────── -## build/$ARCH/boot5/libc.a -## build/$ARCH/boot5/{crt1.o, crti.o, crtn.o} -## build/$ARCH/boot5/hello — static, runs in the container +## build/$ARCH/$DRIVER/boot5/libc.a +## build/$ARCH/$DRIVER/boot5/{crt1.o, crti.o, crtn.o} +## build/$ARCH/$DRIVER/boot5/hello — static, runs in the container ## ## Usage: scripts/boot5.sh <arch> ## <arch> ∈ {amd64, aarch64, riscv64} for either DRIVER (default podman). @@ -54,10 +54,10 @@ set -eu bootlib_init boot5 "${1:-}" driver_init empty -BOOT2=build/$ARCH/boot2 -BOOT4=build/$ARCH/boot4 -OUT=build/$ARCH/boot5 -STAGE=build/$ARCH/.boot5-stage +BOOT2=build/$ARCH/$DRIVER/boot2 +BOOT4=build/$ARCH/$DRIVER/boot4 +OUT=build/$ARCH/$DRIVER/boot5 +STAGE=build/$ARCH/$DRIVER/.boot5-stage MUSL_TARBALL=vendor/upstream/musl-1.2.5.tar.gz MUSL_OVERRIDES=vendor/upstream/musl-1.2.5-overrides MUSL_DELETES=vendor/upstream/musl-1.2.5-deletes.txt diff --git a/scripts/boot6.sh b/scripts/boot6.sh @@ -6,9 +6,9 @@ ## amd64/riscv64 emit the ELF consumed by QEMU's -kernel path. ## ## ─── Inputs ────────────────────────────────────────────────────────── -## build/$ARCH/boot4/tcc3 — boot4's verified self-host tcc -## (compiler + linker) -## build/$ARCH/boot2/scheme1 — driver runtime +## build/$ARCH/$DRIVER/boot4/tcc3 — boot4's verified self-host tcc +## (compiler + linker) +## build/$ARCH/$DRIVER/boot2/scheme1 — driver runtime ## seed-kernel/arch/aarch64/kernel.S ## — boot stub, vector table, asm thunks, ## trailing 64 KB stack reserved as @@ -27,7 +27,7 @@ ## kernel). Same run.scm drives both. ## ## ─── Outputs ───────────────────────────────────────────────────────── -## build/$ARCH/boot6/Image — flat arm64 boot Image, byte-format +## build/$ARCH/$DRIVER/boot6/Image — flat arm64 boot Image, byte-format ## identical in shape to the gcc ## Makefile's `objcopy -O binary` ## output. QEMU's `-kernel` detects @@ -46,10 +46,10 @@ bootlib_init boot6 "${1:-}" driver_init empty OUT_FILE=$KERNEL_NAME -BOOT2=build/$ARCH/boot2 -BOOT4=build/$ARCH/boot4 -OUT=build/$ARCH/boot6 -STAGE=build/$ARCH/.boot6-stage +BOOT2=build/$ARCH/$DRIVER/boot2 +BOOT4=build/$ARCH/$DRIVER/boot4 +OUT=build/$ARCH/$DRIVER/boot6 +STAGE=build/$ARCH/$DRIVER/.boot6-stage # ── prerequisites ───────────────────────────────────────────────────── require_prev "$BOOT4" tcc3 diff --git a/scripts/lib-arch.sh b/scripts/lib-arch.sh @@ -71,7 +71,10 @@ driver_init() { export IMAGE ;; seed) - KERNEL_IMAGE=$ROOT/build/$ARCH/boot6/$KERNEL_NAME + # DRIVER=seed always consumes the podman-built boot6 kernel — + # tcc3 is platform-agnostic but we settled on a single canonical + # build location to reduce surface area. See docs/PLAN.md A3. + KERNEL_IMAGE=$ROOT/build/$ARCH/podman/boot6/$KERNEL_NAME EXTRACT=$ROOT/seed-kernel/scripts/extract-blk.sh [ -f "$KERNEL_IMAGE" ] || { echo "[$BOOT_TAG] missing $KERNEL_IMAGE — run ./scripts/boot.sh $ARCH (default DRIVER=podman) first" >&2 diff --git a/scripts/seed-accept-boot34.sh b/scripts/seed-accept-boot34.sh @@ -1,20 +1,19 @@ #!/bin/sh ## seed-accept-boot34.sh — acceptance: run boot3 (then optionally boot4) ## under DRIVER=seed and assert byte-identical outputs vs build/aarch64/ -## bootN/'s podman-built artefacts. +## podman/bootN/'s podman-built artefacts. ## ## Prereqs (build first): -## - build/aarch64/boot6/Image (run ./scripts/boot.sh aarch64 -## under DRIVER=podman to produce the tcc-built seed kernel) -## - build/aarch64/boot{0,1,2,3,4}/ (same boot.sh run populates these -## references) +## - build/aarch64/podman/boot{0..6}/ (run ./scripts/boot.sh aarch64 +## under DRIVER=podman to populate these — boot6/Image becomes the +## tcc-built seed kernel) ## ## What it does: -## 1. Stash existing podman-built build/aarch64/boot{3,4}/ as ref/. -## 2. DRIVER=seed scripts/boot3.sh aarch64 — one qemu boot, scheme1 +## 1. DRIVER=seed scripts/boot3.sh aarch64 — one qemu boot, scheme1 ## drives cc.scm → tcc0 from a generated run.scm. -## 3. cmp -s tcc0 vs ref tcc0; fail on diff. -## 4. If $WITH_BOOT4=1, repeat for boot4 (tcc0 → tcc1 → tcc2 → tcc3, +## 2. cmp -s build/$ARCH/seed/boot3/tcc0 vs build/$ARCH/podman/boot3/tcc0; +## fail on diff. +## 3. If $WITH_BOOT4=1, repeat for boot4 (tcc0 → tcc1 → tcc2 → tcc3, ## with tcc2 == tcc3 fixed-point asserted). ## ## Usage: scripts/seed-accept-boot34.sh @@ -26,21 +25,19 @@ ARCH=aarch64 ROOT=$(cd "$(dirname "$0")/.." && pwd) cd "$ROOT" -KERNEL=build/$ARCH/boot6/Image +PODMAN=build/$ARCH/podman +SEED=build/$ARCH/seed +KERNEL=$PODMAN/boot6/Image [ -f "$KERNEL" ] || { echo "missing $KERNEL — run ./scripts/boot.sh $ARCH (default DRIVER=podman) first" >&2; exit 1; } -[ -x build/$ARCH/boot3/tcc0 ] || { echo "build/$ARCH/boot3/tcc0 missing — run scripts/boot3.sh aarch64" >&2; exit 1; } - -REF=build/$ARCH/.seed-ref -rm -rf "$REF"; mkdir -p "$REF" -cp build/$ARCH/boot3/tcc0 "$REF/tcc0.podman" +[ -x $PODMAN/boot3/tcc0 ] || { echo "$PODMAN/boot3/tcc0 missing — run scripts/boot3.sh aarch64" >&2; exit 1; } echo "[seed-accept-boot34] boot3: DRIVER=seed scripts/boot3.sh $ARCH" DRIVER=seed scripts/boot3.sh $ARCH -if ! cmp -s build/$ARCH/boot3/tcc0 "$REF/tcc0.podman"; then - s_seed=$(wc -c < build/$ARCH/boot3/tcc0) - s_ref=$(wc -c < "$REF/tcc0.podman") - echo "[seed-accept-boot34] boot3 FAIL: tcc0 differs (seed=$s_seed ref=$s_ref)" >&2 +if ! cmp -s $SEED/boot3/tcc0 $PODMAN/boot3/tcc0; then + s_seed=$(wc -c < $SEED/boot3/tcc0) + s_ref=$(wc -c < $PODMAN/boot3/tcc0) + echo "[seed-accept-boot34] boot3 FAIL: tcc0 differs (seed=$s_seed podman=$s_ref)" >&2 exit 3 fi echo "[seed-accept-boot34] boot3 PASS — tcc0 byte-identical vs podman" @@ -49,12 +46,7 @@ if [ "${WITH_BOOT4:-0}" != 1 ]; then exit 0 fi -[ -x build/$ARCH/boot4/tcc3 ] || { echo "build/$ARCH/boot4/tcc3 missing — run scripts/boot4.sh aarch64 under podman first" >&2; exit 1; } -cp build/$ARCH/boot4/tcc3 "$REF/tcc3.podman" -cp build/$ARCH/boot4/libc.a "$REF/libc.a.podman" -cp build/$ARCH/boot4/libtcc1.a "$REF/libtcc1.a.podman" -cp build/$ARCH/boot4/crt1.o "$REF/crt1.o.podman" -cp build/$ARCH/boot4/hello "$REF/hello.podman" +[ -x $PODMAN/boot4/tcc3 ] || { echo "$PODMAN/boot4/tcc3 missing — run scripts/boot4.sh aarch64 under podman first" >&2; exit 1; } echo "[seed-accept-boot34] boot4: DRIVER=seed scripts/boot4.sh $ARCH" DRIVER=seed scripts/boot4.sh $ARCH @@ -66,10 +58,10 @@ fail=0 # mount prefix from STT_FILE entries, so seed's flat-basename staging # and podman's /work/in/ mounts produce identical .o relocations. for f in tcc3 hello crt1.o libc.a libtcc1.a; do - if ! cmp -s build/$ARCH/boot4/$f "$REF/$f.podman"; then - s_seed=$(wc -c < build/$ARCH/boot4/$f) - s_ref=$(wc -c < "$REF/$f.podman") - echo "[seed-accept-boot34] boot4 DIFF $f: seed=$s_seed ref=$s_ref" >&2 + if ! cmp -s $SEED/boot4/$f $PODMAN/boot4/$f; then + s_seed=$(wc -c < $SEED/boot4/$f) + s_ref=$(wc -c < $PODMAN/boot4/$f) + echo "[seed-accept-boot34] boot4 DIFF $f: seed=$s_seed podman=$s_ref" >&2 fail=1 fi done diff --git a/scripts/seed-accept-boot5.sh b/scripts/seed-accept-boot5.sh @@ -1,20 +1,18 @@ #!/bin/sh ## seed-accept-boot5.sh — acceptance: run boot5 under DRIVER=seed and -## assert byte-identical outputs vs build/aarch64/boot5/'s podman-built -## artefacts. Mirrors scripts/seed-accept-boot34.sh. +## assert byte-identical outputs vs build/aarch64/podman/boot5/'s +## podman-built artefacts. Mirrors scripts/seed-accept-boot34.sh. ## ## Prereqs (build first): -## - build/aarch64/boot6/Image (run ./scripts/boot.sh aarch64 -## under DRIVER=podman to produce the tcc-built seed kernel) -## - build/aarch64/boot{0..5}/ (same boot.sh run populates these -## references) +## - build/aarch64/podman/boot{0..6}/ (run ./scripts/boot.sh aarch64 +## under DRIVER=podman to populate these — boot6/Image becomes the +## tcc-built seed kernel) ## ## What it does: -## 1. Stash existing podman-built build/aarch64/boot5/ as ref/. -## 2. DRIVER=seed scripts/boot5.sh aarch64 — one qemu boot, scheme1 +## 1. DRIVER=seed scripts/boot5.sh aarch64 — one qemu boot, scheme1 ## drives ~1300 (run "tcc" …) calls from a generated run.scm. -## 3. cmp -s each output (libc.a, crt1.o, crti.o, crtn.o, hello) vs -## the podman reference; fail on diff. +## 2. cmp -s each output (libc.a, crt1.o, crti.o, crtn.o, hello) vs +## the podman reference at build/$ARCH/podman/boot5/; fail on diff. ## ## Usage: scripts/seed-accept-boot5.sh @@ -24,28 +22,26 @@ ARCH=aarch64 ROOT=$(cd "$(dirname "$0")/.." && pwd) cd "$ROOT" -KERNEL=build/$ARCH/boot6/Image +PODMAN=build/$ARCH/podman +SEED=build/$ARCH/seed +KERNEL=$PODMAN/boot6/Image [ -f "$KERNEL" ] || { echo "missing $KERNEL — run ./scripts/boot.sh $ARCH (default DRIVER=podman) first" >&2; exit 1; } -[ -d build/$ARCH/boot5 ] || { echo "build/$ARCH/boot5 missing — run scripts/boot5.sh aarch64" >&2; exit 1; } +[ -d $PODMAN/boot5 ] || { echo "$PODMAN/boot5 missing — run scripts/boot5.sh aarch64" >&2; exit 1; } for f in libc.a crt1.o crti.o crtn.o hello; do - [ -e build/$ARCH/boot5/$f ] || { echo "build/$ARCH/boot5/$f missing — run scripts/boot5.sh aarch64" >&2; exit 1; } + [ -e $PODMAN/boot5/$f ] || { echo "$PODMAN/boot5/$f missing — run scripts/boot5.sh aarch64" >&2; exit 1; } done -REF=build/$ARCH/boot5-ref -rm -rf "$REF" -cp -R build/$ARCH/boot5 "$REF" - echo "[seed-accept-boot5] DRIVER=seed scripts/boot5.sh $ARCH" DRIVER=seed scripts/boot5.sh $ARCH fails=0 for f in libc.a crt1.o crti.o crtn.o hello; do - seed_size=$(wc -c < build/$ARCH/boot5/$f) - ref_size=$(wc -c < $REF/$f) - if cmp -s build/$ARCH/boot5/$f $REF/$f; then + seed_size=$(wc -c < $SEED/boot5/$f) + ref_size=$(wc -c < $PODMAN/boot5/$f) + if cmp -s $SEED/boot5/$f $PODMAN/boot5/$f; then echo "[seed-accept-boot5] $f: byte-identical ($seed_size bytes)" else - echo "[seed-accept-boot5] $f: DIFF (seed=$seed_size ref=$ref_size)" + echo "[seed-accept-boot5] $f: DIFF (seed=$seed_size podman=$ref_size)" fails=$((fails + 1)) fi done diff --git a/scripts/seed-accept.sh b/scripts/seed-accept.sh @@ -23,10 +23,11 @@ ARCH=aarch64 ROOT=$(cd "$(dirname "$0")/.." && pwd) cd "$ROOT" -KERNEL=build/$ARCH/boot6/Image +PODMAN=build/$ARCH/podman +KERNEL=$PODMAN/boot6/Image EXTRACT=seed-kernel/scripts/extract-blk.sh -SCHEME1=build/$ARCH/boot2/scheme1 -CATM=build/$ARCH/boot2/catm +SCHEME1=$PODMAN/boot2/scheme1 +CATM=$PODMAN/boot2/catm PRELUDE=scheme1/prelude.scm [ -f "$KERNEL" ] || { echo "missing $KERNEL — run ./scripts/boot.sh $ARCH (default DRIVER=podman) first" >&2; exit 1; }