summaryrefslogtreecommitdiffstats
path: root/scripts/test-disk.sh
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-08-21 19:13:52 +0200
committersalmonik <salmonik@tuta.io>2026-08-21 19:13:52 +0200
commit298528581d1a29032a1224600297316384d4e4f7 (patch)
treef9a7a320567f5cd88cd3f322fcab0be16418be2c /scripts/test-disk.sh
parentdocs: ADR 0006 (executable binaries) + implementation plan + glossary terms (diff)
downloadrs-dos-298528581d1a29032a1224600297316384d4e4f7.tar.gz
rs-dos-298528581d1a29032a1224600297316384d4e4f7.zip
image: single dd-able system.img replaces vvfat+data-disk pair
mksystem.sh stages one FAT32 image: \bzImage + \initramfs.cpio.gz (rsbl paths), \EFI\BOOT\BOOTX64.EFI (kernel direct by default, --chain for rsboot), \etc\motd.txt, empty \bin\cli + \bin\gui, seed files at the root. --gpt wraps it in a partition table for real USB dd targets. Makefile: run/run-gui/debug attach only system.img on ide.0 (vvfat lines deleted); stamp-based 'system' target rebuilds only when the kernel is newer, so runtime writes survive reboots; system-fresh wipes; inspect lists via mtools. build-image.sh/mkdisk.sh removed. test-disk.sh boots system.img with a throwaway OVMF varstore — a stale NvVars makes the firmware skip the \EFI\BOOT fallback. sendkeys.py pacing 50ms->250ms/1.5s: keystroke loss under host load corrupted typed lines (guest-side PS/2 ring overflow). Gate: test-disk PASS (fsck clean, file survives poweroff).
Diffstat (limited to '')
-rwxr-xr-xscripts/test-disk.sh20
1 files changed, 10 insertions, 10 deletions
diff --git a/scripts/test-disk.sh b/scripts/test-disk.sh
index 0268fff..9ffb3c8 100755
--- a/scripts/test-disk.sh
+++ b/scripts/test-disk.sh
@@ -26,7 +26,7 @@ FRESH=0
26 26
27OVMF="${OVMF:-/usr/share/edk2/x64/OVMF.4m.fd}" 27OVMF="${OVMF:-/usr/share/edk2/x64/OVMF.4m.fd}"
28QEMU="${QEMU:-qemu-system-x86_64}" 28QEMU="${QEMU:-qemu-system-x86_64}"
29IMG="${DISK_IMG:-/tmp/disk.img}" 29IMG="${SYSTEM_IMG:-/tmp/system.img}"
30ESP_DIR="$PROJECT_DIR/esp" 30ESP_DIR="$PROJECT_DIR/esp"
31QPID=/tmp/rsdos-test-qpid 31QPID=/tmp/rsdos-test-qpid
32SOCK=/tmp/rsdos-test-qmon.sock 32SOCK=/tmp/rsdos-test-qmon.sock
@@ -69,29 +69,29 @@ wait_qemu_exit() {
69echo "==> 1/6 build kernel (debug)" 69echo "==> 1/6 build kernel (debug)"
70cargo build --package rsdos --target x86_64-unknown-uefi 70cargo build --package rsdos --target x86_64-unknown-uefi
71 71
72echo "==> 2/6 deploy to ESP + ensure disk image" 72echo "==> 2/6 ensure system image"
73mkdir -p "$ESP_DIR/EFI/BOOT"
74cp target/x86_64-unknown-uefi/debug/rsdos.efi "$ESP_DIR/EFI/BOOT/BOOTX64.EFI"
75if [ "$FRESH" -eq 1 ]; then 73if [ "$FRESH" -eq 1 ]; then
76 "$SCRIPT_DIR/mkdisk.sh" --fresh "$IMG" 74 "$SCRIPT_DIR/mksystem.sh" --force "$IMG"
77else 75else
78 "$SCRIPT_DIR/mkdisk.sh" "$IMG" 76 "$SCRIPT_DIR/mksystem.sh" "$IMG"
79fi 77fi
80 78
81echo "==> 3/6 boot QEMU (headless)" 79echo "==> 3/6 boot QEMU (headless)"
82kill "$(cat "$QPID" 2>/dev/null)" 2>/dev/null || true 80kill "$(cat "$QPID" 2>/dev/null)" 2>/dev/null || true
83sleep 1 81sleep 1
84rm -f "$SOCK" "$LOG" 82rm -f "$SOCK" "$LOG"
85"$QEMU" -bios "$OVMF" \ 83# Throwaway OVMF varstore: a stale/poisoned NvVars (e.g. left by the old
84# vvfat setup) makes the firmware skip the \EFI\BOOT fallback entirely.
85NV="/tmp/rsdos-test-ovmf-vars.fd"
86rm -f "$NV"
87cp /usr/share/edk2/x64/OVMF.4m.fd "$NV"
88"$QEMU" -bios "$NV" \
86 -drive file="$IMG",format=raw,if=none,id=disk \ 89 -drive file="$IMG",format=raw,if=none,id=disk \
87 -device ide-hd,drive=disk,bus=ide.0 \ 90 -device ide-hd,drive=disk,bus=ide.0 \
88 -drive file=fat:rw:"$ESP_DIR",format=raw,if=none,id=esp \
89 -device ide-hd,drive=esp,bus=ide.1 \
90 -serial file:"$LOG" \ 91 -serial file:"$LOG" \
91 -monitor unix:"$SOCK",server,nowait \ 92 -monitor unix:"$SOCK",server,nowait \
92 -m 256M -machine q35 -cpu qemu64 -no-reboot -display none \ 93 -m 256M -machine q35 -cpu qemu64 -no-reboot -display none \
93 >"$QLOG" 2>&1 & 94 >"$QLOG" 2>&1 &
94echo $! >"$QPID"
95 95
96wait_log "$LOG" "boot: entering shell" 90 || fail "kernel never reached the shell" 96wait_log "$LOG" "boot: entering shell" 90 || fail "kernel never reached the shell"
97sleep 1 97sleep 1