#!/usr/bin/env bash # Cargo runner (see .cargo/config.toml): `cargo run` calls this with the # kernel ELF path followed by any extra args. # # Why not call `bootimage runner` directly? When you switch cargo features # (e.g. --features headless and back), cargo re-uses an older kernel binary # with an *old* timestamp, so bootimage thinks its cached disk image is still # up to date and boots the wrong kernel. Touching the ELF forces a rebuild. # # Stage 21: it also runs from the repository root, so the relative paths in # Cargo.toml (scripts/qemu.sh, tests/hvc0-input.txt...) work wherever you # typed `cargo run`. set -euo pipefail kernel=$(realpath "$1") shift touch "$kernel" cd "$(dirname "$0")/.." exec bootimage runner "$kernel" "$@"