#!/bin/bash
TARGET=${1:-"k3s"}
CPU=${2:-2048}

echo "Booting $TARGET"
qemu-system-x86_64 \
  -m $CPU \
  -cpu host \
  -enable-kvm \
  -smp $(nproc) \
  -drive if=pflash,format=raw,readonly=on,file=/usr/share/edk2/x64/OVMF_CODE.4m.fd \
  -drive if=pflash,format=raw,file=uefi/OVMF_VARS.4m.fd \
  -drive if=virtio,file=disks/$TARGET.qcow2,cache=none,aio=native \
  -fw_cfg name=opt/org.flatcar-linux/config,file=$TARGET.ign \
  -device virtio-net-pci,netdev=net0 \
  -netdev user,id=net0

