#!/bin/sh
#
# Template for running a QEMU x86_64 VM in EFI mode on Linux/macOS
#

# On macOS, change SHARE according to your CPU type:
#
# Apple silicon: /opt/homebrew/share/qemu
# Intel CPU: /usr/local/share/qemu
SHARE="/usr/share/qemu"

qemu-system-x86_64 \
    -name "NAME ME" \
    -machine type=pc-q35-6.0 \
    -accel tcg \
    -cpu qemu64 \
    -smp 2 \
    -m 2048 \
    -rtc base=utc \
    -drive if=pflash,format=raw,file="${SHARE}/edk2-x86_64-code.fd",readonly=on \
    -drive if=pflash,format=raw,file=edk2-i386-vars.fd \
    -drive file="DISK.qcow2",if=virtio,format=qcow2 \
    -boot menu=on \
    -display gtk \
    -device virtio-vga \
    -nic user,id=NAT,model=virtio-net-pci,mac=02:00:00:00:00:01 \
    -device qemu-xhci \
    -device usb-tablet \
    -cdrom CDROM.iso

echo "QEMU has finished. Press Enter to continue."
read throwaway
