From: Mingli Yu <mingli...@windriver.com>

Now the QEMU_TARGETS used to set the supported built qemu targets
both for "bitbake qemu-native" and "bitbake qemu".

After the qemu package installed on the target, it will take up
464M which includes not only the one matches the arch of the target
but aslo all available built qemu targets which set by QEMU_TARGETS.

Making "bitbake qemu" to only build the arch matches the target should
satisfy our usual need and ease the concerns who cares much about the
size in embedded device as it decreases the qemu rpm size from about 65M
to about 17M and the size of the extracted qemu RPM decreased from
about 464M to about 248M.

Signed-off-by: Mingli Yu <mingli...@windriver.com>
---
 meta/recipes-devtools/qemu/qemu-targets.inc | 15 +++++++++++++--
 meta/recipes-devtools/qemu/qemu_8.0.0.bb    |  2 +-
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-devtools/qemu/qemu-targets.inc 
b/meta/recipes-devtools/qemu/qemu-targets.inc
index 24f9a03948..bd0b47a4e7 100644
--- a/meta/recipes-devtools/qemu/qemu-targets.inc
+++ b/meta/recipes-devtools/qemu/qemu-targets.inc
@@ -3,9 +3,20 @@
 #    mips mipsel mips64 mips64el ppc ppc64 ppc64abi32 ppcemb
 #    riscv32 riscv64 sparc sparc32 sparc32plus
 
-def get_qemu_target_list(d):
+def get_qemu_target_list(d, target=False):
     import bb
-    archs = d.getVar('QEMU_TARGETS').split()
+    if target:
+        archs = []
+        allarchs = d.getVar('QEMU_TARGETS').split()
+        if d.getVar("TARGET_ARCH") in ["x86", "i486", "i586", "i686"]:
+            machine_arch = "i386"
+        else:
+            machine_arch = d.getVar("TARGET_ARCH")
+        for arch in allarchs:
+            if arch in machine_arch:
+                archs.append(arch)
+    else:
+        archs = d.getVar('QEMU_TARGETS').split()
     tos = d.getVar('HOST_OS')
     softmmuonly = ""
     for arch in ['ppcemb', 'lm32']:
diff --git a/meta/recipes-devtools/qemu/qemu_8.0.0.bb 
b/meta/recipes-devtools/qemu/qemu_8.0.0.bb
index 42e133967e..6c25d99ade 100644
--- a/meta/recipes-devtools/qemu/qemu_8.0.0.bb
+++ b/meta/recipes-devtools/qemu/qemu_8.0.0.bb
@@ -10,7 +10,7 @@ CFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '', 
'-DEGL_NO_X11=1',
 
 RDEPENDS:${PN}:class-target += "bash"
 
-EXTRA_OECONF:append:class-target = " --target-list=${@get_qemu_target_list(d)}"
+EXTRA_OECONF:append:class-target = " --target-list=${@get_qemu_target_list(d, 
target=True)}"
 EXTRA_OECONF:append:class-target:mipsarcho32 = 
"${@bb.utils.contains('BBEXTENDCURR', 'multilib', ' --disable-capstone', '', 
d)}"
 EXTRA_OECONF:append:class-nativesdk = " 
--target-list=${@get_qemu_target_list(d)}"
 
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#181773): 
https://lists.openembedded.org/g/openembedded-core/message/181773
Mute This Topic: https://lists.openembedded.org/mt/99150807/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to