karlos/run-qemu.sh

24 lines
684 B
Bash
Executable file

#!/bin/sh
QEMU_OPTS=""
# SATA drive
QEMU_OPTS="$QEMU_OPTS -device ahci,id=ahci"
if [ -f "build/disk.img" ]; then
QEMU_OPTS="$QEMU_OPTS -drive id=bootdisk,format=raw,file=build/disk.img,if=none -device ide-hd,drive=bootdisk,bus=ahci.0,serial=DEADBEE0"
fi
if [ -f "drive.img" ]; then
QEMU_OPTS="$QEMU_OPTS -drive id=disk,format=raw,file=drive.img,if=none -device ide-hd,drive=disk,bus=ahci.1,serial=DEADBEEF"
fi
# VIRTIO drive
if [ -f "drive-virtio.img" ]; then
QEMU_OPTS="$QEMU_OPTS -drive file=drive-virtio.img,format=raw,if=virtio"
fi
# Multicore
QEMU_OPTS="$QEMU_OPTS -smp sockets=1,cores=2,threads=1"
QEMU_OPTS="$QEMU_OPTS -machine q35"
qemu-system-x86_64 $QEMU_OPTS "$@"