Skip to contentSkip to conversation

check-version-mismatch.bbclass: use contents from qemu.bbclass directly

PATCH New [email protected] 1 participant 1 message Apr 10, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 check-version-mismatch.bbclass: use contents from qemu.bbclass directly

From: Chen Qi <[email protected]>

This check-version-mismatch.bbclass uses function from qemu.bbclass. As qemu.bbclass is under a refactoring for master branch and such refactoring is not likely to be backported to walnascar branch. We need to copy the needed contents from qemu.bbclass here. The contents are put in the beginning of this bbclass so that any future fix for master branch can be easily backported to walnascar branch without conflicts.

---
 .../classes/check-version-mismatch.bbclass    | 35 ++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)
meta-oe/classes/check-version-mismatch.bbclass +34 -1
index 7b46151b03..b80ecdfbc4 100644
@@ -1,4 +1,37 @@
-inherit qemu
+### qemu.bbclass contents ###
+def qemu_target_binary(data):
+    package_arch = data.getVar("PACKAGE_ARCH")
+    qemu_target_binary = (data.getVar("QEMU_TARGET_BINARY_%s" % package_arch) or "")
+    if qemu_target_binary:
+        return qemu_target_binary
+
+    target_arch = data.getVar("TARGET_ARCH")
+    if target_arch in ("i486", "i586", "i686"):
+        target_arch = "i386"
+    elif target_arch == "powerpc":
+        target_arch = "ppc"
+    elif target_arch == "powerpc64":
+        target_arch = "ppc64"
+    elif target_arch == "powerpc64le":
+        target_arch = "ppc64le"
+
+    return "qemu-" + target_arch
+
+def qemu_wrapper_cmdline(data, rootfs_path, library_paths):
+    import string
+
+    qemu_binary = qemu_target_binary(data)
+    if qemu_binary == "qemu-allarch":
+        qemu_binary = "qemuwrapper"
+
+    qemu_options = data.getVar("QEMU_OPTIONS") or ""
+
+    return "PSEUDO_UNLOAD=1 " + qemu_binary + " " + qemu_options + " -L " + rootfs_path\
+            + " -E LD_LIBRARY_PATH=" + ":".join(library_paths) + " "
+
+QEMU_OPTIONS = "-r ${OLDEST_KERNEL} ${@d.getVar("QEMU_EXTRAOPTIONS:tune-%s" % d.getVar('TUNE_PKGARCH')) or ""}"
+QEMU_OPTIONS[vardeps] += "QEMU_EXTRAOPTIONS:tune-${TUNE_PKGARCH}"
+### end of qemu.bbclass contents ###
 
 ENABLE_VERSION_MISMATCH_CHECK ?= "${@'1' if bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', True, False, d) else '0'}"
 DEBUG_VERSION_MISMATCH_CHECK ?= "1"
Signature · 1 line
2.49.0