Date   

[PATCH] docker: Add runtime provide for virtual-docker

Richard Neill <richard.neill@...>
 

This patch enables successful runtime-dependency on the Docker preferred
provider, as virtual/docker does not resolve. Doing so aligns with other =
virtual
package providers (e.g. virtual-runc), and follows the Yocto Project
documentation
(https://docs.yoctoproject.org/singleindex.html#virtual-runtime-provides)=
.

Signed-off-by: Richard Neill <richard.neill@...>
---
recipes-containers/docker/docker.inc | 1 +
1 file changed, 1 insertion(+)

diff --git a/recipes-containers/docker/docker.inc b/recipes-containers/do=
cker/docker.inc
index 40a3642..e196f9b 100644
--- a/recipes-containers/docker/docker.inc
+++ b/recipes-containers/docker/docker.inc
@@ -32,6 +32,7 @@ RDEPENDS:${PN} +=3D "virtual-containerd virtual-runc"
RRECOMMENDS:${PN} =3D "kernel-module-dm-thin-pool kernel-module-nf-nat k=
ernel-module-nf-conntrack-netlink kernel-module-xt-addrtype kernel-module=
-xt-masquerade"

PROVIDES +=3D "virtual/docker"
+RPROVIDES:${PN} +=3D "virtual-docker"

# we want all the docker variant recpes to be installable via "docker"
PACKAGE_NAME =3D "docker"
--
2.25.1


Re: [PATCH 1/2] vgabios: upgrade to 0.8a and cleanup recipe

Bruce Ashfield
 

both patches are merged.

Bruce

In message: [meta-virtualization] [PATCH 1/2] vgabios: upgrade to 0.8a and cleanup recipe
on 29/04/2022 Ross Burton wrote:

Upgrade to 0.8a.

License checksum updated as the FSF street address changed.

Apply a patch to use the correct host compiler when building biossums,
removing the need for a separate biossums-native recipe.

Don't hardcode /usr/share, use ${datadir}.

Install all found firmware (including the new Banshee BIOS in 0.8a) and
the debug files which were not installed but intended to be packaged.

Remove redundant PR and S assignments, as these are the default values.

Signed-off-by: Ross Burton <ross.burton@...>
---
recipes-extended/vgabios/biossums_0.7a.bb | 37 -------------------
recipes-extended/vgabios/files/build-cc.patch | 30 +++++++++++++++
recipes-extended/vgabios/vgabios_0.7a.bb | 33 -----------------
recipes-extended/vgabios/vgabios_0.8a.bb | 25 +++++++++++++
4 files changed, 55 insertions(+), 70 deletions(-)
delete mode 100644 recipes-extended/vgabios/biossums_0.7a.bb
create mode 100644 recipes-extended/vgabios/files/build-cc.patch
delete mode 100644 recipes-extended/vgabios/vgabios_0.7a.bb
create mode 100644 recipes-extended/vgabios/vgabios_0.8a.bb

diff --git a/recipes-extended/vgabios/biossums_0.7a.bb b/recipes-extended/vgabios/biossums_0.7a.bb
deleted file mode 100644
index 95483ff..0000000
--- a/recipes-extended/vgabios/biossums_0.7a.bb
+++ /dev/null
@@ -1,37 +0,0 @@
-DESCRIPTION = "biossums tool for building Plex86/Bochs LGPL VGABios"
-HOMEPAGE = "http://www.nongnu.org/vgabios/"
-LICENSE = "LGPL-2.1-only"
-SECTION = "firmware"
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=dcf3c825659e82539645da41a7908589"
-
-SRC_URI = "http://savannah.gnu.org/download/vgabios/vgabios-${PV}.tgz"
-
-SRC_URI[md5sum] = "2c0fe5c0ca08082a9293e3a7b23dc900"
-SRC_URI[sha256sum] = "9d24c33d4bfb7831e2069cf3644936a53ef3de21d467872b54ce2ea30881b865"
-
-BBCLASSEXTEND = "native"
-
-FILES:${PN} = "${bindir}/biossums"
-
-S = "${WORKDIR}/vgabios-${PV}"
-
-do_configure() {
- # Don't override the compiler or its flags:
- sed 's,^CC,DISABLED_CC,' -i Makefile
- sed 's,^CFLAGS,DISABLED_CFLAGS,' -i Makefile
- sed 's,^LDFLAGS,DISABLED_LDFLAGS,' -i Makefile
- # Supply the C flags to the compiler:
- sed 's,-o biossums,$(CFLAGS) -o biossums,' -i Makefile
-}
-
-do_compile() {
- # clean removes binaries distributed with source
- oe_runmake clean
- oe_runmake biossums
-}
-
-do_install() {
- mkdir -p "${D}${bindir}"
- install -m 0755 biossums "${D}${bindir}"
-}
diff --git a/recipes-extended/vgabios/files/build-cc.patch b/recipes-extended/vgabios/files/build-cc.patch
new file mode 100644
index 0000000..b64e5ef
--- /dev/null
+++ b/recipes-extended/vgabios/files/build-cc.patch
@@ -0,0 +1,30 @@
+Use the host compiler to build the tools we need at runtime.
+
+Upstream-Status: Pending
+Signed-off-by: Ross Burton <ross.burton@...>
+
+Index: Makefile
+===================================================================
+--- a/Makefile (revision 298)
++++ b/Makefile (working copy)
+@@ -5,6 +5,7 @@
+ SHELL = /bin/sh
+
+ CC = gcc
++HOSTCC = gcc
+ CFLAGS = -g -O2 -Wall -Wstrict-prototypes
+ LDFLAGS =
+
+@@ -79,10 +80,10 @@
+ tar czvf ../$(RELEASE).tgz --exclude .svn -C .. $(RELEASE)/
+
+ biossums: biossums.c
+- $(CC) -o biossums biossums.c
++ $(HOSTCC) -o biossums biossums.c
+
+ vbetables-gen: vbetables-gen.c
+- $(CC) -o vbetables-gen vbetables-gen.c
++ $(HOSTCC) -o vbetables-gen vbetables-gen.c
+
+ vbetables.h: vbetables-gen
+ ./vbetables-gen > $@
diff --git a/recipes-extended/vgabios/vgabios_0.7a.bb b/recipes-extended/vgabios/vgabios_0.7a.bb
deleted file mode 100644
index f443aed..0000000
--- a/recipes-extended/vgabios/vgabios_0.7a.bb
+++ /dev/null
@@ -1,33 +0,0 @@
-DESCRIPTION = "Plex86/Bochs LGPL VGABios"
-HOMEPAGE = "http://www.nongnu.org/vgabios/"
-LICENSE = "LGPL-2.1-only"
-SECTION = "firmware"
-
-DEPENDS = "dev86-native biossums-native"
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=dcf3c825659e82539645da41a7908589"
-
-SRC_URI = "http://savannah.gnu.org/download/vgabios/${BPN}-${PV}.tgz"
-
-SRC_URI[md5sum] = "2c0fe5c0ca08082a9293e3a7b23dc900"
-SRC_URI[sha256sum] = "9d24c33d4bfb7831e2069cf3644936a53ef3de21d467872b54ce2ea30881b865"
-
-PR = "r0"
-
-FILES:${PN} = "/usr/share/firmware/${PN}-${PV}*.bin"
-FILES:${PN}-dbg = "/usr/share/firmware/${PN}-${PV}*.debug.bin"
-
-S = "${WORKDIR}/${PN}-${PV}"
-
-do_configure() {
- # Override to use the native-built biossums tool:
- sed 's,./biossums,biossums,' -i Makefile
- sed 's,$(CC) -o biossums biossums.c,touch biossums,' -i Makefile
-}
-
-do_install() {
- install -d ${D}/usr/share/firmware
- install -m 0644 VGABIOS-lgpl-latest.bin ${D}/usr/share/firmware/${PN}-${PV}.bin
- install -m 0644 VGABIOS-lgpl-latest.cirrus.bin ${D}/usr/share/firmware/${PN}-${PV}.cirrus.bin
-}
-
diff --git a/recipes-extended/vgabios/vgabios_0.8a.bb b/recipes-extended/vgabios/vgabios_0.8a.bb
new file mode 100644
index 0000000..044bb4e
--- /dev/null
+++ b/recipes-extended/vgabios/vgabios_0.8a.bb
@@ -0,0 +1,25 @@
+DESCRIPTION = "Plex86/Bochs LGPL VGABios"
+HOMEPAGE = "http://www.nongnu.org/vgabios/"
+LICENSE = "LGPL-2.1-only"
+SECTION = "firmware"
+
+DEPENDS = "dev86-native"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=fae731a3adbc92fd8bb1730d1f2455bc"
+
+SRC_URI = "http://savannah.gnu.org/download/vgabios/${BP}.tgz \
+ file://build-cc.patch"
+SRC_URI[sha256sum] = "481042240ef0f1c918780c92a6bb42ad4d3f5d989b29502fa7ee7faf13a041b9"
+
+EXTRA_OEMAKE = "HOSTCC="${BUILD_CC}""
+
+do_install() {
+ install -d ${D}${datadir}/firmware
+ for file in VGABIOS*.bin; do
+ target=$(echo $file | sed s/VGABIOS-lgpl-latest/${BP}/)
+ install -m0644 $file ${D}${datadir}/firmware/$target
+ done
+}
+
+FILES:${PN} = "${datadir}/firmware/${BP}*.bin"
+FILES:${PN}-dbg = "${datadir}/firmware/${BP}*.debug.bin"
--
2.25.1



Re: [PATCH] dev86: fix a build race

Bruce Ashfield
 

merged.

Bruce

In message: [meta-virtualization] [PATCH] dev86: fix a build race
on 29/04/2022 Ross Burton wrote:

Fix a race in cpp/ where token[12].h are written to a temporary file
with the same name.

Also update the status of cross.patch.

Signed-off-by: Ross Burton <ross.burton@...>
---
...1-cpp-fix-race-writing-token.h-files.patch | 42 +++++++++++++++++++
recipes-extended/dev86/dev86/cross.patch | 2 +-
recipes-extended/dev86/dev86_git.bb | 3 +-
3 files changed, 45 insertions(+), 2 deletions(-)
create mode 100644 recipes-extended/dev86/dev86/0001-cpp-fix-race-writing-token.h-files.patch

diff --git a/recipes-extended/dev86/dev86/0001-cpp-fix-race-writing-token.h-files.patch b/recipes-extended/dev86/dev86/0001-cpp-fix-race-writing-token.h-files.patch
new file mode 100644
index 0000000..d6e7999
--- /dev/null
+++ b/recipes-extended/dev86/dev86/0001-cpp-fix-race-writing-token.h-files.patch
@@ -0,0 +1,42 @@
+Upstream-Status: Submitted [https://github.com/jbruchon/dev86/pull/23]
+Signed-off-by: Ross Burton <ross.burton@...>
+
+From f507ee398ae20e4e97f01dfbd9a8709a90bc760f Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@...>
+Date: Fri, 29 Apr 2022 16:44:08 +0100
+Subject: [PATCH] cpp: fix race writing token.h files
+
+The rules for token1.h and token2.h both write to a temporary file tmp.h
+before renaming to token1.h or token2.h. However, in a parallel build
+these will execute at the same time and race.
+
+ gperf -aptTc -N is_ctok -H hash1 token1.tok > tmp.h
+ gperf -aptTc -k1,3 -N is_ckey -H hash2 token2.tok > tmp.h
+ mv tmp.h token1.h
+ mv tmp.h token2.h
+ mv: cannot stat 'tmp.h': No such file or directory
+
+By using gperf --output-file, the race is avoided entirely.
+---
+ cpp/Makefile | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/cpp/Makefile b/cpp/Makefile
+index 0ea43cc..743694f 100644
+--- a/cpp/Makefile
++++ b/cpp/Makefile
+@@ -20,9 +20,7 @@ token1.o: token1.h
+ token2.o: token2.h
+
+ token1.h: token1.tok
+- gperf -aptTc -N is_ctok -H hash1 token1.tok > tmp.h
+- mv tmp.h token1.h
++ gperf -aptTc -N is_ctok -H hash1 --output-file $@ $<
+
+ token2.h: token2.tok
+- gperf -aptTc -k1,3 -N is_ckey -H hash2 token2.tok > tmp.h
+- mv tmp.h token2.h
++ gperf -aptTc -k1,3 -N is_ckey -H hash2 --output-file $@ $<
+--
+2.25.1
+
diff --git a/recipes-extended/dev86/dev86/cross.patch b/recipes-extended/dev86/dev86/cross.patch
index 041a8d3..fd62c5d 100644
--- a/recipes-extended/dev86/dev86/cross.patch
+++ b/recipes-extended/dev86/dev86/cross.patch
@@ -1,6 +1,6 @@
Build ifdef using BUILD_CC, not CC.

-Upstream-Status: Pending
+Upstream-Status: Submitted [https://github.com/jbruchon/dev86/pull/22]
Signed-off-by: Ross Burton <ross.burton@...>

diff --git a/Makefile b/Makefile
diff --git a/recipes-extended/dev86/dev86_git.bb b/recipes-extended/dev86/dev86_git.bb
index 4b5a265..82f43a0 100644
--- a/recipes-extended/dev86/dev86_git.bb
+++ b/recipes-extended/dev86/dev86_git.bb
@@ -11,7 +11,8 @@ SRC_URI = "git://github.com/jbruchon/${BPN}.git;protocol=https;branch=master \
file://0001-cpp-Makefile-respect-LDFLAGS-when-building-bcc-cpp.patch \
file://0003-cpp-update-token1.tok-to-make-new-gperf-happy-regen..patch \
file://0004-regen-token2.h-token1.h-with-gperf-3.1.patch \
- file://cross.patch \
+ file://cross.patch \
+ file://0001-cpp-fix-race-writing-token.h-files.patch \
"

S = "${WORKDIR}/git"
--
2.25.1



Re: [PATCH v2 2/3] qemuboot, xen-image-minimal: enable runqemu for qemuarm Xen images

Christopher Clark
 

On Fri, Apr 29, 2022 at 6:39 AM Bertrand Marquis
<Bertrand.Marquis@...> wrote:

Hi Christopher,

On 28 Apr 2022, at 01:06, Christopher Clark via lists.yoctoproject.org <christopher.w.clark=gmail.com@...> wrote:

The Xen hypervisor built for Arm 32-bit targets can be launched with
runqemu by providing a u-boot script and configuration for Qemu, which
enables interactive testing of Xen images.

Add qemuboot-xen-u-boot.bbclass to add a new bitbake task for generating
the u-boot script. Since this increases the number of qemuboot-specific
classes that are inherited by the xen-image-minimal recipe, change the
inherit of all of these to only apply to qemu machines with the qemuall
override.

Update qemuboot-xen-defaults.bbclass to supply working default
parameters for the qemuarm machine needed to boot successfully in
testing. Also change all the arch-specific variable overrides into
narrower qemu platform overrides instead to avoid unnecessary
interactions with other Arm platform machines.
First: this does not work on my side as u-boot is stuck waiting for a dhcp
server to download something from the deploy directory but I do not quite
understand how this should work.
Hi Bertrand - thanks for testing this. It's supposed to be utilizing
the existing u-boot integration but I am also not very familiar with
all the moving pieces of that.

But more than that I think there are 2 issues here:
- qemuboot-xen-dtb is already doing exactly what you do in your uboot
script. Why not use it ?
I just hadn't had success in being able to boot Xen on arm32 in qemu
without u-boot, unfortunately, so when I had managed to get it to boot
successfully with u-boot, this is the implementation that followed
from that configuration.

- qemu arm32 can perfectly boot xen using -kernel and -dtb in the exact
same way than what is done on arm64. Why do you want to use uboot ?
I actually don't if it's not necessary - I just hadn't had luck
without it, but if we don't need the extra complexity in this layer
then we shouldn't add it. I don't know if using a current Xen and qemu
combination (ie. newer then when I started trying with it) has made a
difference but I'm happy to hear that it is working.

I will push a patch to the mailing to show how I did this.
Thanks - appreciated!

All the changes to cleanup the existing code are quite nice and it would be
good to push them in a separate patch.
Ack

Christopher

Cheers
Bertrand


Signed-off-by: Christopher Clark <christopher.clark@...>
---
Changes since v1:
- replace all qemuboot arch overrides with qemu machine platform overrides
- only include the qemu classes in the image for qemu build targets


classes/qemuboot-xen-defaults.bbclass | 26 +++-
classes/qemuboot-xen-u-boot.bbclass | 128 +++++++++++++++++++
conf/distro/include/meta-virt-xen.inc | 1 +
recipes-extended/images/xen-image-minimal.bb | 6 +-
4 files changed, 155 insertions(+), 6 deletions(-)
create mode 100644 classes/qemuboot-xen-u-boot.bbclass

diff --git a/classes/qemuboot-xen-defaults.bbclass b/classes/qemuboot-xen-defaults.bbclass
index c7e74c3..62bbf8f 100644
--- a/classes/qemuboot-xen-defaults.bbclass
+++ b/classes/qemuboot-xen-defaults.bbclass
@@ -10,21 +10,37 @@ 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 32-bit Arm loads Xen via device loader parameter rather than
+# kernel and boots using u-boot as bios
+XEN_BINARY ??= "${DEPLOY_DIR_IMAGE}/xen-${MACHINE}"
+QB_XEN_LOAD_ADDR ??= "0x46000000"
+QB_OPT_APPEND:append:qemuarm = " \
+ -device loader,file=${XEN_BINARY},addr=${QB_XEN_LOAD_ADDR},force-raw=on \
+ -device loader,file=${DOM0_KERNEL},addr=${DOM0_KERNEL_LOAD_ADDR} \
+ -bios ${DEPLOY_DIR_IMAGE}/u-boot.bin \
+ "
+QB_DEFAULT_KERNEL:qemuarm = "none"
+
# 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 = " \
+QB_OPT_APPEND:append:qemuarm64 = " \
-device loader,file=${DOM0_KERNEL},addr=${DOM0_KERNEL_LOAD_ADDR} \
"
-QB_DEFAULT_KERNEL:aarch64 = "xen-${MACHINE}"
+QB_DEFAULT_KERNEL:qemuarm64 = "xen-${MACHINE}"

+# 32-bit Arm: gic version 2
+QB_MACHINE:qemuarm = "-machine virt -machine virtualization=true"
# 64-bit Arm: gic version 3
-QB_MACHINE:aarch64 = "-machine virt,gic-version=3 -machine virtualization=true"
+QB_MACHINE:qemuarm64 = "-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}"

+# 32-bit Arm: qemuboot with a u-boot script image
+QB_XEN_U_BOOT_SCR:qemuarm = "boot.scr.uimg"
+
# 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"
+QB_DTB:qemuarm64 = "${IMAGE_NAME}.qemuboot.dtb"
+QB_DTB_LINK:qemuarm64 = "${IMAGE_LINK_NAME}.qemuboot.dtb"
diff --git a/classes/qemuboot-xen-u-boot.bbclass b/classes/qemuboot-xen-u-boot.bbclass
new file mode 100644
index 0000000..4401eba
--- /dev/null
+++ b/classes/qemuboot-xen-u-boot.bbclass
@@ -0,0 +1,128 @@
+# Enable booting Xen with qemuboot / runqemu: u-boot configuration
+#
+# Copyright (c) 2021-2022 Star Lab Corp. All rights reserved.
+#
+# Author: Christopher Clark <christopher.clark@...>
+
+# Interface variables:
+#
+# QB_XEN_U_BOOT_SCR :
+# If this variable is set, this class will generate the u-boot script image file
+# It must be set to the name of the compiled command file that u-boot will tftp
+# from the image deploy directory during boot, currently: "boot.scr.uimg"
+#
+# QB_XEN_CMDLINE_EXTRA :
+# A string to be appended to the default Xen hypervisor boot command line,
+# for supplying Xen boot options.
+# The device tree that this bbclass generates will contain Xen command
+# line options to connect the Xen console to the Qemu serial port.
+#
+# QB_XEN_LOAD_ADDR :
+# The hypervisor load address
+#
+# QB_XEN_DOM0_BOOTARGS :
+# A string for specifying Dom0 boot options for the Xen section of the device
+# tree.
+#
+# QB_XEN_UBOOT_SCR_TASK_DEPENDS:
+# The task dependencies for the u-boot script generation. A default is provided.
+#
+# QB_XEN_DOMAIN_MODULES:
+# A space-separated list of colon-separated entries:
+# "<file for the module>:<load memory address>:<module compatibility string>"
+
+# Set the default value for this variable to empty: no file generated.
+QB_XEN_U_BOOT_SCR ??= ""
+
+write_add_chosen_module() {
+ CMD_FILE="$1"
+ ADDR="$2"
+ SIZE="$3"
+ MODULE_TYPE="$4"
+ cat <<EOF >>"${CMD_FILE}"
+fdt mknod /chosen module@${ADDR}
+fdt set /chosen/module@${ADDR} compatible "multiboot,module" "${MODULE_TYPE}"
+fdt set /chosen/module@${ADDR} reg <${ADDR} ${SIZE}>
+EOF
+}
+
+generate_xen_u_boot_conf() {
+ CMD_FILE="${B}/qemuboot-xen.cmd"
+ cat <<EOF >"${CMD_FILE}"
+echo "Running u-boot launch script"
+fdt addr 0x40000000
+fdt resize
+echo "Device tree resized"
+
+fdt set /chosen \#address-cells <1>
+fdt set /chosen \#size-cells <1>
+
+fdt set /chosen xen,xen-bootargs "console=dtuart dtuart=/pl011@9000000 ${QB_XEN_CMDLINE_EXTRA}"
+fdt set /chosen xen,dom0-bootargs "${QB_XEN_DOM0_BOOTARGS}"
+EOF
+
+ if [ -z "${QB_XEN_DOMAIN_MODULES}" ]; then
+ bbwarn "No domain modules: please set QB_XEN_DOMAIN_MODULES"
+ fi
+
+ for DOMAIN_MODULE in ${QB_XEN_DOMAIN_MODULES}
+ do
+ MODULE_FILE="$(echo ${DOMAIN_MODULE} | cut -f1 -d:)"
+ ADDR="$(echo ${DOMAIN_MODULE} | cut -f2 -d:)"
+ MODULE_TYPE="$(echo ${DOMAIN_MODULE} | cut -f3 -d:)"
+ RESOLVED_FILE="$(readlink -f ${MODULE_FILE})"
+ SIZE=$(printf '0x%x\n' $(stat -c '%s' "${RESOLVED_FILE}"))
+ [ "x${SIZE}" != "x0x0" ] || bbfatal No module: "${MODULE_FILE}"
+ write_add_chosen_module "${CMD_FILE}" "${ADDR}" "${SIZE}" "${MODULE_TYPE}"
+ done
+
+ cat <<EOF >>"${CMD_FILE}"
+fdt print /chosen
+
+echo Boot Xen
+bootz ${QB_XEN_LOAD_ADDR} - 0x40000000
+EOF
+
+ uboot-mkimage -A "${UBOOT_ARCH}" -T script -C none \
+ -a 0x20000 -e 0x20000 \
+ -d "${CMD_FILE}" "${CMD_FILE}.uimg"
+
+ # u-boot tftps this filename from DEPLOY_DIR_IMAGE:
+ install -m 0644 "${CMD_FILE}.uimg" "${DEPLOY_DIR_IMAGE}/${QB_XEN_U_BOOT_SCR}"
+}
+
+do_write_qemuboot_xen_u_boot_conf() {
+ # Not all architectures qemuboot with u-boot, so check to see if this
+ # is needed. This allows this bbclass file to be used in the same image
+ # recipe for multiple architectures.
+
+ if [ -n "${QB_XEN_U_BOOT_SCR}" ] && [ -n "${QB_SYSTEM_NAME}" ] ; then
+ generate_xen_u_boot_conf
+ fi
+}
+
+addtask do_write_qemuboot_xen_u_boot_conf after do_write_qemuboot_conf before do_image
+# Task dependency:
+# An expected common case is that the kernel for at least one of the initial
+# domains (eg. dom0) is deployed from the virtual/kernel recipe, so
+# add that as a task dependency here since the kernel size needs to be known
+# for generating the device tree.
+# Dependencies are only introduced if a device tree will be generated.
+QB_XEN_UBOOT_SCR_TASK_DEPENDS ?= " \
+ ${@[ ' \
+ u-boot-tools-native:do_populate_sysroot \
+ u-boot:do_deploy \
+ virtual/kernel:do_deploy \
+ ', ''][d.getVar('QB_XEN_U_BOOT_SCR') == '']} \
+ "
+do_write_qemuboot_xen_u_boot_conf[depends] = "${QB_XEN_UBOOT_SCR_TASK_DEPENDS}"
+
+def qemuboot_xen_u_boot_vars(d):
+ build_vars = ['MACHINE', 'TUNE_ARCH', 'DEPLOY_DIR_IMAGE',
+ 'KERNEL_IMAGETYPE', 'IMAGE_NAME', 'IMAGE_LINK_NAME',
+ 'STAGING_DIR_NATIVE', 'STAGING_BINDIR_NATIVE',
+ 'STAGING_DIR_HOST', 'SERIAL_CONSOLES']
+ return build_vars + [k for k in d.keys() if k.startswith('QB_')]
+
+do_write_qemuboot_xen_u_boot[vardeps] += "${@' '.join(qemuboot_xen_u_boot_vars(d))}"
+do_write_qemuboot_xen_u_boot[vardepsexclude] += "TOPDIR"
diff --git a/conf/distro/include/meta-virt-xen.inc b/conf/distro/include/meta-virt-xen.inc
index 5fbb57f..89f98f2 100644
--- a/conf/distro/include/meta-virt-xen.inc
+++ b/conf/distro/include/meta-virt-xen.inc
@@ -12,4 +12,5 @@ include ${@bb.utils.contains('MACHINE', 'raspberrypi4-64', \
'${XEN_RPI4_64_CONFIG_PATH}', '', d)}

# Set serial for working qemuboot console
+SERIAL_CONSOLES:qemuarm ?= "115200;ttyAMA0"
SERIAL_CONSOLES:qemuarm64 ?= "115200;ttyAMA0"
diff --git a/recipes-extended/images/xen-image-minimal.bb b/recipes-extended/images/xen-image-minimal.bb
index f6fa5ed..c17c153 100644
--- a/recipes-extended/images/xen-image-minimal.bb
+++ b/recipes-extended/images/xen-image-minimal.bb
@@ -34,7 +34,11 @@ XEN_ACPI_PROCESSOR_MODULE:x86-64 = "kernel-module-xen-acpi-processor"

LICENSE = "MIT"

-inherit core-image qemuboot-xen-defaults qemuboot-xen-dtb qemuboot-testimage-network
+inherit core-image
+# Only inherit the qemuboot classes when building for a qemu machine
+QB_QEMU_CLASSES = ""
+QB_QEMU_CLASSES:qemuall = "qemuboot-xen-defaults qemuboot-xen-dtb qemuboot-xen-u-boot qemuboot-testimage-network"
+inherit ${QB_QEMU_CLASSES}

do_check_xen_state() {
if [ "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' yes', 'no', d)}" = "no" ]; then
--
2.25.1



IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


[PATCH] dev86: fix a build race

Ross Burton
 

Fix a race in cpp/ where token[12].h are written to a temporary file
with the same name.

Also update the status of cross.patch.

Signed-off-by: Ross Burton <ross.burton@...>
---
...1-cpp-fix-race-writing-token.h-files.patch | 42 +++++++++++++++++++
recipes-extended/dev86/dev86/cross.patch | 2 +-
recipes-extended/dev86/dev86_git.bb | 3 +-
3 files changed, 45 insertions(+), 2 deletions(-)
create mode 100644 recipes-extended/dev86/dev86/0001-cpp-fix-race-writin=
g-token.h-files.patch

diff --git a/recipes-extended/dev86/dev86/0001-cpp-fix-race-writing-token=
.h-files.patch b/recipes-extended/dev86/dev86/0001-cpp-fix-race-writing-t=
oken.h-files.patch
new file mode 100644
index 0000000..d6e7999
--- /dev/null
+++ b/recipes-extended/dev86/dev86/0001-cpp-fix-race-writing-token.h-file=
s.patch
@@ -0,0 +1,42 @@
+Upstream-Status: Submitted [https://github.com/jbruchon/dev86/pull/23]
+Signed-off-by: Ross Burton <ross.burton@...>
+
+From f507ee398ae20e4e97f01dfbd9a8709a90bc760f Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@...>
+Date: Fri, 29 Apr 2022 16:44:08 +0100
+Subject: [PATCH] cpp: fix race writing token.h files
+
+The rules for token1.h and token2.h both write to a temporary file tmp.h
+before renaming to token1.h or token2.h. However, in a parallel build
+these will execute at the same time and race.
+
+ gperf -aptTc -N is_ctok -H hash1 token1.tok > tmp.h
+ gperf -aptTc -k1,3 -N is_ckey -H hash2 token2.tok > tmp.h
+ mv tmp.h token1.h
+ mv tmp.h token2.h
+ mv: cannot stat 'tmp.h': No such file or directory
+
+By using gperf --output-file, the race is avoided entirely.
+---
+ cpp/Makefile | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/cpp/Makefile b/cpp/Makefile
+index 0ea43cc..743694f 100644
+--- a/cpp/Makefile
++++ b/cpp/Makefile
+@@ -20,9 +20,7 @@ token1.o: token1.h
+ token2.o: token2.h
+=20
+ token1.h: token1.tok
+- gperf -aptTc -N is_ctok -H hash1 token1.tok > tmp.h
+- mv tmp.h token1.h
++ gperf -aptTc -N is_ctok -H hash1 --output-file $@ $<
+=20
+ token2.h: token2.tok
+- gperf -aptTc -k1,3 -N is_ckey -H hash2 token2.tok > tmp.h
+- mv tmp.h token2.h
++ gperf -aptTc -k1,3 -N is_ckey -H hash2 --output-file $@ $<
+--=20
+2.25.1
+
diff --git a/recipes-extended/dev86/dev86/cross.patch b/recipes-extended/=
dev86/dev86/cross.patch
index 041a8d3..fd62c5d 100644
--- a/recipes-extended/dev86/dev86/cross.patch
+++ b/recipes-extended/dev86/dev86/cross.patch
@@ -1,6 +1,6 @@
Build ifdef using BUILD_CC, not CC.
=20
-Upstream-Status: Pending
+Upstream-Status: Submitted [https://github.com/jbruchon/dev86/pull/22]
Signed-off-by: Ross Burton <ross.burton@...>
=20
diff --git a/Makefile b/Makefile
diff --git a/recipes-extended/dev86/dev86_git.bb b/recipes-extended/dev86=
/dev86_git.bb
index 4b5a265..82f43a0 100644
--- a/recipes-extended/dev86/dev86_git.bb
+++ b/recipes-extended/dev86/dev86_git.bb
@@ -11,7 +11,8 @@ SRC_URI =3D "git://github.com/jbruchon/${BPN}.git;proto=
col=3Dhttps;branch=3Dmaster \
file://0001-cpp-Makefile-respect-LDFLAGS-when-building-bcc-cpp.patch=
\
file://0003-cpp-update-token1.tok-to-make-new-gperf-happy-regen..pat=
ch \
file://0004-regen-token2.h-token1.h-with-gperf-3.1.patch \
- file://cross.patch \
+ file://cross.patch \
+ file://0001-cpp-fix-race-writing-token.h-files.patch \
"
=20
S =3D "${WORKDIR}/git"
--=20
2.25.1


[PATCH] xen: enable qemuboot for arm32

Bertrand Marquis
 

Modify qemuboot-xen-dtb to use QB_MACHINE to dump the device tree to
make it compatible with other boards.
Add required variables to generate a qemuboot devicetree for qemuarm.

With this change, Xen and dom0 can be started using qemu with runqemu.

Also fix qemuboot-xen-dtb to properly add dom0 bootargs by using a
parameter instead of directly using the QB_XEN_DOM0_BOOTARGS inside the
function (not sure why it is solving the issue but it works).

Signed-off-by: Bertrand Marquis <bertrand.marquis@...>
---
classes/qemuboot-xen-defaults.bbclass | 12 +++++++++++-
classes/qemuboot-xen-dtb.bbclass | 9 +++++----
2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/classes/qemuboot-xen-defaults.bbclass b/classes/qemuboot-xen=
-defaults.bbclass
index c7e74c3..c5615e7 100644
--- a/classes/qemuboot-xen-defaults.bbclass
+++ b/classes/qemuboot-xen-defaults.bbclass
@@ -10,15 +10,21 @@ DOM0_KERNEL ??=3D "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE=
TYPE}"
DOM0_KERNEL_LOAD_ADDR ??=3D "0x45000000"
QB_XEN_DOMAIN_MODULES ??=3D "${DOM0_KERNEL}:${DOM0_KERNEL_LOAD_ADDR}:mul=
tiboot,kernel"
=20
-# Qemuboot for 64-bit Arm uses the QB_DEFAULT_KERNEL method to load Xen
+# Qemuboot for Arm uses the QB_DEFAULT_KERNEL method to load Xen
# and the device loader option for the dom0 kernel:
QB_OPT_APPEND:append:aarch64 =3D " \
-device loader,file=3D${DOM0_KERNEL},addr=3D${DOM0_KERNEL_LOAD_ADDR}=
\
"
+QB_OPT_APPEND:append:qemuarm =3D " \
+ -device loader,file=3D${DOM0_KERNEL},addr=3D${DOM0_KERNEL_LOAD_ADDR}=
\
+ "
QB_DEFAULT_KERNEL:aarch64 =3D "xen-${MACHINE}"
+QB_DEFAULT_KERNEL:qemuarm =3D "xen-${MACHINE}"
=20
# 64-bit Arm: gic version 3
QB_MACHINE:aarch64 =3D "-machine virt,gic-version=3D3 -machine virtualiz=
ation=3Dtrue"
+# 32-bit Arm
+QB_MACHINE:qemuarm =3D "-machine virt -machine virtualization=3Dtrue"
=20
# Increase the default qemu memory allocation to allow for the hyperviso=
r.
# Use a weak assignment to allow for change of default and override else=
where.
@@ -28,3 +34,7 @@ QB_MEM =3D "-m ${QB_MEM_VALUE}"
# 64-bit Arm: qemuboot with a device tree binary
QB_DTB:aarch64 =3D "${IMAGE_NAME}.qemuboot.dtb"
QB_DTB_LINK:aarch64 =3D "${IMAGE_LINK_NAME}.qemuboot.dtb"
+
+# 32-bit Arm: qemuboot with a device tree binary
+QB_DTB:qemuarm =3D "${IMAGE_NAME}.qemuboot.dtb"
+QB_DTB_LINK:qemuarm =3D "${IMAGE_LINK_NAME}.qemuboot.dtb"
diff --git a/classes/qemuboot-xen-dtb.bbclass b/classes/qemuboot-xen-dtb.=
bbclass
index 6fe3164..d43d23a 100644
--- a/classes/qemuboot-xen-dtb.bbclass
+++ b/classes/qemuboot-xen-dtb.bbclass
@@ -29,6 +29,7 @@
# See also: Other QB_ variables as defined by the qemuboot.bbclass.
=20
write_lops_xen_section() {
+ DOM0_BOOTARGS=3D"$2"
cat <<EOF >"$1"
/dts-v1/;
/ {
@@ -47,7 +48,7 @@ write_lops_xen_section() {
};
lop_2 {
compatible =3D "system-device-tree-v1,lop,modify";
- modify =3D "/chosen:xen,dom0-bootargs:${QB_XEN_DOM0_BOOTARGS=
}";
+ modify =3D "/chosen:xen,dom0-bootargs:${DOM0_BOOTARGS}";
};
lop_3 {
compatible =3D "system-device-tree-v1,lop,modify";
@@ -118,8 +119,7 @@ generate_xen_qemuboot_dtb() {
-device qemu-xhci \
-device usb-tablet \
-device usb-kbd \
- -machine virt,gic-version=3D3 \
- -machine virtualization=3Dtrue \
+ ${QB_MACHINE} \
${QB_CPU} \
${QB_SMP} \
${QB_MEM} \
@@ -129,7 +129,8 @@ generate_xen_qemuboot_dtb() {
=20
# Lopper generates temporary files in cwd, so run it within ${B}
cd "${B}"
- write_lops_xen_section "${B}/lop-insert-xen-section.dts"
+ write_lops_xen_section "${B}/lop-insert-xen-section.dts" \
+ "${QB_XEN_DOM0_BOOTARGS}"
=20
write_lop_add_to_xen_cmdline "${B}/lop-xen-cmdline.dts" \
"${QB_XEN_CMDLINE_EXTRA}"
--=20
2.25.1


Re: [PATCH v2 1/3] xen, xen-tools: add recommendation for Qemu for non-hvm x86

Bertrand Marquis
 

Hi Bruce,

On 29 Apr 2022, at 14:30, Bruce Ashfield <bruce.ashfield@...> wrote:

On Fri, Apr 29, 2022 at 9:23 AM Bertrand Marquis
<Bertrand.Marquis@...> wrote:

Hi Christopher,

On 28 Apr 2022, at 01:06, Christopher Clark via lists.yoctoproject.org <christopher.w.clark=gmail.com@...> wrote:

The Spectre and Meltdown mitigations for Xen run PV guests within
HVM virtual machines, so Qemu is no longer only needed for systems
configured to run HVM guests.

With the split xen hypervisor and tools recipes, the bios dependencies
belong in the tools recipe, so move them and replace the hvm
PACKAGECONFIG option with the recommendation based on target arch.

Signed-off-by: Christopher Clark <christopher.clark@...>
Reviewed-by: Bertrand Marquis <bertrand.marquis@...>

I can build and run on x86 qemu and I get stuck during init in Dom0 (which is apparently already known).
It is likely the xencommond init.d still causing issues.

I'm doing a revert of all those changes locally, and will start some tests.
Please let me know if you need some testing.
On my side, I have the issue on arm64, arm32 and x86 at the moment.

Chees
Bertrand


Bruce

Cheers
Bertrand


---
Unchanged since v1

recipes-extended/xen/xen-tools.inc | 9 ++-------
recipes-extended/xen/xen.inc | 6 +++---
2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/recipes-extended/xen/xen-tools.inc b/recipes-extended/xen/xen-tools.inc
index 6bbc8cd..54bc477 100644
--- a/recipes-extended/xen/xen-tools.inc
+++ b/recipes-extended/xen/xen-tools.inc
@@ -30,14 +30,9 @@ RDEPENDS:${PN} = "\

RDEPENDS:${PN}-dev = ""

-# Qemu is necessary on ARM platforms, and to support HVM guests on x86
-QEMU = "${@bb.utils.contains('PACKAGECONFIG', 'hvm', 'qemu', '', d)}"
-QEMU:arm = "qemu"
-QEMU:aarch64 = "qemu"
-
RRECOMMENDS:${PN} = " \
- ${QEMU} \
- ${@bb.utils.contains('PACKAGECONFIG', 'hvm', 'seabios', '', d)} \
+ qemu \
+ ${@bb.utils.contains('XEN_TARGET_ARCH', 'x86_64', 'seabios ipxe vgabios', '', d)} \
${@bb.utils.contains('PACKAGECONFIG', 'externalblktap', '', '${BLKTAP_RRECOMMENDS}', d)} \
${PN}-flask \
${PN}-hvmloader \
diff --git a/recipes-extended/xen/xen.inc b/recipes-extended/xen/xen.inc
index 8b86de5..4c38ccf 100644
--- a/recipes-extended/xen/xen.inc
+++ b/recipes-extended/xen/xen.inc
@@ -9,13 +9,11 @@ require xen-arch.inc
PACKAGECONFIG ??= " \
sdl \
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
- ${@bb.utils.contains('XEN_TARGET_ARCH', 'x86_64', 'hvm', '', d)} \
"

PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,virtual/libsdl,"
PACKAGECONFIG[xsm] = "--enable-xsmpolicy,--disable-xsmpolicy,checkpolicy-native,"
PACKAGECONFIG[systemd] = "--enable-systemd,--disable-systemd,systemd,"
-PACKAGECONFIG[hvm] = "--with-system-seabios="/usr/share/firmware/bios.bin",--disable-seabios,seabios ipxe vgabios,"
PACKAGECONFIG[externalblktap] = ",,,"

DEPENDS = " \
@@ -132,7 +130,9 @@ EXTRA_OECONF += " \
--disable-rombios \
--disable-ocamltools \
--disable-qemu-traditional \
- ${@bb.utils.contains('XEN_TARGET_ARCH', 'x86_64', '--enable-pvshim', '--disable-pvshim', d)} \
+ ${@bb.utils.contains('XEN_TARGET_ARCH', 'x86_64', \
+ '--enable-pvshim --with-system-seabios="/usr/share/firmware/bios.bin"', \
+ '--disable-pvshim --disable-seabios', d)} \
"

EXTRA_OEMAKE += "STDVGA_ROM=${STAGING_DIR_HOST}/usr/share/firmware/vgabios-0.7a.bin"
--
2.25.1



IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


--
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


Re: [PATCH v2 2/3] qemuboot, xen-image-minimal: enable runqemu for qemuarm Xen images

Bertrand Marquis
 

Hi Christopher,

On 28 Apr 2022, at 01:06, Christopher Clark via lists.yoctoproject.org <christopher.w.clark=gmail.com@...> wrote:

The Xen hypervisor built for Arm 32-bit targets can be launched with
runqemu by providing a u-boot script and configuration for Qemu, which
enables interactive testing of Xen images.

Add qemuboot-xen-u-boot.bbclass to add a new bitbake task for generating
the u-boot script. Since this increases the number of qemuboot-specific
classes that are inherited by the xen-image-minimal recipe, change the
inherit of all of these to only apply to qemu machines with the qemuall
override.

Update qemuboot-xen-defaults.bbclass to supply working default
parameters for the qemuarm machine needed to boot successfully in
testing. Also change all the arch-specific variable overrides into
narrower qemu platform overrides instead to avoid unnecessary
interactions with other Arm platform machines.
First: this does not work on my side as u-boot is stuck waiting for a dhcp
server to download something from the deploy directory but I do not quite
understand how this should work.

But more than that I think there are 2 issues here:
- qemuboot-xen-dtb is already doing exactly what you do in your uboot
script. Why not use it ?
- qemu arm32 can perfectly boot xen using -kernel and -dtb in the exact
same way than what is done on arm64. Why do you want to use uboot ?

I will push a patch to the mailing to show how I did this.

All the changes to cleanup the existing code are quite nice and it would be
good to push them in a separate patch.

Cheers
Bertrand


Signed-off-by: Christopher Clark <christopher.clark@...>
---
Changes since v1:
- replace all qemuboot arch overrides with qemu machine platform overrides
- only include the qemu classes in the image for qemu build targets


classes/qemuboot-xen-defaults.bbclass | 26 +++-
classes/qemuboot-xen-u-boot.bbclass | 128 +++++++++++++++++++
conf/distro/include/meta-virt-xen.inc | 1 +
recipes-extended/images/xen-image-minimal.bb | 6 +-
4 files changed, 155 insertions(+), 6 deletions(-)
create mode 100644 classes/qemuboot-xen-u-boot.bbclass

diff --git a/classes/qemuboot-xen-defaults.bbclass b/classes/qemuboot-xen-defaults.bbclass
index c7e74c3..62bbf8f 100644
--- a/classes/qemuboot-xen-defaults.bbclass
+++ b/classes/qemuboot-xen-defaults.bbclass
@@ -10,21 +10,37 @@ 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 32-bit Arm loads Xen via device loader parameter rather than
+# kernel and boots using u-boot as bios
+XEN_BINARY ??= "${DEPLOY_DIR_IMAGE}/xen-${MACHINE}"
+QB_XEN_LOAD_ADDR ??= "0x46000000"
+QB_OPT_APPEND:append:qemuarm = " \
+ -device loader,file=${XEN_BINARY},addr=${QB_XEN_LOAD_ADDR},force-raw=on \
+ -device loader,file=${DOM0_KERNEL},addr=${DOM0_KERNEL_LOAD_ADDR} \
+ -bios ${DEPLOY_DIR_IMAGE}/u-boot.bin \
+ "
+QB_DEFAULT_KERNEL:qemuarm = "none"
+
# 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 = " \
+QB_OPT_APPEND:append:qemuarm64 = " \
-device loader,file=${DOM0_KERNEL},addr=${DOM0_KERNEL_LOAD_ADDR} \
"
-QB_DEFAULT_KERNEL:aarch64 = "xen-${MACHINE}"
+QB_DEFAULT_KERNEL:qemuarm64 = "xen-${MACHINE}"

+# 32-bit Arm: gic version 2
+QB_MACHINE:qemuarm = "-machine virt -machine virtualization=true"
# 64-bit Arm: gic version 3
-QB_MACHINE:aarch64 = "-machine virt,gic-version=3 -machine virtualization=true"
+QB_MACHINE:qemuarm64 = "-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}"

+# 32-bit Arm: qemuboot with a u-boot script image
+QB_XEN_U_BOOT_SCR:qemuarm = "boot.scr.uimg"
+
# 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"
+QB_DTB:qemuarm64 = "${IMAGE_NAME}.qemuboot.dtb"
+QB_DTB_LINK:qemuarm64 = "${IMAGE_LINK_NAME}.qemuboot.dtb"
diff --git a/classes/qemuboot-xen-u-boot.bbclass b/classes/qemuboot-xen-u-boot.bbclass
new file mode 100644
index 0000000..4401eba
--- /dev/null
+++ b/classes/qemuboot-xen-u-boot.bbclass
@@ -0,0 +1,128 @@
+# Enable booting Xen with qemuboot / runqemu: u-boot configuration
+#
+# Copyright (c) 2021-2022 Star Lab Corp. All rights reserved.
+#
+# Author: Christopher Clark <christopher.clark@...>
+
+# Interface variables:
+#
+# QB_XEN_U_BOOT_SCR :
+# If this variable is set, this class will generate the u-boot script image file
+# It must be set to the name of the compiled command file that u-boot will tftp
+# from the image deploy directory during boot, currently: "boot.scr.uimg"
+#
+# QB_XEN_CMDLINE_EXTRA :
+# A string to be appended to the default Xen hypervisor boot command line,
+# for supplying Xen boot options.
+# The device tree that this bbclass generates will contain Xen command
+# line options to connect the Xen console to the Qemu serial port.
+#
+# QB_XEN_LOAD_ADDR :
+# The hypervisor load address
+#
+# QB_XEN_DOM0_BOOTARGS :
+# A string for specifying Dom0 boot options for the Xen section of the device
+# tree.
+#
+# QB_XEN_UBOOT_SCR_TASK_DEPENDS:
+# The task dependencies for the u-boot script generation. A default is provided.
+#
+# QB_XEN_DOMAIN_MODULES:
+# A space-separated list of colon-separated entries:
+# "<file for the module>:<load memory address>:<module compatibility string>"
+
+# Set the default value for this variable to empty: no file generated.
+QB_XEN_U_BOOT_SCR ??= ""
+
+write_add_chosen_module() {
+ CMD_FILE="$1"
+ ADDR="$2"
+ SIZE="$3"
+ MODULE_TYPE="$4"
+ cat <<EOF >>"${CMD_FILE}"
+fdt mknod /chosen module@${ADDR}
+fdt set /chosen/module@${ADDR} compatible "multiboot,module" "${MODULE_TYPE}"
+fdt set /chosen/module@${ADDR} reg <${ADDR} ${SIZE}>
+EOF
+}
+
+generate_xen_u_boot_conf() {
+ CMD_FILE="${B}/qemuboot-xen.cmd"
+ cat <<EOF >"${CMD_FILE}"
+echo "Running u-boot launch script"
+fdt addr 0x40000000
+fdt resize
+echo "Device tree resized"
+
+fdt set /chosen \#address-cells <1>
+fdt set /chosen \#size-cells <1>
+
+fdt set /chosen xen,xen-bootargs "console=dtuart dtuart=/pl011@9000000 ${QB_XEN_CMDLINE_EXTRA}"
+fdt set /chosen xen,dom0-bootargs "${QB_XEN_DOM0_BOOTARGS}"
+EOF
+
+ if [ -z "${QB_XEN_DOMAIN_MODULES}" ]; then
+ bbwarn "No domain modules: please set QB_XEN_DOMAIN_MODULES"
+ fi
+
+ for DOMAIN_MODULE in ${QB_XEN_DOMAIN_MODULES}
+ do
+ MODULE_FILE="$(echo ${DOMAIN_MODULE} | cut -f1 -d:)"
+ ADDR="$(echo ${DOMAIN_MODULE} | cut -f2 -d:)"
+ MODULE_TYPE="$(echo ${DOMAIN_MODULE} | cut -f3 -d:)"
+ RESOLVED_FILE="$(readlink -f ${MODULE_FILE})"
+ SIZE=$(printf '0x%x\n' $(stat -c '%s' "${RESOLVED_FILE}"))
+ [ "x${SIZE}" != "x0x0" ] || bbfatal No module: "${MODULE_FILE}"
+ write_add_chosen_module "${CMD_FILE}" "${ADDR}" "${SIZE}" "${MODULE_TYPE}"
+ done
+
+ cat <<EOF >>"${CMD_FILE}"
+fdt print /chosen
+
+echo Boot Xen
+bootz ${QB_XEN_LOAD_ADDR} - 0x40000000
+EOF
+
+ uboot-mkimage -A "${UBOOT_ARCH}" -T script -C none \
+ -a 0x20000 -e 0x20000 \
+ -d "${CMD_FILE}" "${CMD_FILE}.uimg"
+
+ # u-boot tftps this filename from DEPLOY_DIR_IMAGE:
+ install -m 0644 "${CMD_FILE}.uimg" "${DEPLOY_DIR_IMAGE}/${QB_XEN_U_BOOT_SCR}"
+}
+
+do_write_qemuboot_xen_u_boot_conf() {
+ # Not all architectures qemuboot with u-boot, so check to see if this
+ # is needed. This allows this bbclass file to be used in the same image
+ # recipe for multiple architectures.
+
+ if [ -n "${QB_XEN_U_BOOT_SCR}" ] && [ -n "${QB_SYSTEM_NAME}" ] ; then
+ generate_xen_u_boot_conf
+ fi
+}
+
+addtask do_write_qemuboot_xen_u_boot_conf after do_write_qemuboot_conf before do_image
+# Task dependency:
+# An expected common case is that the kernel for at least one of the initial
+# domains (eg. dom0) is deployed from the virtual/kernel recipe, so
+# add that as a task dependency here since the kernel size needs to be known
+# for generating the device tree.
+# Dependencies are only introduced if a device tree will be generated.
+QB_XEN_UBOOT_SCR_TASK_DEPENDS ?= " \
+ ${@[ ' \
+ u-boot-tools-native:do_populate_sysroot \
+ u-boot:do_deploy \
+ virtual/kernel:do_deploy \
+ ', ''][d.getVar('QB_XEN_U_BOOT_SCR') == '']} \
+ "
+do_write_qemuboot_xen_u_boot_conf[depends] = "${QB_XEN_UBOOT_SCR_TASK_DEPENDS}"
+
+def qemuboot_xen_u_boot_vars(d):
+ build_vars = ['MACHINE', 'TUNE_ARCH', 'DEPLOY_DIR_IMAGE',
+ 'KERNEL_IMAGETYPE', 'IMAGE_NAME', 'IMAGE_LINK_NAME',
+ 'STAGING_DIR_NATIVE', 'STAGING_BINDIR_NATIVE',
+ 'STAGING_DIR_HOST', 'SERIAL_CONSOLES']
+ return build_vars + [k for k in d.keys() if k.startswith('QB_')]
+
+do_write_qemuboot_xen_u_boot[vardeps] += "${@' '.join(qemuboot_xen_u_boot_vars(d))}"
+do_write_qemuboot_xen_u_boot[vardepsexclude] += "TOPDIR"
diff --git a/conf/distro/include/meta-virt-xen.inc b/conf/distro/include/meta-virt-xen.inc
index 5fbb57f..89f98f2 100644
--- a/conf/distro/include/meta-virt-xen.inc
+++ b/conf/distro/include/meta-virt-xen.inc
@@ -12,4 +12,5 @@ include ${@bb.utils.contains('MACHINE', 'raspberrypi4-64', \
'${XEN_RPI4_64_CONFIG_PATH}', '', d)}

# Set serial for working qemuboot console
+SERIAL_CONSOLES:qemuarm ?= "115200;ttyAMA0"
SERIAL_CONSOLES:qemuarm64 ?= "115200;ttyAMA0"
diff --git a/recipes-extended/images/xen-image-minimal.bb b/recipes-extended/images/xen-image-minimal.bb
index f6fa5ed..c17c153 100644
--- a/recipes-extended/images/xen-image-minimal.bb
+++ b/recipes-extended/images/xen-image-minimal.bb
@@ -34,7 +34,11 @@ XEN_ACPI_PROCESSOR_MODULE:x86-64 = "kernel-module-xen-acpi-processor"

LICENSE = "MIT"

-inherit core-image qemuboot-xen-defaults qemuboot-xen-dtb qemuboot-testimage-network
+inherit core-image
+# Only inherit the qemuboot classes when building for a qemu machine
+QB_QEMU_CLASSES = ""
+QB_QEMU_CLASSES:qemuall = "qemuboot-xen-defaults qemuboot-xen-dtb qemuboot-xen-u-boot qemuboot-testimage-network"
+inherit ${QB_QEMU_CLASSES}

do_check_xen_state() {
if [ "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' yes', 'no', d)}" = "no" ]; then
--
2.25.1



IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


Re: [PATCH v2 1/3] xen, xen-tools: add recommendation for Qemu for non-hvm x86

Bruce Ashfield
 

On Fri, Apr 29, 2022 at 9:23 AM Bertrand Marquis
<Bertrand.Marquis@...> wrote:

Hi Christopher,

On 28 Apr 2022, at 01:06, Christopher Clark via lists.yoctoproject.org <christopher.w.clark=gmail.com@...> wrote:

The Spectre and Meltdown mitigations for Xen run PV guests within
HVM virtual machines, so Qemu is no longer only needed for systems
configured to run HVM guests.

With the split xen hypervisor and tools recipes, the bios dependencies
belong in the tools recipe, so move them and replace the hvm
PACKAGECONFIG option with the recommendation based on target arch.

Signed-off-by: Christopher Clark <christopher.clark@...>
Reviewed-by: Bertrand Marquis <bertrand.marquis@...>

I can build and run on x86 qemu and I get stuck during init in Dom0 (which is apparently already known).
It is likely the xencommond init.d still causing issues.

I'm doing a revert of all those changes locally, and will start some tests.

Bruce

Cheers
Bertrand


---
Unchanged since v1

recipes-extended/xen/xen-tools.inc | 9 ++-------
recipes-extended/xen/xen.inc | 6 +++---
2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/recipes-extended/xen/xen-tools.inc b/recipes-extended/xen/xen-tools.inc
index 6bbc8cd..54bc477 100644
--- a/recipes-extended/xen/xen-tools.inc
+++ b/recipes-extended/xen/xen-tools.inc
@@ -30,14 +30,9 @@ RDEPENDS:${PN} = "\

RDEPENDS:${PN}-dev = ""

-# Qemu is necessary on ARM platforms, and to support HVM guests on x86
-QEMU = "${@bb.utils.contains('PACKAGECONFIG', 'hvm', 'qemu', '', d)}"
-QEMU:arm = "qemu"
-QEMU:aarch64 = "qemu"
-
RRECOMMENDS:${PN} = " \
- ${QEMU} \
- ${@bb.utils.contains('PACKAGECONFIG', 'hvm', 'seabios', '', d)} \
+ qemu \
+ ${@bb.utils.contains('XEN_TARGET_ARCH', 'x86_64', 'seabios ipxe vgabios', '', d)} \
${@bb.utils.contains('PACKAGECONFIG', 'externalblktap', '', '${BLKTAP_RRECOMMENDS}', d)} \
${PN}-flask \
${PN}-hvmloader \
diff --git a/recipes-extended/xen/xen.inc b/recipes-extended/xen/xen.inc
index 8b86de5..4c38ccf 100644
--- a/recipes-extended/xen/xen.inc
+++ b/recipes-extended/xen/xen.inc
@@ -9,13 +9,11 @@ require xen-arch.inc
PACKAGECONFIG ??= " \
sdl \
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
- ${@bb.utils.contains('XEN_TARGET_ARCH', 'x86_64', 'hvm', '', d)} \
"

PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,virtual/libsdl,"
PACKAGECONFIG[xsm] = "--enable-xsmpolicy,--disable-xsmpolicy,checkpolicy-native,"
PACKAGECONFIG[systemd] = "--enable-systemd,--disable-systemd,systemd,"
-PACKAGECONFIG[hvm] = "--with-system-seabios="/usr/share/firmware/bios.bin",--disable-seabios,seabios ipxe vgabios,"
PACKAGECONFIG[externalblktap] = ",,,"

DEPENDS = " \
@@ -132,7 +130,9 @@ EXTRA_OECONF += " \
--disable-rombios \
--disable-ocamltools \
--disable-qemu-traditional \
- ${@bb.utils.contains('XEN_TARGET_ARCH', 'x86_64', '--enable-pvshim', '--disable-pvshim', d)} \
+ ${@bb.utils.contains('XEN_TARGET_ARCH', 'x86_64', \
+ '--enable-pvshim --with-system-seabios="/usr/share/firmware/bios.bin"', \
+ '--disable-pvshim --disable-seabios', d)} \
"

EXTRA_OEMAKE += "STDVGA_ROM=${STAGING_DIR_HOST}/usr/share/firmware/vgabios-0.7a.bin"
--
2.25.1



IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


--
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II


Re: [PATCH v2 1/3] xen, xen-tools: add recommendation for Qemu for non-hvm x86

Bertrand Marquis
 

Hi Christopher,

On 28 Apr 2022, at 01:06, Christopher Clark via lists.yoctoproject.org <christopher.w.clark=gmail.com@...> wrote:

The Spectre and Meltdown mitigations for Xen run PV guests within
HVM virtual machines, so Qemu is no longer only needed for systems
configured to run HVM guests.

With the split xen hypervisor and tools recipes, the bios dependencies
belong in the tools recipe, so move them and replace the hvm
PACKAGECONFIG option with the recommendation based on target arch.

Signed-off-by: Christopher Clark <christopher.clark@...>
Reviewed-by: Bertrand Marquis <bertrand.marquis@...>

I can build and run on x86 qemu and I get stuck during init in Dom0 (which is apparently already known).

Cheers
Bertrand


---
Unchanged since v1

recipes-extended/xen/xen-tools.inc | 9 ++-------
recipes-extended/xen/xen.inc | 6 +++---
2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/recipes-extended/xen/xen-tools.inc b/recipes-extended/xen/xen-tools.inc
index 6bbc8cd..54bc477 100644
--- a/recipes-extended/xen/xen-tools.inc
+++ b/recipes-extended/xen/xen-tools.inc
@@ -30,14 +30,9 @@ RDEPENDS:${PN} = "\

RDEPENDS:${PN}-dev = ""

-# Qemu is necessary on ARM platforms, and to support HVM guests on x86
-QEMU = "${@bb.utils.contains('PACKAGECONFIG', 'hvm', 'qemu', '', d)}"
-QEMU:arm = "qemu"
-QEMU:aarch64 = "qemu"
-
RRECOMMENDS:${PN} = " \
- ${QEMU} \
- ${@bb.utils.contains('PACKAGECONFIG', 'hvm', 'seabios', '', d)} \
+ qemu \
+ ${@bb.utils.contains('XEN_TARGET_ARCH', 'x86_64', 'seabios ipxe vgabios', '', d)} \
${@bb.utils.contains('PACKAGECONFIG', 'externalblktap', '', '${BLKTAP_RRECOMMENDS}', d)} \
${PN}-flask \
${PN}-hvmloader \
diff --git a/recipes-extended/xen/xen.inc b/recipes-extended/xen/xen.inc
index 8b86de5..4c38ccf 100644
--- a/recipes-extended/xen/xen.inc
+++ b/recipes-extended/xen/xen.inc
@@ -9,13 +9,11 @@ require xen-arch.inc
PACKAGECONFIG ??= " \
sdl \
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
- ${@bb.utils.contains('XEN_TARGET_ARCH', 'x86_64', 'hvm', '', d)} \
"

PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,virtual/libsdl,"
PACKAGECONFIG[xsm] = "--enable-xsmpolicy,--disable-xsmpolicy,checkpolicy-native,"
PACKAGECONFIG[systemd] = "--enable-systemd,--disable-systemd,systemd,"
-PACKAGECONFIG[hvm] = "--with-system-seabios="/usr/share/firmware/bios.bin",--disable-seabios,seabios ipxe vgabios,"
PACKAGECONFIG[externalblktap] = ",,,"

DEPENDS = " \
@@ -132,7 +130,9 @@ EXTRA_OECONF += " \
--disable-rombios \
--disable-ocamltools \
--disable-qemu-traditional \
- ${@bb.utils.contains('XEN_TARGET_ARCH', 'x86_64', '--enable-pvshim', '--disable-pvshim', d)} \
+ ${@bb.utils.contains('XEN_TARGET_ARCH', 'x86_64', \
+ '--enable-pvshim --with-system-seabios="/usr/share/firmware/bios.bin"', \
+ '--disable-pvshim --disable-seabios', d)} \
"

EXTRA_OEMAKE += "STDVGA_ROM=${STAGING_DIR_HOST}/usr/share/firmware/vgabios-0.7a.bin"
--
2.25.1



IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


[PATCH 2/2] xen: use vgabios 0.8a

Ross Burton
 

Signed-off-by: Ross Burton <ross.burton@...>
---
recipes-extended/xen/xen.inc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/recipes-extended/xen/xen.inc b/recipes-extended/xen/xen.inc
index 8b86de5..bb7bdb8 100644
--- a/recipes-extended/xen/xen.inc
+++ b/recipes-extended/xen/xen.inc
@@ -135,8 +135,8 @@ EXTRA_OECONF +=3D " \
${@bb.utils.contains('XEN_TARGET_ARCH', 'x86_64', '--enable-pvshim',=
'--disable-pvshim', d)} \
"
=20
-EXTRA_OEMAKE +=3D "STDVGA_ROM=3D${STAGING_DIR_HOST}/usr/share/firmware/v=
gabios-0.7a.bin"
-EXTRA_OEMAKE +=3D "CIRRUSVGA_ROM=3D${STAGING_DIR_HOST}/usr/share/firmwar=
e/vgabios-0.7a.cirrus.bin"
+EXTRA_OEMAKE +=3D "STDVGA_ROM=3D${STAGING_DIR_HOST}/usr/share/firmware/v=
gabios-0.8a.bin"
+EXTRA_OEMAKE +=3D "CIRRUSVGA_ROM=3D${STAGING_DIR_HOST}/usr/share/firmwar=
e/vgabios-0.8a.cirrus.bin"
EXTRA_OEMAKE +=3D "SEABIOS_ROM=3D${STAGING_DIR_HOST}/usr/share/firmware/=
bios.bin"
EXTRA_OEMAKE +=3D "ETHERBOOT_ROMS=3D${STAGING_DIR_HOST}/usr/share/firmwa=
re/rtl8139.rom"
=20
--=20
2.25.1


[PATCH 1/2] vgabios: upgrade to 0.8a and cleanup recipe

Ross Burton
 

Upgrade to 0.8a.

License checksum updated as the FSF street address changed.

Apply a patch to use the correct host compiler when building biossums,
removing the need for a separate biossums-native recipe.

Don't hardcode /usr/share, use ${datadir}.

Install all found firmware (including the new Banshee BIOS in 0.8a) and
the debug files which were not installed but intended to be packaged.

Remove redundant PR and S assignments, as these are the default values.

Signed-off-by: Ross Burton <ross.burton@...>
---
recipes-extended/vgabios/biossums_0.7a.bb | 37 -------------------
recipes-extended/vgabios/files/build-cc.patch | 30 +++++++++++++++
recipes-extended/vgabios/vgabios_0.7a.bb | 33 -----------------
recipes-extended/vgabios/vgabios_0.8a.bb | 25 +++++++++++++
4 files changed, 55 insertions(+), 70 deletions(-)
delete mode 100644 recipes-extended/vgabios/biossums_0.7a.bb
create mode 100644 recipes-extended/vgabios/files/build-cc.patch
delete mode 100644 recipes-extended/vgabios/vgabios_0.7a.bb
create mode 100644 recipes-extended/vgabios/vgabios_0.8a.bb

diff --git a/recipes-extended/vgabios/biossums_0.7a.bb b/recipes-extended=
/vgabios/biossums_0.7a.bb
deleted file mode 100644
index 95483ff..0000000
--- a/recipes-extended/vgabios/biossums_0.7a.bb
+++ /dev/null
@@ -1,37 +0,0 @@
-DESCRIPTION =3D "biossums tool for building Plex86/Bochs LGPL VGABios"
-HOMEPAGE =3D "http://www.nongnu.org/vgabios/"
-LICENSE =3D "LGPL-2.1-only"
-SECTION =3D "firmware"
-
-LIC_FILES_CHKSUM =3D "file://COPYING;md5=3Ddcf3c825659e82539645da41a7908=
589"
-
-SRC_URI =3D "http://savannah.gnu.org/download/vgabios/vgabios-${PV}.tgz=
"
-
-SRC_URI[md5sum] =3D "2c0fe5c0ca08082a9293e3a7b23dc900"
-SRC_URI[sha256sum] =3D "9d24c33d4bfb7831e2069cf3644936a53ef3de21d467872b=
54ce2ea30881b865"
-
-BBCLASSEXTEND =3D "native"
-
-FILES:${PN} =3D "${bindir}/biossums"
-
-S =3D "${WORKDIR}/vgabios-${PV}"
-
-do_configure() {
- # Don't override the compiler or its flags:
- sed 's,^CC,DISABLED_CC,' -i Makefile
- sed 's,^CFLAGS,DISABLED_CFLAGS,' -i Makefile
- sed 's,^LDFLAGS,DISABLED_LDFLAGS,' -i Makefile
- # Supply the C flags to the compiler:
- sed 's,-o biossums,$(CFLAGS) -o biossums,' -i Makefile
-}
-
-do_compile() {
- # clean removes binaries distributed with source
- oe_runmake clean
- oe_runmake biossums
-}
-
-do_install() {
- mkdir -p "${D}${bindir}"
- install -m 0755 biossums "${D}${bindir}"
-}
diff --git a/recipes-extended/vgabios/files/build-cc.patch b/recipes-exte=
nded/vgabios/files/build-cc.patch
new file mode 100644
index 0000000..b64e5ef
--- /dev/null
+++ b/recipes-extended/vgabios/files/build-cc.patch
@@ -0,0 +1,30 @@
+Use the host compiler to build the tools we need at runtime.
+
+Upstream-Status: Pending
+Signed-off-by: Ross Burton <ross.burton@...>
+
+Index: Makefile
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- a/Makefile (revision 298)
++++ b/Makefile (working copy)
+@@ -5,6 +5,7 @@
+ SHELL =3D /bin/sh
+=20
+ CC =3D gcc
++HOSTCC =3D gcc
+ CFLAGS =3D -g -O2 -Wall -Wstrict-prototypes
+ LDFLAGS =3D=20
+=20
+@@ -79,10 +80,10 @@
+ tar czvf ../$(RELEASE).tgz --exclude .svn -C .. $(RELEASE)/
+=20
+ biossums: biossums.c
+- $(CC) -o biossums biossums.c
++ $(HOSTCC) -o biossums biossums.c
+=20
+ vbetables-gen: vbetables-gen.c
+- $(CC) -o vbetables-gen vbetables-gen.c
++ $(HOSTCC) -o vbetables-gen vbetables-gen.c
+=20
+ vbetables.h: vbetables-gen
+ ./vbetables-gen > $@
diff --git a/recipes-extended/vgabios/vgabios_0.7a.bb b/recipes-extended/=
vgabios/vgabios_0.7a.bb
deleted file mode 100644
index f443aed..0000000
--- a/recipes-extended/vgabios/vgabios_0.7a.bb
+++ /dev/null
@@ -1,33 +0,0 @@
-DESCRIPTION =3D "Plex86/Bochs LGPL VGABios"
-HOMEPAGE =3D "http://www.nongnu.org/vgabios/"
-LICENSE =3D "LGPL-2.1-only"
-SECTION =3D "firmware"
-
-DEPENDS =3D "dev86-native biossums-native"
-
-LIC_FILES_CHKSUM =3D "file://COPYING;md5=3Ddcf3c825659e82539645da41a7908=
589"
-
-SRC_URI =3D "http://savannah.gnu.org/download/vgabios/${BPN}-${PV}.tgz"
-
-SRC_URI[md5sum] =3D "2c0fe5c0ca08082a9293e3a7b23dc900"
-SRC_URI[sha256sum] =3D "9d24c33d4bfb7831e2069cf3644936a53ef3de21d467872b=
54ce2ea30881b865"
-
-PR =3D "r0"
-
-FILES:${PN} =3D "/usr/share/firmware/${PN}-${PV}*.bin"
-FILES:${PN}-dbg =3D "/usr/share/firmware/${PN}-${PV}*.debug.bin"
-
-S =3D "${WORKDIR}/${PN}-${PV}"
-
-do_configure() {
- # Override to use the native-built biossums tool:
- sed 's,./biossums,biossums,' -i Makefile
- sed 's,$(CC) -o biossums biossums.c,touch biossums,' -i Makefile
-}
-
-do_install() {
- install -d ${D}/usr/share/firmware
- install -m 0644 VGABIOS-lgpl-latest.bin ${D}/usr/share/firmware/${PN=
}-${PV}.bin
- install -m 0644 VGABIOS-lgpl-latest.cirrus.bin ${D}/usr/share/firmwa=
re/${PN}-${PV}.cirrus.bin
-}
-
diff --git a/recipes-extended/vgabios/vgabios_0.8a.bb b/recipes-extended/=
vgabios/vgabios_0.8a.bb
new file mode 100644
index 0000000..044bb4e
--- /dev/null
+++ b/recipes-extended/vgabios/vgabios_0.8a.bb
@@ -0,0 +1,25 @@
+DESCRIPTION =3D "Plex86/Bochs LGPL VGABios"
+HOMEPAGE =3D "http://www.nongnu.org/vgabios/"
+LICENSE =3D "LGPL-2.1-only"
+SECTION =3D "firmware"
+
+DEPENDS =3D "dev86-native"
+
+LIC_FILES_CHKSUM =3D "file://COPYING;md5=3Dfae731a3adbc92fd8bb1730d1f245=
5bc"
+
+SRC_URI =3D "http://savannah.gnu.org/download/vgabios/${BP}.tgz \
+ file://build-cc.patch"
+SRC_URI[sha256sum] =3D "481042240ef0f1c918780c92a6bb42ad4d3f5d989b29502f=
a7ee7faf13a041b9"
+
+EXTRA_OEMAKE =3D "HOSTCC=3D"${BUILD_CC}""
+
+do_install() {
+ install -d ${D}${datadir}/firmware
+ for file in VGABIOS*.bin; do
+ target=3D$(echo $file | sed s/VGABIOS-lgpl-latest/${BP}/)
+ install -m0644 $file ${D}${datadir}/firmware/$target
+ done
+}
+
+FILES:${PN} =3D "${datadir}/firmware/${BP}*.bin"
+FILES:${PN}-dbg =3D "${datadir}/firmware/${BP}*.debug.bin"
--=20
2.25.1


Re: [PATCH v2 0/3] Xen: improve Qemu integration

Bertrand Marquis
 

Hi Christopher,

On 28 Apr 2022, at 01:06, Christopher Clark via lists.yoctoproject.org <christopher.w.clark=gmail.com@...> wrote:

A series of improvements to Qemu integration with the Xen recipes:

- update the Qemu package dependency for the x86 Xen tools
- add support for testing Arm 32-bit images with Qemu and testimage
- configure a standard Xen bridged network xenbr0 for Xen images in qemu
to improve support for configuring guest virtual machine networking

v2 coalesces these patches into a series and addresses feedback on v1
Thanks a lot for that.
I will test and review those in the next days :-)

Cheers
Bertrand


Christopher Clark (3):
xen, xen-tools: add recommendation for Qemu for non-hvm x86
qemuboot, xen-image-minimal: enable runqemu for qemuarm Xen images
xen images, qemuboot: configure xenbr0 bridge for runqemu, testimage

classes/qemuboot-testimage-network.bbclass | 36 +++++-
classes/qemuboot-xen-defaults.bbclass | 26 +++-
classes/qemuboot-xen-u-boot.bbclass | 128 +++++++++++++++++++
conf/distro/include/meta-virt-xen.inc | 1 +
recipes-extended/images/xen-image-minimal.bb | 8 +-
recipes-extended/xen/xen-tools.inc | 9 +-
recipes-extended/xen/xen.inc | 6 +-
7 files changed, 197 insertions(+), 17 deletions(-)
create mode 100644 classes/qemuboot-xen-u-boot.bbclass

--
2.25.1



IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


[PATCH v2 3/3] xen images, qemuboot: configure xenbr0 bridge for runqemu, testimage

Christopher Clark
 

Networking for Xen guest virtual machines is commonly configured via
bridging in the host system between a physical interface and the
guest virtual interfaces.

To make it easier to test networking and use testimage with Xen guest
virtual machines, extend the bbclass that provides network configuration
for qemu machines for the Xen images to configure a Xen bridge and put
eth0 onto it when QB_XEN_HOST_BRIDGE is set.

Signed-off-by: Christopher Clark <christopher.clark@...>
---
- Changes since v1: revised Signed-off-by

classes/qemuboot-testimage-network.bbclass | 36 +++++++++++++++++++-
recipes-extended/images/xen-image-minimal.bb | 2 ++
2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/classes/qemuboot-testimage-network.bbclass b/classes/qemuboot-testimage-network.bbclass
index 18af1ee..57e0355 100644
--- a/classes/qemuboot-testimage-network.bbclass
+++ b/classes/qemuboot-testimage-network.bbclass
@@ -1,17 +1,51 @@
# The recipe for init-ifupdown in core has a special-case for all
# the Qemu MACHINES: it removes all external network interfaces
# by default. However, eth0 is needed for testimage, so enable it here.
+
+# If QB_NETWORK_XEN_BRIDGE is set, configure bridging for the network.
+QB_NETWORK_XEN_BRIDGE ??= ""
+
enable_runqemu_network() {
: # no-op for non-qemu MACHINES
}
+
enable_runqemu_network:qemuall() {
+ # Do not override a network configuration for eth0 if one is present
if ! grep -q eth0 "${IMAGE_ROOTFS}${sysconfdir}/network/interfaces" ; then
- cat <<EOF >>${IMAGE_ROOTFS}${sysconfdir}/network/interfaces
+
+ # Xen host networking: use bridging to support guest networks
+ if [ -n "${QB_NETWORK_XEN_BRIDGE}" ] ; then
+ # Configure a Xen host network bridge and put eth0 on it
+ cat <<EOF >>${IMAGE_ROOTFS}${sysconfdir}/network/interfaces
+
+# Bridged host network for Xen testimage
+iface eth0 inet manual
+
+auto xenbr0
+iface xenbr0 inet dhcp
+ bridge_ports eth0
+EOF
+
+# Add a script to create the bridge and add eth0 if necessary
+ cat <<EOF >>${IMAGE_ROOTFS}${sysconfdir}/network/if-pre-up.d/xenbr0
+#!/bin/sh
+
+if [ "\$IFACE" = xenbr0 ]; then
+ brctl addbr xenbr0 || /bin/true
+ brctl addif xenbr0 eth0 || /bin/true
+ ifconfig eth0 up
+fi
+EOF
+ chmod 755 ${IMAGE_ROOTFS}${sysconfdir}/network/if-pre-up.d/xenbr0
+ else
+ # Just configure eth0
+ cat <<EOF >>${IMAGE_ROOTFS}${sysconfdir}/network/interfaces

# Network for testimage
auto eth0
iface eth0 inet dhcp
EOF
+ fi
fi
}
ROOTFS_POSTPROCESS_COMMAND += 'enable_runqemu_network;'
diff --git a/recipes-extended/images/xen-image-minimal.bb b/recipes-extended/images/xen-image-minimal.bb
index c17c153..6609f81 100644
--- a/recipes-extended/images/xen-image-minimal.bb
+++ b/recipes-extended/images/xen-image-minimal.bb
@@ -34,6 +34,8 @@ XEN_ACPI_PROCESSOR_MODULE:x86-64 = "kernel-module-xen-acpi-processor"

LICENSE = "MIT"

+QB_NETWORK_XEN_BRIDGE = "1"
+
inherit core-image
# Only inherit the qemuboot classes when building for a qemu machine
QB_QEMU_CLASSES = ""
--
2.25.1


[PATCH v2 2/3] qemuboot, xen-image-minimal: enable runqemu for qemuarm Xen images

Christopher Clark
 

The Xen hypervisor built for Arm 32-bit targets can be launched with
runqemu by providing a u-boot script and configuration for Qemu, which
enables interactive testing of Xen images.

Add qemuboot-xen-u-boot.bbclass to add a new bitbake task for generating
the u-boot script. Since this increases the number of qemuboot-specific
classes that are inherited by the xen-image-minimal recipe, change the
inherit of all of these to only apply to qemu machines with the qemuall
override.

Update qemuboot-xen-defaults.bbclass to supply working default
parameters for the qemuarm machine needed to boot successfully in
testing. Also change all the arch-specific variable overrides into
narrower qemu platform overrides instead to avoid unnecessary
interactions with other Arm platform machines.

Signed-off-by: Christopher Clark <christopher.clark@...>
---
Changes since v1:
- replace all qemuboot arch overrides with qemu machine platform overrides
- only include the qemu classes in the image for qemu build targets


classes/qemuboot-xen-defaults.bbclass | 26 +++-
classes/qemuboot-xen-u-boot.bbclass | 128 +++++++++++++++++++
conf/distro/include/meta-virt-xen.inc | 1 +
recipes-extended/images/xen-image-minimal.bb | 6 +-
4 files changed, 155 insertions(+), 6 deletions(-)
create mode 100644 classes/qemuboot-xen-u-boot.bbclass

diff --git a/classes/qemuboot-xen-defaults.bbclass b/classes/qemuboot-xen-defaults.bbclass
index c7e74c3..62bbf8f 100644
--- a/classes/qemuboot-xen-defaults.bbclass
+++ b/classes/qemuboot-xen-defaults.bbclass
@@ -10,21 +10,37 @@ 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 32-bit Arm loads Xen via device loader parameter rather than
+# kernel and boots using u-boot as bios
+XEN_BINARY ??= "${DEPLOY_DIR_IMAGE}/xen-${MACHINE}"
+QB_XEN_LOAD_ADDR ??= "0x46000000"
+QB_OPT_APPEND:append:qemuarm = " \
+ -device loader,file=${XEN_BINARY},addr=${QB_XEN_LOAD_ADDR},force-raw=on \
+ -device loader,file=${DOM0_KERNEL},addr=${DOM0_KERNEL_LOAD_ADDR} \
+ -bios ${DEPLOY_DIR_IMAGE}/u-boot.bin \
+ "
+QB_DEFAULT_KERNEL:qemuarm = "none"
+
# 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 = " \
+QB_OPT_APPEND:append:qemuarm64 = " \
-device loader,file=${DOM0_KERNEL},addr=${DOM0_KERNEL_LOAD_ADDR} \
"
-QB_DEFAULT_KERNEL:aarch64 = "xen-${MACHINE}"
+QB_DEFAULT_KERNEL:qemuarm64 = "xen-${MACHINE}"

+# 32-bit Arm: gic version 2
+QB_MACHINE:qemuarm = "-machine virt -machine virtualization=true"
# 64-bit Arm: gic version 3
-QB_MACHINE:aarch64 = "-machine virt,gic-version=3 -machine virtualization=true"
+QB_MACHINE:qemuarm64 = "-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}"

+# 32-bit Arm: qemuboot with a u-boot script image
+QB_XEN_U_BOOT_SCR:qemuarm = "boot.scr.uimg"
+
# 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"
+QB_DTB:qemuarm64 = "${IMAGE_NAME}.qemuboot.dtb"
+QB_DTB_LINK:qemuarm64 = "${IMAGE_LINK_NAME}.qemuboot.dtb"
diff --git a/classes/qemuboot-xen-u-boot.bbclass b/classes/qemuboot-xen-u-boot.bbclass
new file mode 100644
index 0000000..4401eba
--- /dev/null
+++ b/classes/qemuboot-xen-u-boot.bbclass
@@ -0,0 +1,128 @@
+# Enable booting Xen with qemuboot / runqemu: u-boot configuration
+#
+# Copyright (c) 2021-2022 Star Lab Corp. All rights reserved.
+#
+# Author: Christopher Clark <christopher.clark@...>
+
+# Interface variables:
+#
+# QB_XEN_U_BOOT_SCR :
+# If this variable is set, this class will generate the u-boot script image file
+# It must be set to the name of the compiled command file that u-boot will tftp
+# from the image deploy directory during boot, currently: "boot.scr.uimg"
+#
+# QB_XEN_CMDLINE_EXTRA :
+# A string to be appended to the default Xen hypervisor boot command line,
+# for supplying Xen boot options.
+# The device tree that this bbclass generates will contain Xen command
+# line options to connect the Xen console to the Qemu serial port.
+#
+# QB_XEN_LOAD_ADDR :
+# The hypervisor load address
+#
+# QB_XEN_DOM0_BOOTARGS :
+# A string for specifying Dom0 boot options for the Xen section of the device
+# tree.
+#
+# QB_XEN_UBOOT_SCR_TASK_DEPENDS:
+# The task dependencies for the u-boot script generation. A default is provided.
+#
+# QB_XEN_DOMAIN_MODULES:
+# A space-separated list of colon-separated entries:
+# "<file for the module>:<load memory address>:<module compatibility string>"
+
+# Set the default value for this variable to empty: no file generated.
+QB_XEN_U_BOOT_SCR ??= ""
+
+write_add_chosen_module() {
+ CMD_FILE="$1"
+ ADDR="$2"
+ SIZE="$3"
+ MODULE_TYPE="$4"
+ cat <<EOF >>"${CMD_FILE}"
+fdt mknod /chosen module@${ADDR}
+fdt set /chosen/module@${ADDR} compatible "multiboot,module" "${MODULE_TYPE}"
+fdt set /chosen/module@${ADDR} reg <${ADDR} ${SIZE}>
+EOF
+}
+
+generate_xen_u_boot_conf() {
+ CMD_FILE="${B}/qemuboot-xen.cmd"
+ cat <<EOF >"${CMD_FILE}"
+echo "Running u-boot launch script"
+fdt addr 0x40000000
+fdt resize
+echo "Device tree resized"
+
+fdt set /chosen \#address-cells <1>
+fdt set /chosen \#size-cells <1>
+
+fdt set /chosen xen,xen-bootargs "console=dtuart dtuart=/pl011@9000000 ${QB_XEN_CMDLINE_EXTRA}"
+fdt set /chosen xen,dom0-bootargs "${QB_XEN_DOM0_BOOTARGS}"
+EOF
+
+ if [ -z "${QB_XEN_DOMAIN_MODULES}" ]; then
+ bbwarn "No domain modules: please set QB_XEN_DOMAIN_MODULES"
+ fi
+
+ for DOMAIN_MODULE in ${QB_XEN_DOMAIN_MODULES}
+ do
+ MODULE_FILE="$(echo ${DOMAIN_MODULE} | cut -f1 -d:)"
+ ADDR="$(echo ${DOMAIN_MODULE} | cut -f2 -d:)"
+ MODULE_TYPE="$(echo ${DOMAIN_MODULE} | cut -f3 -d:)"
+ RESOLVED_FILE="$(readlink -f ${MODULE_FILE})"
+ SIZE=$(printf '0x%x\n' $(stat -c '%s' "${RESOLVED_FILE}"))
+ [ "x${SIZE}" != "x0x0" ] || bbfatal No module: "${MODULE_FILE}"
+ write_add_chosen_module "${CMD_FILE}" "${ADDR}" "${SIZE}" "${MODULE_TYPE}"
+ done
+
+ cat <<EOF >>"${CMD_FILE}"
+fdt print /chosen
+
+echo Boot Xen
+bootz ${QB_XEN_LOAD_ADDR} - 0x40000000
+EOF
+
+ uboot-mkimage -A "${UBOOT_ARCH}" -T script -C none \
+ -a 0x20000 -e 0x20000 \
+ -d "${CMD_FILE}" "${CMD_FILE}.uimg"
+
+ # u-boot tftps this filename from DEPLOY_DIR_IMAGE:
+ install -m 0644 "${CMD_FILE}.uimg" "${DEPLOY_DIR_IMAGE}/${QB_XEN_U_BOOT_SCR}"
+}
+
+do_write_qemuboot_xen_u_boot_conf() {
+ # Not all architectures qemuboot with u-boot, so check to see if this
+ # is needed. This allows this bbclass file to be used in the same image
+ # recipe for multiple architectures.
+
+ if [ -n "${QB_XEN_U_BOOT_SCR}" ] && [ -n "${QB_SYSTEM_NAME}" ] ; then
+ generate_xen_u_boot_conf
+ fi
+}
+
+addtask do_write_qemuboot_xen_u_boot_conf after do_write_qemuboot_conf before do_image
+# Task dependency:
+# An expected common case is that the kernel for at least one of the initial
+# domains (eg. dom0) is deployed from the virtual/kernel recipe, so
+# add that as a task dependency here since the kernel size needs to be known
+# for generating the device tree.
+# Dependencies are only introduced if a device tree will be generated.
+QB_XEN_UBOOT_SCR_TASK_DEPENDS ?= " \
+ ${@[ ' \
+ u-boot-tools-native:do_populate_sysroot \
+ u-boot:do_deploy \
+ virtual/kernel:do_deploy \
+ ', ''][d.getVar('QB_XEN_U_BOOT_SCR') == '']} \
+ "
+do_write_qemuboot_xen_u_boot_conf[depends] = "${QB_XEN_UBOOT_SCR_TASK_DEPENDS}"
+
+def qemuboot_xen_u_boot_vars(d):
+ build_vars = ['MACHINE', 'TUNE_ARCH', 'DEPLOY_DIR_IMAGE',
+ 'KERNEL_IMAGETYPE', 'IMAGE_NAME', 'IMAGE_LINK_NAME',
+ 'STAGING_DIR_NATIVE', 'STAGING_BINDIR_NATIVE',
+ 'STAGING_DIR_HOST', 'SERIAL_CONSOLES']
+ return build_vars + [k for k in d.keys() if k.startswith('QB_')]
+
+do_write_qemuboot_xen_u_boot[vardeps] += "${@' '.join(qemuboot_xen_u_boot_vars(d))}"
+do_write_qemuboot_xen_u_boot[vardepsexclude] += "TOPDIR"
diff --git a/conf/distro/include/meta-virt-xen.inc b/conf/distro/include/meta-virt-xen.inc
index 5fbb57f..89f98f2 100644
--- a/conf/distro/include/meta-virt-xen.inc
+++ b/conf/distro/include/meta-virt-xen.inc
@@ -12,4 +12,5 @@ include ${@bb.utils.contains('MACHINE', 'raspberrypi4-64', \
'${XEN_RPI4_64_CONFIG_PATH}', '', d)}

# Set serial for working qemuboot console
+SERIAL_CONSOLES:qemuarm ?= "115200;ttyAMA0"
SERIAL_CONSOLES:qemuarm64 ?= "115200;ttyAMA0"
diff --git a/recipes-extended/images/xen-image-minimal.bb b/recipes-extended/images/xen-image-minimal.bb
index f6fa5ed..c17c153 100644
--- a/recipes-extended/images/xen-image-minimal.bb
+++ b/recipes-extended/images/xen-image-minimal.bb
@@ -34,7 +34,11 @@ XEN_ACPI_PROCESSOR_MODULE:x86-64 = "kernel-module-xen-acpi-processor"

LICENSE = "MIT"

-inherit core-image qemuboot-xen-defaults qemuboot-xen-dtb qemuboot-testimage-network
+inherit core-image
+# Only inherit the qemuboot classes when building for a qemu machine
+QB_QEMU_CLASSES = ""
+QB_QEMU_CLASSES:qemuall = "qemuboot-xen-defaults qemuboot-xen-dtb qemuboot-xen-u-boot qemuboot-testimage-network"
+inherit ${QB_QEMU_CLASSES}

do_check_xen_state() {
if [ "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' yes', 'no', d)}" = "no" ]; then
--
2.25.1


[PATCH v2 1/3] xen, xen-tools: add recommendation for Qemu for non-hvm x86

Christopher Clark
 

The Spectre and Meltdown mitigations for Xen run PV guests within
HVM virtual machines, so Qemu is no longer only needed for systems
configured to run HVM guests.

With the split xen hypervisor and tools recipes, the bios dependencies
belong in the tools recipe, so move them and replace the hvm
PACKAGECONFIG option with the recommendation based on target arch.

Signed-off-by: Christopher Clark <christopher.clark@...>
---
Unchanged since v1

recipes-extended/xen/xen-tools.inc | 9 ++-------
recipes-extended/xen/xen.inc | 6 +++---
2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/recipes-extended/xen/xen-tools.inc b/recipes-extended/xen/xen-tools.inc
index 6bbc8cd..54bc477 100644
--- a/recipes-extended/xen/xen-tools.inc
+++ b/recipes-extended/xen/xen-tools.inc
@@ -30,14 +30,9 @@ RDEPENDS:${PN} = "\

RDEPENDS:${PN}-dev = ""

-# Qemu is necessary on ARM platforms, and to support HVM guests on x86
-QEMU = "${@bb.utils.contains('PACKAGECONFIG', 'hvm', 'qemu', '', d)}"
-QEMU:arm = "qemu"
-QEMU:aarch64 = "qemu"
-
RRECOMMENDS:${PN} = " \
- ${QEMU} \
- ${@bb.utils.contains('PACKAGECONFIG', 'hvm', 'seabios', '', d)} \
+ qemu \
+ ${@bb.utils.contains('XEN_TARGET_ARCH', 'x86_64', 'seabios ipxe vgabios', '', d)} \
${@bb.utils.contains('PACKAGECONFIG', 'externalblktap', '', '${BLKTAP_RRECOMMENDS}', d)} \
${PN}-flask \
${PN}-hvmloader \
diff --git a/recipes-extended/xen/xen.inc b/recipes-extended/xen/xen.inc
index 8b86de5..4c38ccf 100644
--- a/recipes-extended/xen/xen.inc
+++ b/recipes-extended/xen/xen.inc
@@ -9,13 +9,11 @@ require xen-arch.inc
PACKAGECONFIG ??= " \
sdl \
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
- ${@bb.utils.contains('XEN_TARGET_ARCH', 'x86_64', 'hvm', '', d)} \
"

PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,virtual/libsdl,"
PACKAGECONFIG[xsm] = "--enable-xsmpolicy,--disable-xsmpolicy,checkpolicy-native,"
PACKAGECONFIG[systemd] = "--enable-systemd,--disable-systemd,systemd,"
-PACKAGECONFIG[hvm] = "--with-system-seabios="/usr/share/firmware/bios.bin",--disable-seabios,seabios ipxe vgabios,"
PACKAGECONFIG[externalblktap] = ",,,"

DEPENDS = " \
@@ -132,7 +130,9 @@ EXTRA_OECONF += " \
--disable-rombios \
--disable-ocamltools \
--disable-qemu-traditional \
- ${@bb.utils.contains('XEN_TARGET_ARCH', 'x86_64', '--enable-pvshim', '--disable-pvshim', d)} \
+ ${@bb.utils.contains('XEN_TARGET_ARCH', 'x86_64', \
+ '--enable-pvshim --with-system-seabios="/usr/share/firmware/bios.bin"', \
+ '--disable-pvshim --disable-seabios', d)} \
"

EXTRA_OEMAKE += "STDVGA_ROM=${STAGING_DIR_HOST}/usr/share/firmware/vgabios-0.7a.bin"
--
2.25.1


[PATCH v2 0/3] Xen: improve Qemu integration

Christopher Clark
 

A series of improvements to Qemu integration with the Xen recipes:

- update the Qemu package dependency for the x86 Xen tools
- add support for testing Arm 32-bit images with Qemu and testimage
- configure a standard Xen bridged network xenbr0 for Xen images in qemu
to improve support for configuring guest virtual machine networking

v2 coalesces these patches into a series and addresses feedback on v1

Christopher Clark (3):
xen, xen-tools: add recommendation for Qemu for non-hvm x86
qemuboot, xen-image-minimal: enable runqemu for qemuarm Xen images
xen images, qemuboot: configure xenbr0 bridge for runqemu, testimage

classes/qemuboot-testimage-network.bbclass | 36 +++++-
classes/qemuboot-xen-defaults.bbclass | 26 +++-
classes/qemuboot-xen-u-boot.bbclass | 128 +++++++++++++++++++
conf/distro/include/meta-virt-xen.inc | 1 +
recipes-extended/images/xen-image-minimal.bb | 8 +-
recipes-extended/xen/xen-tools.inc | 9 +-
recipes-extended/xen/xen.inc | 6 +-
7 files changed, 197 insertions(+), 17 deletions(-)
create mode 100644 classes/qemuboot-xen-u-boot.bbclass

--
2.25.1


Re: [PATCH] xen: Add missing space in append to IMAGE_INSTALL

Bruce Ashfield
 

merged.

Bruce

In message: [meta-virtualization] [PATCH] xen: Add missing space in append to IMAGE_INSTALL
on 22/04/2022 Bertrand Marquis wrote:

Add a space before doing an append in IMAGE_INSTALL on x86.
This is solving issues happening if someone is using IMAGE_INSTALL in
local.conf to add things to the generated image.

Signed-off-by: Bertrand Marquis <bertrand.marquis@...>
---
recipes-extended/images/xen-image-minimal.bb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/recipes-extended/images/xen-image-minimal.bb b/recipes-extended/images/xen-image-minimal.bb
index f6fa5ed..3cf4230 100644
--- a/recipes-extended/images/xen-image-minimal.bb
+++ b/recipes-extended/images/xen-image-minimal.bb
@@ -21,8 +21,8 @@ IMAGE_INSTALL += " \
do_build[depends] += "xen:do_deploy"

# Networking for HVM-mode guests (x86/64 only) requires the tun kernel module
-IMAGE_INSTALL:append:x86 = "kernel-module-tun"
-IMAGE_INSTALL:append:x86-64 = "kernel-module-tun"
+IMAGE_INSTALL:append:x86 = " kernel-module-tun"
+IMAGE_INSTALL:append:x86-64 = " kernel-module-tun"

# Linux kernel option CONFIG_XEN_PCIDEV_BACKEND depends on X86
XEN_PCIBACK_MODULE = ""
--
2.25.1



Re: [hardknott][PATCH] containerd-opencontainers: add CVE_VERSION setting

Bruce Ashfield
 

merged.

Bruce

In message: [meta-virtualization][hardknott][PATCH] containerd-opencontainers: add CVE_VERSION setting
on 25/04/2022 Chen Qi wrote:

The NVD database uses version without a prefixing 'v'
for containerd.

e.g.
https://nvd.nist.gov/vuln/detail/CVE-2022-23648

So we need to explictly set CVE_VERSION.

Signed-off-by: Chen Qi <Qi.Chen@...>
---
recipes-containers/containerd/containerd-opencontainers_git.bb | 1 +
1 file changed, 1 insertion(+)

diff --git a/recipes-containers/containerd/containerd-opencontainers_git.bb b/recipes-containers/containerd/containerd-opencontainers_git.bb
index 40b03163..2beeaf8f 100644
--- a/recipes-containers/containerd/containerd-opencontainers_git.bb
+++ b/recipes-containers/containerd/containerd-opencontainers_git.bb
@@ -16,6 +16,7 @@ LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=1269f40c0d099c21a871163984590d89"

CONTAINERD_VERSION = "v1.4.13"
+CVE_VERSION = "1.4.13"

EXTRA_OEMAKE += "GODEBUG=1"

--
2.33.0



Re: [PATCH] qemuboot, xen-image-minimal: enable runqemu for qemuarm Xen images

Christopher Clark
 

On Tue, Apr 26, 2022 at 3:03 AM Bertrand Marquis
<Bertrand.Marquis@...> wrote:

Hi Christopher,

On 22 Apr 2022, at 18:46, Christopher Clark via lists.yoctoproject.org <christopher.w.clark=gmail.com@...> wrote:

From: Christopher Clark <christopher.clark@...>

The Xen hypervisor built for Arm 32-bit targets can be launched with
runqemu by providing a u-boot script and configuration for Qemu,
which enables interactive testing of Xen images.

Add qemuboot-xen-u-boot.bbclass to add a new bitbake task for generating
the u-boot script.

Update qemuboot-xen-defaults.bbclass to supply working default parameters
for the qemuarm machine needed to boot successfully in testing.
The changes are very nice but I see 2 problems here:
- all variables are using the architecture (arm or aarch64) instead of using the platform (qemuarm, etc) which would prevent an other platform to be added (for example Xilinx board emulated by qemu).
- xen-image-minimal is now inheriting a lot of classes doing stuff for qemu even when you are building xen-image-minimal for an other board.

Could we switch to platform name in the classes instead of using the architecture ?
Could we find a way to only include the qemu classes when building for qemu ?
Thanks for the review - this is helpful and I think that these can be
addressed in a v2.

We are working on making a generic class to be build a Xen device tree and this adding more and more things conflicting with our attempt.
OK - that sounds promising and I certainly do not want to be making it
more difficult.

best,
Christopher


Cheers
Bertrand


Signed-off-by: Christopher Clark <christopher.clark@...>
---
classes/qemuboot-xen-defaults.bbclass | 16 +++
classes/qemuboot-xen-u-boot.bbclass | 128 +++++++++++++++++++
conf/distro/include/meta-virt-xen.inc | 1 +
recipes-extended/images/xen-image-minimal.bb | 2 +-
4 files changed, 146 insertions(+), 1 deletion(-)
create mode 100644 classes/qemuboot-xen-u-boot.bbclass

diff --git a/classes/qemuboot-xen-defaults.bbclass b/classes/qemuboot-xen-defaults.bbclass
index c7e74c3..1190f29 100644
--- a/classes/qemuboot-xen-defaults.bbclass
+++ b/classes/qemuboot-xen-defaults.bbclass
@@ -10,6 +10,17 @@ 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 32-bit Arm loads Xen via device loader parameter rather than
+# kernel and boots using u-boot as bios
+XEN_BINARY ??= "${DEPLOY_DIR_IMAGE}/xen-${MACHINE}"
+QB_XEN_LOAD_ADDR ??= "0x46000000"
+QB_OPT_APPEND:append:arm = " \
+ -device loader,file=${XEN_BINARY},addr=${QB_XEN_LOAD_ADDR},force-raw=on \
+ -device loader,file=${DOM0_KERNEL},addr=${DOM0_KERNEL_LOAD_ADDR} \
+ -bios ${DEPLOY_DIR_IMAGE}/u-boot.bin \
+ "
+QB_DEFAULT_KERNEL:arm = "none"
+
# 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 = " \
@@ -17,6 +28,8 @@ QB_OPT_APPEND:append:aarch64 = " \
"
QB_DEFAULT_KERNEL:aarch64 = "xen-${MACHINE}"

+# 32-bit Arm: gic version 2
+QB_MACHINE:arm = "-machine virt -machine virtualization=true"
# 64-bit Arm: gic version 3
QB_MACHINE:aarch64 = "-machine virt,gic-version=3 -machine virtualization=true"

@@ -25,6 +38,9 @@ QB_MACHINE:aarch64 = "-machine virt,gic-version=3 -machine virtualization=true"
QB_MEM_VALUE ??= "512"
QB_MEM = "-m ${QB_MEM_VALUE}"

+# 32-bit Arm: qemuboot with a u-boot script image
+QB_XEN_U_BOOT_SCR:arm = "boot.scr.uimg"
+
# 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"
diff --git a/classes/qemuboot-xen-u-boot.bbclass b/classes/qemuboot-xen-u-boot.bbclass
new file mode 100644
index 0000000..3767c09
--- /dev/null
+++ b/classes/qemuboot-xen-u-boot.bbclass
@@ -0,0 +1,128 @@
+# Enable booting Xen with qemuboot / runqemu: u-boot configuration
+#
+# Copyright (c) 2021-2022 Star Lab Corp. All rights reserved.
+#
+# Author: Christopher Clark <christopher.clark@...>
+
+# Interface variables:
+#
+# QB_XEN_U_BOOT_SCR :
+# If this variable is set, this class will generate the u-boot script image file.
+# It must be set to the name of the compiled command file that u-boot will tftp
+# from the image deploy directory during boot, currently: "boot.scr.uimg"
+#
+# QB_XEN_CMDLINE_EXTRA :
+# A string to be appended to the default Xen hypervisor boot command line,
+# for supplying Xen boot options.
+# The device tree that this bbclass generates will contain Xen command
+# line options to connect the Xen console to the Qemu serial port.
+#
+# QB_XEN_LOAD_ADDR :
+# The hypervisor load address
+#
+# QB_XEN_DOM0_BOOTARGS :
+# A string for specifying Dom0 boot options for the Xen section of the device
+# tree.
+#
+# QB_XEN_UBOOT_SCR_TASK_DEPENDS:
+# The task dependencies for the u-boot script generation. A default is provided.
+#
+# QB_XEN_DOMAIN_MODULES:
+# A space-separated list of colon-separated entries:
+# "<file for the module>:<load memory address>:<module compatibility string>"
+
+# Set the default value for this variable to empty: no file generated.
+QB_XEN_U_BOOT_SCR ??= ""
+
+write_add_chosen_module() {
+ CMD_FILE="$1"
+ ADDR="$2"
+ SIZE="$3"
+ MODULE_TYPE="$4"
+ cat <<EOF >>"${CMD_FILE}"
+fdt mknod /chosen module@${ADDR}
+fdt set /chosen/module@${ADDR} compatible "multiboot,module" "${MODULE_TYPE}"
+fdt set /chosen/module@${ADDR} reg <${ADDR} ${SIZE}>
+EOF
+}
+
+generate_xen_u_boot_conf() {
+ CMD_FILE="${B}/qemuboot-xen.cmd"
+ cat <<EOF >"${CMD_FILE}"
+echo "Running u-boot launch script"
+fdt addr 0x40000000
+fdt resize
+echo "Device tree resized"
+
+fdt set /chosen \#address-cells <1>
+fdt set /chosen \#size-cells <1>
+
+fdt set /chosen xen,xen-bootargs "console=dtuart dtuart=/pl011@9000000 ${QB_XEN_CMDLINE_EXTRA}"
+fdt set /chosen xen,dom0-bootargs "${QB_XEN_DOM0_BOOTARGS}"
+EOF
+
+ if [ -z "${QB_XEN_DOMAIN_MODULES}" ]; then
+ bbwarn "No domain modules: please set QB_XEN_DOMAIN_MODULES"
+ fi
+
+ for DOMAIN_MODULE in ${QB_XEN_DOMAIN_MODULES}
+ do
+ MODULE_FILE="$(echo ${DOMAIN_MODULE} | cut -f1 -d:)"
+ ADDR="$(echo ${DOMAIN_MODULE} | cut -f2 -d:)"
+ MODULE_TYPE="$(echo ${DOMAIN_MODULE} | cut -f3 -d:)"
+ RESOLVED_FILE="$(readlink -f ${MODULE_FILE})"
+ SIZE=$(printf '0x%x\n' $(stat -c '%s' "${RESOLVED_FILE}"))
+ [ "x${SIZE}" != "x0x0" ] || bbfatal No module: "${MODULE_FILE}"
+ write_add_chosen_module "${CMD_FILE}" "${ADDR}" "${SIZE}" "${MODULE_TYPE}"
+ done
+
+ cat <<EOF >>"${CMD_FILE}"
+fdt print /chosen
+
+echo Boot Xen
+bootz ${QB_XEN_LOAD_ADDR} - 0x40000000
+EOF
+
+ uboot-mkimage -A "${UBOOT_ARCH}" -T script -C none \
+ -a 0x20000 -e 0x20000 \
+ -d "${CMD_FILE}" "${CMD_FILE}.uimg"
+
+ # u-boot tftps this filename from DEPLOY_DIR_IMAGE:
+ install -m 0644 "${CMD_FILE}.uimg" "${DEPLOY_DIR_IMAGE}/${QB_XEN_U_BOOT_SCR}"
+}
+
+do_write_qemuboot_xen_u_boot_conf() {
+ # Not all architectures qemuboot with u-boot, so check to see if this
+ # is needed. This allows this bbclass file to be used in the same image
+ # recipe for multiple architectures.
+
+ if [ -n "${QB_XEN_U_BOOT_SCR}" ] && [ -n "${QB_SYSTEM_NAME}" ] ; then
+ generate_xen_u_boot_conf
+ fi
+}
+
+addtask do_write_qemuboot_xen_u_boot_conf after do_write_qemuboot_conf before do_image
+# Task dependency:
+# An expected common case is that the kernel for at least one of the initial
+# domains (eg. dom0) is deployed from the virtual/kernel recipe, so
+# add that as a task dependency here since the kernel size needs to be known
+# for generating the device tree.
+# Dependencies are only introduced if a device tree will be generated.
+QB_XEN_UBOOT_SCR_TASK_DEPENDS ?= " \
+ ${@[ ' \
+ u-boot-tools-native:do_populate_sysroot \
+ u-boot:do_deploy \
+ virtual/kernel:do_deploy \
+ ', ''][d.getVar('QB_XEN_U_BOOT_SCR') == '']} \
+ "
+do_write_qemuboot_xen_u_boot_conf[depends] = "${QB_XEN_UBOOT_SCR_TASK_DEPENDS}"
+
+def qemuboot_xen_u_boot_vars(d):
+ build_vars = ['MACHINE', 'TUNE_ARCH', 'DEPLOY_DIR_IMAGE',
+ 'KERNEL_IMAGETYPE', 'IMAGE_NAME', 'IMAGE_LINK_NAME',
+ 'STAGING_DIR_NATIVE', 'STAGING_BINDIR_NATIVE',
+ 'STAGING_DIR_HOST', 'SERIAL_CONSOLES']
+ return build_vars + [k for k in d.keys() if k.startswith('QB_')]
+
+do_write_qemuboot_xen_u_boot[vardeps] += "${@' '.join(qemuboot_xen_u_boot_vars(d))}"
+do_write_qemuboot_xen_u_boot[vardepsexclude] += "TOPDIR"
diff --git a/conf/distro/include/meta-virt-xen.inc b/conf/distro/include/meta-virt-xen.inc
index 5fbb57f..0bfcf59 100644
--- a/conf/distro/include/meta-virt-xen.inc
+++ b/conf/distro/include/meta-virt-xen.inc
@@ -13,3 +13,4 @@ include ${@bb.utils.contains('MACHINE', 'raspberrypi4-64', \

# Set serial for working qemuboot console
SERIAL_CONSOLES:qemuarm64 ?= "115200;ttyAMA0"
+SERIAL_CONSOLES:qemuarm ?= "115200;ttyAMA0"
diff --git a/recipes-extended/images/xen-image-minimal.bb b/recipes-extended/images/xen-image-minimal.bb
index f6fa5ed..6277614 100644
--- a/recipes-extended/images/xen-image-minimal.bb
+++ b/recipes-extended/images/xen-image-minimal.bb
@@ -34,7 +34,7 @@ XEN_ACPI_PROCESSOR_MODULE:x86-64 = "kernel-module-xen-acpi-processor"

LICENSE = "MIT"

-inherit core-image qemuboot-xen-defaults qemuboot-xen-dtb qemuboot-testimage-network
+inherit core-image qemuboot-xen-defaults qemuboot-xen-dtb qemuboot-testimage-network qemuboot-xen-u-boot

do_check_xen_state() {
if [ "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' yes', 'no', d)}" = "no" ]; then
--
2.20.1



IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.