diff options
| -rw-r--r-- | 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 aead8e2809..13af3390aa 100644 --- a/meta/classes/qemu.bbclass +++ b/meta/classes/qemu.bbclass | |||
| @@ -13,3 +13,20 @@ def qemu_target_binary(data): | |||
| 13 | target_arch = "ppc64" | 13 | target_arch = "ppc64" |
| 14 | 14 | ||
| 15 | return "qemu-" + target_arch | 15 | return "qemu-" + target_arch |
| 16 | # | ||
| 17 | # Next function will return a string containing the command that is needed to | ||
| 18 | # to run a certain binary through qemu. For example, in order to make a certain | ||
| 19 | # postinstall scriptlet run at do_rootfs time and running the postinstall is | ||
| 20 | # architecture dependent, we can run it through qemu. For example, in the | ||
| 21 | # postinstall scriptlet, we could use the following: | ||
| 22 | # | ||
| 23 | # ${@qemu_run_binary(d, '$D', '/usr/bin/test_app')} [test_app arguments] | ||
| 24 | # | ||
| 25 | def qemu_run_binary(data, rootfs_path, binary): | ||
| 26 | dynamic_loader = rootfs_path + '$(readelf -l ' + rootfs_path + \ | ||
| 27 | binary + '| grep "Requesting program interpreter"|sed -e \'s/^.*\[.*: \(.*\)\]/\\1/\')' | ||
| 28 | library_path = rootfs_path + data.getVar("base_libdir", True) + ":" + \ | ||
| 29 | rootfs_path + data.getVar("libdir", True) | ||
| 30 | |||
| 31 | return qemu_target_binary(data) + " " + dynamic_loader + " --library-path " + library_path \ | ||
| 32 | + " " + rootfs_path + binary | ||
