summaryrefslogtreecommitdiffstats
path: root/scripts/qemu.sh
diff options
context:
space:
mode:
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