-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-qemu-debug.sh
More file actions
57 lines (45 loc) · 1.37 KB
/
run-qemu-debug.sh
File metadata and controls
57 lines (45 loc) · 1.37 KB
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
#!/bin/bash
# OSCortex QEMU Runner — graphical window + live serial log
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ISO="$SCRIPT_DIR/oscortex.iso"
SERIAL_LOG="/tmp/oscortex-serial.log"
# Kill any lingering QEMU that might hold the ISO lock
pkill -9 qemu-system-x86_64 2>/dev/null || true
sleep 0.3
if [ ! -f "$ISO" ]; then
echo "ERROR: $ISO not found!"
echo "Run: bash scripts/build-iso.sh"
exit 1
fi
rm -f "$SERIAL_LOG"
touch "$SERIAL_LOG"
echo "=========================================="
echo "OSCortex Boot — graphical window + serial"
echo "=========================================="
echo "Serial log: $SERIAL_LOG"
echo "A QEMU window will open. Close it or Ctrl+C here to stop."
echo ""
# Real graphical window (Cocoa on macOS); readonly avoids lock conflicts.
qemu-system-x86_64 \
-M q35 \
-cpu qemu64,+x2apic \
-smp cpus=2 \
-m 2G \
-cdrom "$ISO" \
-boot d \
-serial file:"$SERIAL_LOG" \
-display cocoa \
-vga std \
-monitor unix:/tmp/qemu-monitor.sock,server,nowait \
-no-reboot &
QEMU_PID=$!
sleep 0.5
tail -f "$SERIAL_LOG" &
TAIL_PID=$!
trap "kill $QEMU_PID $TAIL_PID 2>/dev/null; exit 0" INT TERM
wait $QEMU_PID 2>/dev/null || true
kill $TAIL_PID 2>/dev/null || true
echo ""
echo "=========================================="
echo "QEMU session ended"
echo "=========================================="