diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-01 15:53:29 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-01 15:53:29 +0100 |
| commit | 7958276c9f0d230053520ba20f2a00f5ecda18e4 (patch) | |
| tree | 596f5f71ad597ed951bae98de818cb37f171a18d /scripts/qemu.sh | |
| parent | fs: /bin alias for the system volume (diff) | |
| download | rs-dos-7958276c9f0d230053520ba20f2a00f5ecda18e4.tar.gz rs-dos-7958276c9f0d230053520ba20f2a00f5ecda18e4.zip | |
scripts: rebuild the dev loop around build.sh/run.sh
`make` did not parse at all (missing separator at line 139), so every
make target was dead. The folder also carried three overlapping
launchers (boot.sh, qemu.sh, boot-image.sh) plus a fourth partial one
in the Makefile, `cargo build --package rsdos` copy-pasted eight times,
the QEMU invocation copy-pasted per script, and the test helpers
(fail/wait_log/wait_qemu_exit/qemu_hmp) duplicated in five tests.
New layout:
- scripts/lib.sh: single config (image, OVMF, mem/smp), the one cargo
invocation (build_all), the one QEMU shape (qemu_args), and the test
harness (test_boot, wait_log, wait_qemu_exit, qemu_hmp, sendkeys)
- scripts/build.sh: kernel + every bins/* in one pass
- scripts/mksystem.sh: freshness-aware image build that now stages
every bins/*.efi into /bin/cli|gui (they were never copied before)
- scripts/run.sh: build + stage + boot in one command; --headless,
--debug (GDB stub), --monitor (HMP socket), --fresh, --mem/--smp/
--bios/--image; on Wayland it auto-selects XWayland plus
grab-on-hover so the mouse can be captured (Ctrl+Alt+G toggles)
- scripts/tests/: the five automated tests on the shared harness
- deleted: boot.sh, qemu.sh, boot-image.sh, lib-boot-args.sh,
build-image-release.sh, build-bootloader.sh (rsboot chain dropped)
The Makefile is now a thin wrapper: make run, make test, make system,
make inspect, make help. Two-command flow: ./scripts/build.sh then
./scripts/run.sh (run.sh alone also works).
Stale test assumptions fixed so the suite is green again: test-gfx
waited for "gfx: check" while the shell prints "gfx check: PASS";
test-mouse/test-msg hardcoded msgrecv = task 3 (wm-input took slot 3 —
ids are parsed from the log now); the queue-full probe targeted task 0,
whose exec pump drains its own queue as completion codes (moved to the
cursor task, which never recvs).
Verified in QEMU: make test -> test-disk, test-gfx, test-mouse,
test-msg, test-fault all PASS.
Diffstat (limited to 'scripts/qemu.sh')
| -rwxr-xr-x | scripts/qemu.sh | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/scripts/qemu.sh b/scripts/qemu.sh deleted file mode 100755 index eeaf4de..0000000 --- a/scripts/qemu.sh +++ /dev/null | |||
| @@ -1,99 +0,0 @@ | |||
| 1 | #!/usr/bin/env bash | ||
| 2 | # ============================================================================= | ||
| 3 | # scripts/qemu.sh — flexible QEMU launcher for rs-dos | ||
| 4 | # | ||
| 5 | # Usage: | ||
| 6 | # ./scripts/qemu.sh # serial console (no graphics) | ||
| 7 | # ./scripts/qemu.sh --gui # graphical window | ||
| 8 | # ./scripts/qemu.sh --debug # GDB stub on :1234 | ||
| 9 | # ./scripts/qemu.sh --chain # full boot chain (firmware → rsboot → rsnix) | ||
| 10 | # ./scripts/qemu.sh --bios /path/to.fd # custom OVMF | ||
| 11 | # ./scripts/qemu.sh --mem 512M # memory size | ||
| 12 | # ./scripts/qemu.sh --smp 2 # SMP cores | ||
| 13 | # | ||
| 14 | # One image, one drive — the system image contains kernel + ESP + data. | ||
| 15 | # ============================================================================= | ||
| 16 | set -euo pipefail | ||
| 17 | |||
| 18 | SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
| 19 | PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" | ||
| 20 | cd "$PROJECT_DIR" | ||
| 21 | |||
| 22 | # Defaults | ||
| 23 | GUI_FLAG="" | ||
| 24 | DEBUG_FLAG="" | ||
| 25 | CHAIN_FLAG="" | ||
| 26 | OVMF="${OVMF:-/usr/share/edk2/x64/OVMF.4m.fd}" | ||
| 27 | MEM="${MEM:-256M}" | ||
| 28 | SMP="${SMP:-1}" | ||
| 29 | SYSTEM_IMG="${SYSTEM_IMG:-/tmp/system.img}" | ||
| 30 | |||
| 31 | # Pre-build | ||
| 32 | make all | ||
| 33 | |||
| 34 | # Parse args | ||
| 35 | while [ $# -gt 0 ]; do | ||
| 36 | case "$1" in | ||
| 37 | --gui | -g) | ||
| 38 | GUI_FLAG="-vga std" | ||
| 39 | shift | ||
| 40 | ;; | ||
| 41 | --debug | -d) | ||
| 42 | DEBUG_FLAG="-s -S" | ||
| 43 | shift | ||
| 44 | ;; | ||
| 45 | --chain | -c) | ||
| 46 | CHAIN_FLAG=1 | ||
| 47 | SYSTEM_IMG="${SYSTEM_IMG:-rs-dos.img}" | ||
| 48 | shift | ||
| 49 | ;; | ||
| 50 | --image | -i) | ||
| 51 | SYSTEM_IMG="$2" | ||
| 52 | shift 2 | ||
| 53 | ;; | ||
| 54 | --bios | -b) | ||
| 55 | OVMF="$2" | ||
| 56 | shift 2 | ||
| 57 | ;; | ||
| 58 | --mem) | ||
| 59 | MEM="$2" | ||
| 60 | shift 2 | ||
| 61 | ;; | ||
| 62 | --smp) | ||
| 63 | SMP="$2" | ||
| 64 | shift 2 | ||
| 65 | ;; | ||
| 66 | *) | ||
| 67 | echo "unknown: $1" | ||
| 68 | exit 1 | ||
| 69 | ;; | ||
| 70 | esac | ||
| 71 | done | ||
| 72 | |||
| 73 | # Stage system image if needed | ||
| 74 | if [ -n "$CHAIN_FLAG" ]; then | ||
| 75 | ./scripts/mksystem.sh --chain --gpt "$SYSTEM_IMG" | ||
| 76 | else | ||
| 77 | ./scripts/mksystem.sh "$SYSTEM_IMG" | ||
| 78 | fi | ||
| 79 | |||
| 80 | echo "" | ||
| 81 | echo "=== Booting ===" | ||
| 82 | echo " image: $SYSTEM_IMG" | ||
| 83 | echo " ovmf: $OVMF" | ||
| 84 | echo " mem: $MEM smp: $SMP" | ||
| 85 | echo " gui: $([ -n "$GUI_FLAG" ] && echo yes || echo no)" | ||
| 86 | echo " gdb: $([ -n "$DEBUG_FLAG" ] && echo ':1234' || echo off)" | ||
| 87 | echo "" | ||
| 88 | |||
| 89 | exec qemu-system-x86_64 \ | ||
| 90 | -bios "$OVMF" \ | ||
| 91 | -drive "file=$SYSTEM_IMG,format=raw,if=none,id=hd" \ | ||
| 92 | -device ide-hd,drive=hd \ | ||
| 93 | -serial stdio \ | ||
| 94 | -m "$MEM" \ | ||
| 95 | -machine q35 \ | ||
| 96 | -cpu qemu64 \ | ||
| 97 | -no-reboot \ | ||
| 98 | -smp "$SMP" \ | ||
| 99 | $GUI_FLAG $DEBUG_FLAG | ||
