aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>2021-01-14 22:12:39 +0100
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2021-01-16 12:51:27 +0000
commit2d05cfff33a010c2133f66e757d2f4850c584a1e (patch)
treec891738f2ac92c6f088b0d3f7f43ccb5952b5b27
parentffefac002245e879c9504e94e15bebb273b40816 (diff)
meta-agl-bsp, 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 Changes are moved here from meta-agl-devel. [1]: https://www.yoctoproject.org/docs/3.1.2/bsp-guide/bsp-guide.html#released-bsp-recommendations Bug-AGL: SPEC-3668 Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com> Change-Id: I653ca35fded3d3e38f25299f46629db1174b5008 Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/25915 Tested-by: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org> ci-image-build: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org> ci-image-boot-test: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org> Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
-rw-r--r--meta-agl-bsp/conf/include/agl_virtio-aarch64.inc14
-rw-r--r--meta-agl-bsp/conf/machine/include/virtio.inc23
-rw-r--r--meta-agl-bsp/conf/machine/virtio-aarch64.conf36
-rw-r--r--meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-aarch64/aarch64.cfg29
-rw-r--r--meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-aarch64/aarch64.scc2
-rw-r--r--meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-aarch64/virtio-aarch64-standard.scc13
-rw-r--r--meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-aarch64/virtio.cfg16
-rw-r--r--meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-aarch64/virtio.scc2
-rw-r--r--meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto_%.bbappend7
-rw-r--r--templates/machine/virtio-aarch64/50_bblayers.conf.inc6
-rw-r--r--templates/machine/virtio-aarch64/50_local.conf.inc3
-rw-r--r--templates/machine/virtio-aarch64/README_machine_virtio-aarch64.md10
12 files changed, 161 insertions, 0 deletions
diff --git a/meta-agl-bsp/conf/include/agl_virtio-aarch64.inc b/meta-agl-bsp/conf/include/agl_virtio-aarch64.inc
new file mode 100644
index 000000000..e3faaf7bc
--- /dev/null
+++ b/meta-agl-bsp/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-agl-bsp/conf/machine/include/virtio.inc b/meta-agl-bsp/conf/machine/include/virtio.inc
new file mode 100644
index 000000000..b4022d526
--- /dev/null
+++ b/meta-agl-bsp/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-agl-bsp/conf/machine/virtio-aarch64.conf b/meta-agl-bsp/conf/machine/virtio-aarch64.conf
new file mode 100644
index 000000000..d92d43943
--- /dev/null
+++ b/meta-agl-bsp/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"
diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-aarch64/aarch64.cfg b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-aarch64/aarch64.cfg
new file mode 100644
index 000000000..25381e133
--- /dev/null
+++ b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-aarch64/aarch64.cfg
@@ -0,0 +1,29 @@
+# SPDX-License-Identifier: MIT
+#
+# ARM64
+#
+CONFIG_ARM64=y
+CONFIG_64BIT=y
+
+#
+# Bus support
+#
+CONFIG_ARM_AMBA=y
+
+#
+# Non-8250 serial port support
+#
+CONFIG_SERIAL_AMBA_PL011=y
+CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
+
+#
+# RTC
+#
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+
+#
+# on-CPU RTC drivers
+#
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_DRV_PL031=y
diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-aarch64/aarch64.scc b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-aarch64/aarch64.scc
new file mode 100644
index 000000000..1de6faf9b
--- /dev/null
+++ b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-aarch64/aarch64.scc
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: MIT
+kconf hardware aarch64.cfg
diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-aarch64/virtio-aarch64-standard.scc b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-aarch64/virtio-aarch64-standard.scc
new file mode 100644
index 000000000..3a241a0ee
--- /dev/null
+++ b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-aarch64/virtio-aarch64-standard.scc
@@ -0,0 +1,13 @@
+# SPDX-License-Identifier: MIT
+define KMACHINE virtio-aarch64
+define KTYPE standard
+define KARCH arm64
+
+include ktypes/standard/standard.scc
+include aarch64.scc
+include cfg/8250.scc
+include cfg/virtio.scc
+include virtio.scc
+
+# enable the ability to run 32 bit apps
+include arch/arm/32bit-compat.scc
diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-aarch64/virtio.cfg b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-aarch64/virtio.cfg
new file mode 100644
index 000000000..b8b36e7ad
--- /dev/null
+++ b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-aarch64/virtio.cfg
@@ -0,0 +1,16 @@
+# SPDX-License-Identifier: MIT
+
+# TODO: upstream to yocto-kernel-cache/cfg/8250.cfg
+CONFIG_SERIAL_OF_PLATFORM=y
+
+# Remove since PCI is not enabled
+# CONFIG_SERIAL_8250_PCI is not set
+
+# TODO: upstream to yocto-kernel-cache/cfg/virtio.cfg
+CONFIG_VSOCKETS=y
+CONFIG_VSOCKETS_DIAG=y
+CONFIG_VIRTIO_VSOCKETS=y
+CONFIG_VIRTIO_VSOCKETS_COMMON=y
+
+# Needed for CONFIG_DRM_VIRTIO_GPU
+CONFIG_DRM=y
diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-aarch64/virtio.scc b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-aarch64/virtio.scc
new file mode 100644
index 000000000..333ac42b8
--- /dev/null
+++ b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-aarch64/virtio.scc
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: MIT
+kconf hardware virtio.cfg
diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto_%.bbappend b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto_%.bbappend
new file mode 100644
index 000000000..ed48a1359
--- /dev/null
+++ b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto_%.bbappend
@@ -0,0 +1,7 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/linux-yocto:"
+
+SRC_URI_append_virtio-aarch64 = " \
+ file://virtio-aarch64;type=kmeta;destsuffix=virtio-aarch64 \
+"
+
+COMPATIBLE_MACHINE_virtio-aarch64 = "virtio-aarch64"
diff --git a/templates/machine/virtio-aarch64/50_bblayers.conf.inc b/templates/machine/virtio-aarch64/50_bblayers.conf.inc
new file mode 100644
index 000000000..16c7ec5f8
--- /dev/null
+++ b/templates/machine/virtio-aarch64/50_bblayers.conf.inc
@@ -0,0 +1,6 @@
+BBFILES += " \
+ ${METADIR}/meta-agl/meta-agl-bsp/virtualization-layer/recipes*/*/*.bb \
+ ${METADIR}/meta-agl/meta-agl-bsp/virtualization-layer/recipes*/*/*.bbappend \
+ "
+
+BBMASK += "meta-agl/meta-agl-bsp/virtualization-layer/recipes-extended/xen"
diff --git a/templates/machine/virtio-aarch64/50_local.conf.inc b/templates/machine/virtio-aarch64/50_local.conf.inc
new file mode 100644
index 000000000..3328d6ab8
--- /dev/null
+++ b/templates/machine/virtio-aarch64/50_local.conf.inc
@@ -0,0 +1,3 @@
+MACHINE = "virtio-aarch64"
+# see meta-agl/meta-agl-bsp/conf/include/agl_virtio-aarch64.inc
+require conf/include/agl_virtio-aarch64.inc
diff --git a/templates/machine/virtio-aarch64/README_machine_virtio-aarch64.md b/templates/machine/virtio-aarch64/README_machine_virtio-aarch64.md
new file mode 100644
index 000000000..8149c4324
--- /dev/null
+++ b/templates/machine/virtio-aarch64/README_machine_virtio-aarch64.md
@@ -0,0 +1,10 @@
+---
+description: Machine virtio-aarch64
+authors: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
+---
+
+### Machine virtio-aarch64
+
+This machine is intended to run in an ARMv8 virtualized environment that
+provides VirtIO devices. For now, virtio-aarch64 machine was verified under QEMU
+and OpenSynergy COQOS Hypervisor.