boot0.sh (2304B)
1 #!/bin/sh 2 ## boot0.sh — seed bootstrap: hex0-seed → hex0 → hex1 → hex2 → catm → M0. 3 ## 4 ## Stage 0 of the README's chain. From the ~400-byte vendored hex0-seed, 5 ## brings up the three binaries every later stage depends on (hex2, catm, 6 ## M0). 7 ## 8 ## ─── Inputs (sources, from canonical tree) ─────────────────────────── 9 ## build/$ARCH/src/bin/hex0-seed 10 ## build/$ARCH/src/src/stage0-posix/{hex0.hex0, hex1.hex0, hex2.hex1, 11 ## catm.hex2, M0.hex2, ELF.hex2} 12 ## 13 ## ─── Outputs ────────────────────────────────────────────────────────── 14 ## build/$ARCH/$DRIVER/boot0/{hex2, catm, M0} 15 ## 16 ## Usage: boot/boot0.sh <arch> 17 ## <arch> ∈ {aarch64, amd64, riscv64} for either DRIVER (default podman). 18 19 set -eu 20 21 . boot/lib-arch.sh 22 bootlib_init boot0 "${1:-}" 23 driver_init busybox 24 require_src 25 26 . boot/lib-pipeline.sh 27 pipeline_init "$STAGE" "$OUT" "$DRIVER" 28 29 # ─── inputs (from canonical src tree) ───────────────────────────────── 30 pipeline_input hex0-seed "build/$ARCH/src/bin/hex0-seed" 31 for f in hex0.hex0 hex1.hex0 hex2.hex1 catm.hex2 M0.hex2 ELF.hex2; do 32 pipeline_input_from_src "stage0-posix/$f" 33 done 34 35 # ─── pipeline ───────────────────────────────────────────────────────── 36 echo "[$BOOT_TAG] hex0-seed -> hex0 -> hex1 -> hex2 -> catm -> M0" 37 38 stage hex0-seed hex0.hex0 hex0 -- hex0.hex0 -- hex0 39 stage hex0 hex1.hex0 hex1 -- hex1.hex0 -- hex1 40 stage hex1 hex2.hex1 hex2 -- hex2.hex1 -- hex2 41 stage hex2 catm.hex2 catm -- catm.hex2 -- catm 42 stage catm M0.combined.hex2 ELF.hex2 M0.hex2 -- ELF.hex2 M0.hex2 -- M0.combined.hex2 43 stage hex2 M0.combined.hex2 M0 -- M0.combined.hex2 -- M0 44 45 pipeline_export hex2 catm M0 46 pipeline_run 47 48 echo "[$BOOT_TAG] OK -> $OUT/{hex2, catm, M0}"