summaryrefslogtreecommitdiffstats
path: root/scripts/boot.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xscripts/boot.sh90
1 files changed, 0 insertions, 90 deletions
diff --git a/scripts/boot.sh b/scripts/boot.sh
deleted file mode 100755
index cb017d8..0000000
--- a/scripts/boot.sh
+++ /dev/null
@@ -1,90 +0,0 @@
1#!/usr/bin/env bash
2#
3# scripts/boot.sh — quick direct boot in QEMU (dev loop)
4#
5# Builds the kernel, stages the system image, and boots directly as
6# BOOTX64.EFI via QEMU's FAT driver. One image = one drive.
7#
8# Usage:
9# ./scripts/boot.sh [--gui] [--debug] [--release] [--mem 512M] [--smp 2]
10#
11# Boot chain: firmware → rsnix (direct)
12# Full chain: use ./scripts/boot-image.sh (firmware → rsboot → rsnix)
13#
14# Keybindings:
15# Ctrl-A X — quit
16# Ctrl-A C — QEMU monitor
17#
18# Environment:
19# OVMF path to OVMF firmware (default: /usr/share/edk2/x64/OVMF.4m.fd)
20# MEM memory size (default: 256M)
21# SMP CPU count (default: 1)
22# SYSTEM_IMG system image path (default: /tmp/system.img)
23#
24set -euo pipefail
25
26SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
27PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
28cd "$PROJECT_DIR"
29
30# ---- config ----
31OVMF="${OVMF:-/usr/share/edk2/x64/OVMF.4m.fd}"
32MEM="${MEM:-256M}"
33SMP="${SMP:-1}"
34SYSTEM_IMG="${SYSTEM_IMG:-/tmp/system.img}"
35PROFILE="release"
36
37GUI=""
38DEBUG=""
39
40# ---- args ----
41source "$SCRIPT_DIR/lib-boot-args.sh"
42handle_arg() {
43 case "$1" in
44 --debug)
45 PROFILE="debug"
46 CARGO_FLAGS=""
47 ;;
48 *)
49 echo "unknown: $1"
50 exit 1
51 ;;
52 esac
53}
54parse_boot_args "$@"
55
56OUT_DIR="target/x86_64-unknown-uefi/$PROFILE"
57
58# ---- build ----
59echo "=== Building kernel ($PROFILE) ==="
60if [ "$PROFILE" = "release" ]; then
61 cargo build --release --package rsdos --target x86_64-unknown-uefi
62else
63 cargo build --package rsdos --target x86_64-unknown-uefi
64fi
65
66# ---- stage system image ----
67echo "=== Staging system image ==="
68"$SCRIPT_DIR/mksystem.sh" --force "$SYSTEM_IMG"
69echo " system image: $SYSTEM_IMG"
70
71# ---- boot ----
72echo ""
73echo "=== Booting (direct: firmware → rsnix) ==="
74echo " ovmf: $OVMF"
75echo " mem: $MEM smp: $SMP"
76echo " gui: $([ -n "$GUI" ] && echo yes || echo no)"
77echo " gdb: $([ -n "$DEBUG" ] && echo ':1234' || echo off)"
78echo ""
79
80exec qemu-system-x86_64 \
81 -bios "$OVMF" \
82 -drive "file=$SYSTEM_IMG,format=raw,if=none,id=disk" \
83 -device ide-hd,drive=disk,bus=ide.0 \
84 -serial stdio \
85 -m "$MEM" \
86 -machine q35 \
87 -cpu qemu64 \
88 -no-reboot \
89 -smp "$SMP" \
90 $GUI $DEBUG