karlos/debug-run-qemu.sh

25 lines
684 B
Bash
Executable file

#!/usr/bin/env bash
#
# debug-run-qemu.sh
# Launch QEMU with four vCPUs and a GDB stub on TCP port 3117.
set -euo pipefail
QEMU_OPTS=""
# ATA drive with EFI partition, incl. bootloader & kernel
QEMU_OPTS="$QEMU_OPTS -drive if=ide,format=raw,file=build/disk.img"
# SATA drive
QEMU_OPTS="$QEMU_OPTS -drive id=disk,format=raw,file=drive.img,if=none -device ahci,id=ahci -device ide-hd,drive=disk,bus=ahci.0,serial=DEADBEEF"
# VIRTIO drive
QEMU_OPTS="$QEMU_OPTS -drive file=drive-virtio.img,format=raw,if=virtio"
# Multicore
QEMU_OPTS="$QEMU_OPTS -smp sockets=1,cores=2,threads=1"
# Debug Options
QEMU_OPTS="$QEMU_OPTS -d int -S -gdb tcp::3117"
qemu-system-x86_64 $QEMU_OPTS "$@"