| Submitter | Laurentiu Palcu |
|---|---|
| Date | Dec. 20, 2012, 1:15 p.m. |
| Message ID | <1356009340-15874-2-git-send-email-laurentiu.palcu@intel.com> |
| Download | mbox | patch |
| Permalink | /patch/41401/ |
| State | Accepted |
| Commit | 2cfbe0bd9d02ab8c054e5bc879a2181c6a7e3719 |
| Headers | show |
Comments
On 20 December 2012 13:15, Laurentiu Palcu <laurentiu.palcu@intel.com> wrote: > dynamic_loader = rootfs_path + '$(readelf -l ' + rootfs_path + \ > binary + '| grep "Requesting program interpreter"|sed -e \'s/^.*\[.*: \(.*\)\]/\\1/\')' Would it be easier to do the string manipulation in python? Spawning grep and sed when Python can do string manipulation seems excessive. Nice addition to the class though. Ross
On 12/20/2012 04:45 PM, Burton, Ross wrote: > On 20 December 2012 13:15, Laurentiu Palcu <laurentiu.palcu@intel.com> wrote: >> dynamic_loader = rootfs_path + '$(readelf -l ' + rootfs_path + \ >> binary + '| grep "Requesting program interpreter"|sed -e \'s/^.*\[.*: \(.*\)\]/\\1/\')' > > Would it be easier to do the string manipulation in python? Spawning > grep and sed when Python can do string manipulation seems excessive. Ok, I agree. But how do you call python routines from the postinstall scriptlets which run in do_rootfs context? readelf needs to run at postinstall time because the binary we run through qemu does not necessarily belong to the same package. Let's take, for example, the current patchset. You can have a recipe that provides an input method module and call gtk-query-modules-2.0 binary to create the cache. If you know a method to do it, feel free to share. Thanks, Laurentiu > > Nice addition to the class though. > > Ross >
On 20 December 2012 14:59, Laurentiu Palcu <laurentiu.palcu@intel.com> wrote: > Ok, I agree. But how do you call python routines from the postinstall > scriptlets which run in do_rootfs context? readelf needs to run at > postinstall time because the binary we run through qemu does not > necessarily belong to the same package. Let's take, for example, the > current patchset. You can have a recipe that provides an input method > module and call gtk-query-modules-2.0 binary to create the cache. Right, of course. awk might be clearer than grep/sed but only marginally... Ross
Patch
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
[YOCTO #3602] Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com> --- meta/classes/qemu.bbclass | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)