#@TYPE: Machine
#@NAME: qemu-generic-arm64
#@DESCRIPTION: Generic Arm64 machine for typical SystemReady platforms, which
#have working firmware and boot via EFI.

MACHINEOVERRIDES =. "generic-arm64:"

require conf/machine/generic-arm64.conf
require conf/machine/include/qemu.inc

SERIAL_CONSOLES ?= "115200;ttyAMA0 115200;hvc0"
SERIAL_CONSOLES_CHECK = "${SERIAL_CONSOLES}"

EXTRA_IMAGEDEPENDS += "edk2-firmware"

# This unique WIC file is necessary because kernel boot args cannot be passed
# because there is no default kernel (see below).  There is no default kernel
# because QEMU will only allow firmware or kernel to be passed in as a
# parameter, and we need the firmware.  So, to allow for "ip=dhcp" as a kernel
# boot arg (which we need for testimage), we have to have a WIC file unique to
# this platform.
WKS_FILE = "qemu-efi-disk.wks.in"
IMAGE_FSTYPES += "wic.qcow2"

QB_SYSTEM_NAME = "qemu-system-aarch64"
QB_MACHINE = "-machine sbsa-ref"
QB_MEM = "-m 1024"
QB_DEFAULT_FSTYPE = "wic.qcow2"
QB_NETWORK_DEVICE = "-device virtio-net-pci,netdev=net0,mac=@MAC@"
QB_DRIVE_TYPE = "/dev/hd"
QB_ROOTFS_OPT = "-drive file=@ROOTFS@,if=ide,format=qcow2"
QB_DEFAULT_KERNEL = "none"
QB_OPT_APPEND = "-device qemu-xhci -device usb-tablet -device usb-kbd -pflash @DEPLOY_DIR_IMAGE@/SBSA_FLASH0.fd -pflash @DEPLOY_DIR_IMAGE@/SBSA_FLASH1.fd"
QB_SERIAL_OPT = "-device virtio-serial-pci -chardev null,id=virtcon -device virtconsole,chardev=virtcon"
QB_TCPSERIAL_OPT = "-device virtio-serial-pci -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1 -device virtconsole,chardev=virtcon"
