blob: f70dcd49f0c1fcb7d3c9ca6e7e5c12231ff2c81a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#!/usr/bin/env bash
#
# scripts/boot-image.sh — boot rs-dos full chain disk image in QEMU
#
# Builds the image first if needed, then boots with UEFI firmware through
# the real boot chain: firmware → rsboot → rsnix kernel.
#
# Usage:
# ./scripts/boot-image.sh [--gui] [--debug] [--mem 512M] [--smp 2]
#
# Keybindings:
# Ctrl-A X — quit
# Ctrl-A C — QEMU monitor
#
# Environment:
# OVMF path to OVMF firmware (default: /usr/share/edk2/x64/OVMF.4m.fd)
# MEM memory size (default: 256M)
# SMP CPU count (default: 1)
#
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$PROJECT_DIR"
IMAGE="${1:-rs-dos.img}"
# ---- config ----
OVMF="${OVMF:-/usr/share/edk2/x64/OVMF.4m.fd}"
MEM="${MEM:-256M}"
SMP="${SMP:-1}"
GUI=""
DEBUG=""
# ---- args ----
source "$SCRIPT_DIR/lib-boot-args.sh"
parse_boot_args "$@"
# ---- build image if missing ----
if [ ! -f "$IMAGE" ]; then
echo "Image not found, building..."
"$SCRIPT_DIR/mksystem.sh" --chain --gpt "$IMAGE"
fi
# ---- boot ----
echo ""
echo "=== Booting (full chain: firmware → rsboot → rsnix) ==="
echo " image: $IMAGE"
echo " ovmf: $OVMF"
echo " mem: $MEM smp: $SMP"
echo " gui: $([ -n "$GUI" ] && echo yes || echo no)"
echo " gdb: $([ -n "$DEBUG" ] && echo ':1234' || echo off)"
echo ""
exec qemu-system-x86_64 \
-bios "$OVMF" \
-drive file="$IMAGE",format=raw,if=none,id=hd \
-device ide-hd,drive=hd \
-serial stdio \
-m "$MEM" \
-machine q35 \
-cpu qemu64 \
-no-reboot \
-smp "$SMP" \
$GUI $DEBUG
|