40 lines
1.5 KiB
Bash
Executable File
40 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# Like interactive-qemu.sh but logs serial console to /tmp/qemu-serial.log
|
|
# for post-boot log inspection. Uses the niri ISO by default.
|
|
set -Eeuo pipefail
|
|
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
OUT_DIR="$PROJECT_DIR/out"
|
|
ISO="${ISO:-$(ls -t "$OUT_DIR"/void-live-niri-*.iso 2>/dev/null | head -1 || true)}"
|
|
DISK="${DISK:-$OUT_DIR/test-disk.img}"
|
|
RAM_MB="${RAM_MB:-6144}"
|
|
SMP="${SMP:-4}"
|
|
|
|
OVMF_CODE="${OVMF_CODE:-/usr/share/OVMF/OVMF_CODE.fd}"
|
|
OVMF_VARS_TPL="${OVMF_VARS_TPL:-/usr/share/OVMF/OVMF_VARS.fd}"
|
|
[[ -r "$OVMF_CODE" ]] || { echo "no OVMF — install ovmf"; exit 1; }
|
|
[[ -r "$ISO" ]] || { echo "no ISO at $ISO"; exit 1; }
|
|
|
|
if [[ ! -f "$DISK" ]]; then
|
|
"$PROJECT_DIR/tests/make-test-disk.sh" "$DISK"
|
|
fi
|
|
VARS="$OUT_DIR/OVMF_VARS.debug.fd"
|
|
[[ -f "$VARS" ]] || cp "$OVMF_VARS_TPL" "$VARS"
|
|
|
|
SERIAL_PORT="${SERIAL_PORT:-4444}"
|
|
echo ">>> serial console → TCP port $SERIAL_PORT (connect: socat -,raw,echo=0 TCP:127.0.0.1:$SERIAL_PORT)"
|
|
echo ">>> ISO: $ISO"
|
|
|
|
exec qemu-system-x86_64 \
|
|
-name void-niri-debug \
|
|
-machine q35,accel=kvm:tcg -cpu max \
|
|
-m "$RAM_MB" -smp "$SMP" \
|
|
-drive "if=pflash,format=raw,readonly=on,file=$OVMF_CODE" \
|
|
-drive "if=pflash,format=raw,file=$VARS" \
|
|
-drive "if=virtio,file=$DISK,format=raw,cache=none" \
|
|
-cdrom "$ISO" \
|
|
-boot menu=on \
|
|
-netdev user,id=n0,hostfwd=tcp:127.0.0.1:2222-:22 \
|
|
-device virtio-net-pci,netdev=n0 \
|
|
-serial "tcp::${SERIAL_PORT},server,nowait" \
|
|
-device virtio-gpu-gl -display gtk,gl=on
|