boot.sh (2017B)
1 #!/bin/sh 2 ## boot.sh — drive boot0 → boot7 end-to-end under one driver. 3 4 set -eu 5 6 case "${1:-}" in 7 -h|--help) 8 cat <<'EOF' 9 boot.sh — drive the implemented bootstrap chain under one driver. 10 11 Usage: 12 boot/boot.sh <aarch64|amd64|riscv64|riscv32> 13 14 RV32 currently runs boot0 → boot2. Its TCC target (boot3+) is deliberately 15 left unimplemented. 16 17 Environment variables (all optional): 18 DRIVER podman (default) | seed. 19 podman: containerised builds. 20 seed: builds run inside the tcc-built 21 seed kernel under qemu (requires 22 one prior DRIVER=podman pass to 23 mint build/$ARCH/podman/boot6/). 24 BOOT3_TIMEOUT (default 1800) boot3 (scheme1) wall-clock seconds. 25 BOOT4_TIMEOUT (default 5400) boot4 (tcc1/2/3) wall-clock seconds. 26 BOOT5_TIMEOUT (default 7200) boot5 (musl) wall-clock seconds. 27 BOOT6_TIMEOUT (default 1200) boot6 (kernel) wall-clock seconds. 28 QEMU_MEM (default 3072M) guest RAM passed to the seed-driver qemu. 29 EOF 30 exit 0 31 ;; 32 esac 33 34 . boot/lib-arch.sh 35 bootlib_init boot "${1:-}" 36 37 if [ "$DRIVER" = seed ]; then 38 KERNEL=build/$ARCH/podman/boot6/$KERNEL_NAME 39 if [ ! -f "$KERNEL" ]; then 40 echo "[$BOOT_TAG] missing $KERNEL" >&2 41 echo "[$BOOT_TAG] run './boot/boot.sh $ARCH' first (default DRIVER=podman) to produce it" >&2 42 exit 1 43 fi 44 fi 45 46 47 # Boot stages read source from build/$ARCH/src/ exclusively. 48 ./bootprep/prep-src.sh $ARCH 49 50 rm -rf build/$ARCH/$DRIVER 51 ./boot/boot0.sh $ARCH 52 ./boot/boot1.sh $ARCH 53 ./boot/boot2.sh $ARCH 54 if [ "$TCC_SUPPORTED" != 1 ]; then 55 echo "[$BOOT_TAG] OK: RV32 bootstrap completed through boot2; TCC support (boot3+) is intentionally unimplemented" 56 exit 0 57 fi 58 ./boot/boot3.sh $ARCH 59 ./boot/boot4.sh $ARCH 60 ./boot/boot5.sh $ARCH 61 ./boot/boot6.sh $ARCH 62 ./boot/boot7.sh $ARCH