#!/bin/sh
#
# Template for running a QEMU AArch64 VM 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-aarch64 \
    -name "NAME ME" \
    -machine type=virt,iommu=smmuv3 \
    -accel tcg \
    -cpu cortex-a57 \
    -m 2048 \
    -rtc base=utc \
    -drive if=pflash,format=raw,file="${SHARE}/edk2-aarch64-code.fd",readonly=on \
    -drive if=pflash,format=raw,file=edk2-arm-vars.fd \
    -drive file="DISK.qcow2",if=virtio,format=qcow2 \
    -drive file="CDROM.iso",format=raw,readonly=on \
    -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-kbd \
    -device usb-tablet

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