#!/usr/bin/env bash # Boot the normal (non-headless) kernel with no window, "type" some keys into # it through the QEMU monitor's `sendkey` command, then dump the VGA screen to # a PNG. Doubles as an automated keyboard-interrupt test: the typed text is # echoed on the serial port too, so we can grep for it. # # Usage: ./scripts/screenshot.sh [out.png] [text-to-type] [expected-result] # In text-to-type, "<" means Backspace. The default types a typo and fixes it. set -euo pipefail cd "$(dirname "$0")/.." cargo build # Force bootimage to repack the disk image (see scripts/runner.sh for why). touch target/x86_64-rust_kernel/debug/rust_kernel cargo bootimage IMG=target/x86_64-rust_kernel/debug/bootimage-rust_kernel.bin OUT="${1:-$PWD/boot.png}" TEXT="${2:-Hello, kernex '$EXPECT'" else echo "[screenshot] keyboard echo NOT found (expected '$EXPECT')" fi rm -f "$SERIAL_LOG" echo "[screenshot] saved $OUT"