[oe-commits] Laurentiu Palcu : qemu.bbclass: add qemu_run_binary() function

git at git.openembedded.org git at git.openembedded.org
Thu Jan 10 23:52:39 UTC 2013


Module: openembedded-core.git
Branch: master
Commit: 2cfbe0bd9d02ab8c054e5bc879a2181c6a7e3719
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=2cfbe0bd9d02ab8c054e5bc879a2181c6a7e3719

Author: Laurentiu Palcu <laurentiu.palcu at intel.com>
Date:   Thu Dec 20 15:15:38 2012 +0200

qemu.bbclass: add qemu_run_binary() function

[YOCTO #3602]

Signed-off-by: Laurentiu Palcu <laurentiu.palcu at intel.com>
Signed-off-by: Saul Wold <sgw at linux.intel.com>

---

 meta/classes/qemu.bbclass |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/meta/classes/qemu.bbclass b/meta/classes/qemu.bbclass
index aead8e2..13af339 100644
--- a/meta/classes/qemu.bbclass
+++ b/meta/classes/qemu.bbclass
@@ -13,3 +13,20 @@ def qemu_target_binary(data):
         target_arch = "ppc64"
 
     return "qemu-" + target_arch
+#
+# Next function will return a string containing the command that is needed to
+# to run a certain binary through qemu. For example, in order to make a certain
+# postinstall scriptlet run at do_rootfs time and running the postinstall is
+# architecture dependent, we can run it through qemu. For example, in the
+# postinstall scriptlet, we could use the following:
+#
+# ${@qemu_run_binary(d, '$D', '/usr/bin/test_app')} [test_app arguments]
+#
+def qemu_run_binary(data, rootfs_path, binary):
+    dynamic_loader = rootfs_path + '$(readelf -l ' + rootfs_path + \
+                     binary + '| grep "Requesting program interpreter"|sed -e \'s/^.*\[.*: \(.*\)\]/\\1/\')'
+    library_path = rootfs_path + data.getVar("base_libdir", True) + ":" + \
+                   rootfs_path + data.getVar("libdir", True)
+
+    return qemu_target_binary(data) + " " + dynamic_loader + " --library-path " + library_path \
+           + " " + rootfs_path + binary





More information about the Openembedded-commits mailing list