summaryrefslogtreecommitdiffstats
path: root/scripts/qemu.sh
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-01 15:53:29 +0100
committersalmonik <salmonik@tuta.io>2026-11-01 15:53:29 +0100
commit7958276c9f0d230053520ba20f2a00f5ecda18e4 (patch)
tree596f5f71ad597ed951bae98de818cb37f171a18d /scripts/qemu.sh
parentfs: /bin alias for the system volume (diff)
downloadrs-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-xscripts/qemu.sh99
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# =============================================================================
16set -euo pipefail
17
18SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
19PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
20cd "$PROJECT_DIR"
21
22# Defaults
23GUI_FLAG=""
24DEBUG_FLAG=""
25CHAIN_FLAG=""
26OVMF="${OVMF:-/usr/share/edk2/x64/OVMF.4m.fd}"
27MEM="${MEM:-256M}"
28SMP="${SMP:-1}"
29SYSTEM_IMG="${SYSTEM_IMG:-/tmp/system.img}"
30
31# Pre-build
32make all
33
34# Parse args
35while [ $# -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
71done
72
73# Stage system image if needed
74if [ -n "$CHAIN_FLAG" ]; then
75 ./scripts/mksystem.sh --chain --gpt "$SYSTEM_IMG"
76else
77 ./scripts/mksystem.sh "$SYSTEM_IMG"
78fi
79
80echo ""
81echo "=== Booting ==="
82echo " image: $SYSTEM_IMG"
83echo " ovmf: $OVMF"
84echo " mem: $MEM smp: $SMP"
85echo " gui: $([ -n "$GUI_FLAG" ] && echo yes || echo no)"
86echo " gdb: $([ -n "$DEBUG_FLAG" ] && echo ':1234' || echo off)"
87echo ""
88
89exec 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