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 <[email protected]>
---
 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 ??= "${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
+# 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 = " \
     -device loader,file=${DOM0_KERNEL},addr=${DOM0_KERNEL_LOAD_ADDR} \
     "
+QB_OPT_APPEND:append:qemuarm = " \
+    -device loader,file=${DOM0_KERNEL},addr=${DOM0_KERNEL_LOAD_ADDR} \
+    "
 QB_DEFAULT_KERNEL:aarch64 = "xen-${MACHINE}"
+QB_DEFAULT_KERNEL:qemuarm = "xen-${MACHINE}"
 
 # 64-bit Arm: gic version 3
 QB_MACHINE:aarch64 = "-machine virt,gic-version=3 -machine virtualization=true"
+# 32-bit Arm
+QB_MACHINE:qemuarm = "-machine virt -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.
@@ -28,3 +34,7 @@ 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"
+
+# 32-bit Arm: qemuboot with a device tree binary
+QB_DTB:qemuarm = "${IMAGE_NAME}.qemuboot.dtb"
+QB_DTB_LINK:qemuarm = "${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.
 
 write_lops_xen_section() {
+    DOM0_BOOTARGS="$2"
     cat <<EOF >"$1"
 /dts-v1/;
 / {
@@ -47,7 +48,7 @@ write_lops_xen_section() {
         };
         lop_2 {
             compatible = "system-device-tree-v1,lop,modify";
-            modify = "/chosen:xen,dom0-bootargs:${QB_XEN_DOM0_BOOTARGS}";
+            modify = "/chosen:xen,dom0-bootargs:${DOM0_BOOTARGS}";
         };
         lop_3 {
             compatible = "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=3 \
-        -machine virtualization=true \
+        ${QB_MACHINE} \
         ${QB_CPU} \
         ${QB_SMP} \
         ${QB_MEM} \
@@ -129,7 +129,8 @@ generate_xen_qemuboot_dtb() {
 
     # 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}"
 
     write_lop_add_to_xen_cmdline "${B}/lop-xen-cmdline.dts" \
         "${QB_XEN_CMDLINE_EXTRA}"
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#7236): 
https://lists.yoctoproject.org/g/meta-virtualization/message/7236
Mute This Topic: https://lists.yoctoproject.org/mt/90776348/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to