Xen: qemuboot device tree support (Arm 64-bit)
v2 cover Xen: qemuboot device tree support (Arm 64-bit)
This series introduces tools and class structure in the layer for enabling testing Xen system images with Qemu, booting with a device tree that describes the target system.
A device tree is required for launching Xen systems on Arm platforms and is part of the Hyperlaunch design for Xen.
https://wiki.xenproject.org/wiki/Hyperlaunch
This series adds a recipe for Lopper, a device tree tool, and its dependencies. It provides a class that implements a bitbake task to generate a device tree for qemuboot, and a set of defaults to enable 'runqemu xen-image-minimal nographic slirp' to boot images compiled for Arm 64-bit machines.
Christopher Clark (2):
lopper, python-dtc: add new recipes for device tree tools qemuboot, xen-image-minimal: enable runqemu for qemuarm64 Xen images
classes/qemuboot-xen-defaults.bbclass | 30 +++ classes/qemuboot-xen-dtb.bbclass | 209 +++++++++++++++++++ conf/distro/include/meta-virt-xen.inc | 3 + recipes-extended/images/xen-image-minimal.bb | 5 +- recipes-kernel/dtc/python3-dtc_1.6.1.bb | 28 +++ recipes-kernel/lopper/lopper.bb | 45 ++++ 6 files changed, 318 insertions(+), 2 deletions(-) create mode 100644 classes/qemuboot-xen-defaults.bbclass create mode 100644 classes/qemuboot-xen-dtb.bbclass create mode 100644 recipes-kernel/dtc/python3-dtc_1.6.1.bb create mode 100644 recipes-kernel/lopper/lopper.bb
Signature · 1 line
2.25.1
PATCH v2 1/2 lopper, python-dtc: add new recipes for device tree tools
From: Christopher Clark <[email protected]>
This device tree tooling is being added as a prequisite for enabling qemuboot with the Arm 64-bit version of the Xen hypervisor.
lopper: a tool for performing operations on device tree files. A new recipe inspired by the original from meta-xilinx-bsp.
python-dtc: a python library for the Device Tree compiler. This is a prerequisite for lopper. Updated import of recipe from meta-xilinx-bsp for the latest release, version 1.6.1.
---
Changes since v1:
* set the S variable to the top of the unpacked software and use the DISTUTILS_SETUP_PATH variable to direct the build
* use oe_runmake instead of make
recipes-kernel/dtc/python3-dtc_1.6.1.bb | 28 +++++++++++++++ recipes-kernel/lopper/lopper.bb | 45 +++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 recipes-kernel/dtc/python3-dtc_1.6.1.bb create mode 100644 recipes-kernel/lopper/lopper.bb
recipes-kernel/dtc/python3-dtc_1.6.1.bb new file +28 -0
@@ -0,0 +1,28 @@ +SUMMARY = "Python Library for the Device Tree Compiler" +HOMEPAGE = "https://devicetree.org/" +DESCRIPTION = "A python library for the Device Tree Compiler, a tool used to manipulate Device Tree files which contain a data structure for describing hardware." +SECTION = "bootloader" +LICENSE = "GPLv2 | BSD" + +DEPENDS = "flex-native bison-native swig-native libyaml dtc" + +SRC_URI = "git://git.kernel.org/pub/scm/utils/dtc/dtc.git" + +UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)" + +LIC_FILES_CHKSUM = "file://pylibfdt/libfdt.i;beginline=1;endline=6;md5=afda088c974174a29108c8d80b5dce90" + +SRCREV = "ecaeb97fec013973360e94888a7de645f084345c" + +S = "${WORKDIR}/git" + +inherit distutils3 + +DISTUTILS_SETUP_PATH = "${S}/pylibfdt" + +do_configure_prepend() { + oe_runmake -C "${S}" version_gen.h + mv "${S}/version_gen.h" "${DISTUTILS_SETUP_PATH}/" +} + +BBCLASSEXTEND = "native nativesdk"
recipes-kernel/lopper/lopper.bb new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 2/2 qemuboot, xen-image-minimal: enable runqemu for qemuarm64 Xen images
In reply to Christopher ClarkFrom: Christopher Clark <[email protected]>
The Xen hypervisor built for Arm 64-bit targets can be launched with runqemu by providing a Device Tree binary and configuration for Qemu, which enables interactive testing of Xen images.
Add qemuboot-xen-dtb.bbclass to add a new bitbake task for generating the dtb file by using lopper on a device tree produced by Qemu.
Add qemuboot-xen-defaults.bbclass to supply working default parameters for the qemuarm64 machine and general support for qemuboot for Xen, and adjust the defaults as needed to boot successfully in testing.
Development aided by this script by Stewart Hildebrand of DornerWorks:
https://gist.github.com/stewdk/110f43e0cc1d905fc6ed4c7e10d8d35e
---
Changes since v1:
* Use the weak default assignment operator on more of the settings
* Set QB_MEM via a new QB_MEM_VALUE variable in the defaults class, using the weaker default assignment operator, to enable easier change of default and override in an image recipe.
* Drop setting QB_MEM in the xen-image-minimal recipe; use default.
classes/qemuboot-xen-defaults.bbclass | 30 +++ classes/qemuboot-xen-dtb.bbclass | 209 +++++++++++++++++++ conf/distro/include/meta-virt-xen.inc | 3 + recipes-extended/images/xen-image-minimal.bb | 5 +- 4 files changed, 245 insertions(+), 2 deletions(-) create mode 100644 classes/qemuboot-xen-defaults.bbclass create mode 100644 classes/qemuboot-xen-dtb.bbclass
classes/qemuboot-xen-defaults.bbclass new file +30 -0
@@ -0,0 +1,30 @@ +# Set defaults for booting Xen images with qemuboot + +# Xen and Dom0 command line options +QB_XEN_CMDLINE_EXTRA ??= "dom0_mem=192M" +QB_XEN_DOM0_BOOTARGS ??= \ + "console=hvc0 earlyprintk clk_ignore_unused root=/dev/vda" + +# Launch with one initial domain, dom0, with one boot module, the kernel +DOM0_KERNEL ??= "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}" +DOM0_KERNEL_LOAD_ADDR ??= "0x45000000" +QB_XEN_DOMAIN_MODULES ??= "${DOM0_KERNEL}:${DOM0_KERNEL_LOAD_ADDR}:multiboot,kernel" + +# Qemuboot for 64-bit Arm uses the QB_DEFAULT_KERNEL method to load Xen +# and the device loader option for the dom0 kernel: +QB_OPT_APPEND_append_aarch64 = " \ + -device loader,file=${DOM0_KERNEL},addr=${DOM0_KERNEL_LOAD_ADDR} \ + " +QB_DEFAULT_KERNEL_aarch64 = "xen-${MACHINE}" + +# 64-bit Arm: gic version 3 +QB_MACHINE_aarch64 = "-machine virt,gic-version=3 -machine virtualization=true" + +# Increase the default qemu memory allocation to allow for the hypervisor. +# Use a weak assignment to allow for change of default and override elsewhere. +QB_MEM_VALUE ??= "512" +QB_MEM = "-m ${QB_MEM_VALUE}" + +# 64-bit Arm: qemuboot with a device tree binary +QB_DTB_aarch64 = "${IMAGE_NAME}.qemuboot.dtb" +QB_DTB_LINK_aarch64 = "${IMAGE_LINK_NAME}.qemuboot.dtb"
classes/qemuboot-xen-dtb.bbclass new file +209 -0
209 lines not on this page · raw message
conf/distro/include/meta-virt-xen.inc +3 -0
@@ -10,3 +10,6 @@ XEN_RPI4_64_CONFIG_PATH ??= \ 'dynamic-layers/raspberrypi/conf/distro/include/xen-raspberrypi4-64.inc' include ${@bb.utils.contains('MACHINE', 'raspberrypi4-64', \ '${XEN_RPI4_64_CONFIG_PATH}', '', d)} + +# Set serial for working qemuboot console +SERIAL_CONSOLES_qemuarm64 ?= "115200;ttyAMA0"
recipes-extended/images/xen-image-minimal.bb +3 -2
@@ -31,7 +31,7 @@ XEN_PCIBACK_MODULE_x86-64 = "kernel-module-xen-pciback" LICENSE = "MIT" -inherit core-image +inherit core-image qemuboot-xen-defaults qemuboot-xen-dtb do_check_xen_state() { if [ "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' yes', 'no', d)}" = "no" ]; then
@@ -74,10 +74,11 @@ build_syslinux_cfg () { # Enable runqemu. eg: runqemu xen-image-minimal nographic slirp WKS_FILE_x86-64 = "directdisk-xen.wks" -QB_MEM ?= "-m 400" QB_DEFAULT_KERNEL ?= "none" QB_DEFAULT_FSTYPE ?= "wic" +QB_DEFAULT_FSTYPE_qemux86-64 = "wic" QB_FSINFO ?= "wic:kernel-in-fs" +QB_SERIAL_OPT = "-serial mon:stdio" # qemux86-64 machine does not include 'wic' in IMAGE_FSTYPES, which is needed # to boot this image, so add it here: IMAGE_FSTYPES_qemux86-64 += "wic"
Signature · 1 line
2.25.1
In message: [meta-virtualization][PATCH v2 0/2] Xen: qemuboot device tree support (Arm 64-bit)
Quoted 8 lines · on 27/07/2021 Christopher Clark wrote:
This series introduces tools and class structure in the layer for enabling testing Xen system images with Qemu, booting with a device tree that describes the target system.
A device tree is required for launching Xen systems on Arm platforms and is part of the Hyperlaunch design for Xen.
https://wiki.xenproject.org/wiki/Hyperlaunch
Quoted 5 lines
This series adds a recipe for Lopper, a device tree tool, and its dependencies. It provides a class that implements a bitbake task to generate a device tree for qemuboot, and a set of defaults to enable 'runqemu xen-image-minimal nographic slirp' to boot images compiled for Arm 64-bit machines.
Looks good to me.
this is now merged.
Bruce
Quoted 20 lines
Christopher Clark (2):
lopper, python-dtc: add new recipes for device tree tools qemuboot, xen-image-minimal: enable runqemu for qemuarm64 Xen imagesclasses/qemuboot-xen-defaults.bbclass | 30 +++ classes/qemuboot-xen-dtb.bbclass | 209 +++++++++++++++++++ conf/distro/include/meta-virt-xen.inc | 3 + recipes-extended/images/xen-image-minimal.bb | 5 +- recipes-kernel/dtc/python3-dtc_1.6.1.bb | 28 +++ recipes-kernel/lopper/lopper.bb | 45 ++++ 6 files changed, 318 insertions(+), 2 deletions(-) create mode 100644 classes/qemuboot-xen-defaults.bbclass create mode 100644 classes/qemuboot-xen-dtb.bbclass create mode 100644 recipes-kernel/dtc/python3-dtc_1.6.1.bb create mode 100644 recipes-kernel/lopper/lopper.bbSignature · 1 line
2.25.1