Skip to contentSkip to conversation

zephyr-qemuboot.bbclass: Don't overwrite the entire elf dictionary key

PATCH New Andrei Gherzan 1 participant 2 messages May 13, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 zephyr-qemuboot.bbclass: Don't overwrite the entire elf dictionary key

From: Andrei Gherzan <[email protected]>

The nios2_machdata_setfunc was overwriting the elf key in matchdata for arc done in arc_machdata_setfunc which in turn was overwriting the one from oe-core. This is making qemu-x86 builds (as an example) unbuildable:

Exception: KeyError: 'i586'

This patch makes sure that the changes complement the machdata dictionary as opposed to overwriting the entire "elf" key.

---
 classes/siteinfo-zephyr.bbclass | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
classes/siteinfo-zephyr.bbclass +3 -4
index d84fd3a..b84a9b2 100644
@@ -1,4 +1,3 @@
-
 def arc_siteinfo_setfunc(archinfo, osinfo, targetinfo, d):
     archinfo['arc'] = "endian-little bit-32 "
     osinfo['linux'] = "common-linux common-glibc"
@@ -8,7 +7,7 @@ def arc_siteinfo_setfunc(archinfo, osinfo, targetinfo, d):
 SITEINFO_EXTRA_DATAFUNCS += "arc_siteinfo_setfunc"
 
 def arc_machdata_setfunc(machdata, d):
-    machdata["elf"] = { "arc" : (195, 0, 0, True, 32), }
+    machdata["elf"]["arc"] = (195, 0, 0, True, 32)
     return machdata
 
 PACKAGEQA_EXTRA_MACHDEFFUNCS += "arc_machdata_setfunc"
@@ -22,7 +21,7 @@ def iamcu_siteinfo_setfunc(archinfo, osinfo, targetinfo, d):
 SITEINFO_EXTRA_DATAFUNCS += "iamcu_siteinfo_setfunc"
 
 def nios2_machdata_setfunc(machdata, d):
-    machdata["elf"] = {"nios2":  (113, 0, 0, True, 32), }
+    machdata["elf"]["nios2"] = (113, 0, 0, True, 32)
     return machdata
 
-PACKAGEQA_EXTRA_MACHDEFFUNCS += "nios2_machdata_setfunc"
\ No newline at end of file
+PACKAGEQA_EXTRA_MACHDEFFUNCS += "nios2_machdata_setfunc"
Signature · 1 line
2.31.1
#1 lore raw

PATCH 2/2 zephyr-qemuboot.bbclass: Remove dependency on qemu-system-native

From: Andrei Gherzan <[email protected]>

runqemu only really needs the sysroot for qemu-helper-native. Pulling other qemu dependency would get into a racing issue with rm_work. That can also be fixed by tweaking the do_addto_recipe_sysroot order in oe-core for qemu-system-native but that is just not needed for this specific dependency requirement.

---
 classes/zephyr-qemuboot.bbclass | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
classes/zephyr-qemuboot.bbclass +7 -8
index f508b45..c268e9e 100644
@@ -36,19 +36,18 @@ python do_bootconf_write() {
 
 addtask do_bootconf_write before do_build after do_deploy
 
-# The runqemu script requires the native sysroot populated for the qemu
-# recipes. Usually, this is pulled in by a do_image dependency (see
-# baremetal-helloworld_git, for example), but in this case, there is no such
-# task, so we hook in the dependency to do_bootconf_write. This also ensures
-# that builds from sstate will also have this requirement satisfied.
+# The runqemu script requires the native sysroot populated for the
+# qemu-helper-native recipes. Usually, this is pulled in by a do_image
+# dependency (see baremetal-helloworld_git, for example), but in this case,
+# there is no such task, so we hook in the dependency to do_bootconf_write.
+# This also ensures that builds from sstate will also have this requirement
+# satisfied.
 python () {
-    # do_addto_recipe_sysroot doesnt exist for all recipes, but we need it to have
-    # /usr/bin on recipe-sysroot (qemu) populated
     def extraimage_getdepends(task):
         deps = ""
         for dep in (d.getVar('EXTRA_IMAGEDEPENDS') or "").split():
         # Make sure we only add it for qemu
-            if 'qemu' in dep:
+            if 'qemu-helper-native' in dep:
                 deps += " %s:%s" % (dep, task)
         return deps
     d.appendVarFlag('do_bootconf_write', 'depends', extraimage_getdepends('do_addto_recipe_sysroot'))
Signature · 1 line
2.31.1