From 44dc9ffbcb89213a9d3e60d00d5d739415ec9adf Mon Sep 17 00:00:00 2001 From: Vasyl Vavrychuk Date: Mon, 5 Oct 2020 08:47:43 +0300 Subject: meta-egvirt, templates: Add virtio-aarch64 machine This machine is intended to run in ARMv8 virtualized environment that provides VirtIO devices. AGL machine configuration files are based on qemuarm64 machine from meta-agl branch master commit e1da0efcd2eece82b0326798cfeaeb8dd48797fc. Yocto machine configuration files are based on qemuarm64 machine from Poky branch dunfell commit 4e931b1d05018923dc145cd97f6f965f5cb6e1a5. Yocto Linux Kernel is used as recommended in [1]. Its metadata for the created machine are based on qemuarm64-standard.scc from yocto-kernel-cache branch yocto-5.4 commit 4aeda12f7f7eb84613ae1fe6e22cd9cd9790c20b. The rationale behind creating new machine is a wish to have a machine that could run on other hypervisor/virtual machine monitor that implements VirtIO, not necessary QEMU. For now, virtio-aarch64 machine runs under QEMU and OpenSynergy COQOS Hypervisor. virtio-aarch64 machine includes following changes comparing to qemuarm64: * use virtio-gpu instead of VGA display (to be upstreamed to work in conjunction with runqemu gl, sdl, etc. options) * use virtio-bus instead of PCI bus QEMU devices * remove unneeded configurations [1]: https://www.yoctoproject.org/docs/3.1.2/bsp-guide/bsp-guide.html#released-bsp-recommendations Bug-AGL: SPEC-3668 Change-Id: Iccfee8613de63770d371a57f0caab1c1eba8d912 Signed-off-by: Vasyl Vavrychuk --- meta-egvirt/conf/include/agl_virtio-aarch64.inc | 14 ++++++++++ meta-egvirt/conf/machine/include/virtio.inc | 23 ++++++++++++++++ meta-egvirt/conf/machine/virtio-aarch64.conf | 36 +++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 meta-egvirt/conf/include/agl_virtio-aarch64.inc create mode 100644 meta-egvirt/conf/machine/include/virtio.inc create mode 100644 meta-egvirt/conf/machine/virtio-aarch64.conf (limited to 'meta-egvirt/conf') diff --git a/meta-egvirt/conf/include/agl_virtio-aarch64.inc b/meta-egvirt/conf/include/agl_virtio-aarch64.inc new file mode 100644 index 00000000..e3faaf7b --- /dev/null +++ b/meta-egvirt/conf/include/agl_virtio-aarch64.inc @@ -0,0 +1,14 @@ +# Build updatable image. Only takes effect when sota.bbclass is inherited +DISTRO_FEATURES_append = " sota" + +# Root device +ROOT_VM = "root=PARTUUID=${DISK_SIGNATURE}-02" + +# Use our own wks file +WKS_FILE = "directdisk.wks.in" + +# Simplest possible option +AGL_DEFAULT_IMAGE_FSTYPES = "ext4" + +# Need to run QEMU with virtio-gpu device +PACKAGECONFIG_append_pn-qemu-system-native = " virglrenderer glx gtk+" diff --git a/meta-egvirt/conf/machine/include/virtio.inc b/meta-egvirt/conf/machine/include/virtio.inc new file mode 100644 index 00000000..b4022d52 --- /dev/null +++ b/meta-egvirt/conf/machine/include/virtio.inc @@ -0,0 +1,23 @@ +PREFERRED_PROVIDER_virtual/egl ?= "mesa" +PREFERRED_PROVIDER_virtual/libgl ?= "mesa" +PREFERRED_PROVIDER_virtual/libgles1 ?= "mesa" +PREFERRED_PROVIDER_virtual/libgles2 ?= "mesa" + +MACHINE_FEATURES = "alsa usbgadget screen vfat" + +MACHINEOVERRIDES =. "virtio-all:" + +IMAGE_FSTYPES += "tar.bz2 ext4" + +# Don't include kernels in standard images +RDEPENDS_${KERNEL_PACKAGE_NAME}-base = "" + +# Use a common kernel recipe for all VirtIO machines +PREFERRED_PROVIDER_virtual/kernel ??= "linux-yocto" + +EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native" + +IMAGE_CLASSES += "qemuboot" + +# most driver fails to compile +MOST_DRIVERS ?= "" diff --git a/meta-egvirt/conf/machine/virtio-aarch64.conf b/meta-egvirt/conf/machine/virtio-aarch64.conf new file mode 100644 index 00000000..d92d4394 --- /dev/null +++ b/meta-egvirt/conf/machine/virtio-aarch64.conf @@ -0,0 +1,36 @@ +#@TYPE: Machine +#@NAME: VirtIO ARMv8 machine +#@DESCRIPTION: Machine configuration for running an ARMv8 system on VirtIO based platform + +require conf/machine/include/arm/arch-armv8a.inc +require conf/machine/include/virtio.inc + +KERNEL_IMAGETYPE = "Image" + +SERIAL_CONSOLES ?= "115200;ttyAMA0 115200;hvc0" +SERIAL_CONSOLES_CHECK = "${SERIAL_CONSOLES}" + +# For runqemu +QB_SYSTEM_NAME = "qemu-system-aarch64" +QB_MACHINE = "-machine virt" +QB_CPU = "-cpu cortex-a57" +QB_CPU_KVM = "-cpu host -machine gic-version=3" +QB_MEM = "-m 2048" +# Standard Serial console +QB_KERNEL_CMDLINE_APPEND = "console=ttyAMA0" +# Ensure virtio-mmio support VirtIO 1.0 required by virtio-gpu +QB_OPT_APPEND = "-global virtio-mmio.force-legacy=false" +# TODO: upstream to OE-core runqemu +QB_OPT_APPEND += "-device virtio-gpu-device -display gtk,gl=on -show-cursor" +# Virtio input +QB_OPT_APPEND += "-device virtio-mouse-device -device virtio-keyboard-device" +# Add the 'virtio-rng-device' device otherwise the guest may run out of entropy +QB_OPT_APPEND += "-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-device,rng=rng0" +# Virtio Networking support +QB_TAP_OPT = "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no" +QB_NETWORK_DEVICE = "-device virtio-net-device,netdev=net0,mac=@MAC@" +# Virtio block device +QB_ROOTFS_OPT = "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-device,drive=disk0" +# Virtio serial console +QB_SERIAL_OPT = "-device virtio-serial-device -chardev null,id=virtcon -device virtconsole,chardev=virtcon" +QB_TCPSERIAL_OPT = "-device virtio-serial-device -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1 -device virtconsole,chardev=virtcon" -- cgit 1.2.3-korg