diff options
author | Laurentiu Palcu <laurentiu.palcu@intel.com> | 2013-04-26 11:03:58 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-04-29 14:45:09 +0100 |
commit | fe240006fb79a704a27d9a5fbb7a41da9968476d (patch) | |
tree | 8ba4592926b8bed487323ab8f61940165110e341 /meta | |
parent | 18ea08cce1d14ff279c53b734fb1651dcff10b20 (diff) | |
download | poky-fe240006fb79a704a27d9a5fbb7a41da9968476d.tar.gz |
qemuwrapper: use fallback in case the ELF binary is wrong
This wrapper script is called mainly from intercept hooks and allarch
packages postinstalls. When multilib is used, the qemuwrapper script
points to the binary that matches the MACHINE architecture.
For example: if MACHINE=qemux86_64 and we activate multilib, then the
postinstalls for lib32 packages would call qemu-x86_64 with 32 bit
binaries and they would certainly fail.
This patch adds just a fallback method if the exit code of the previous
qemu call corresponds to "Invalid ELF image for this architecture"
error. This will allow us to have all postinstalls run on host.
(From OE-Core rev: 0c6ddb84043f0f917543cdaf4814efc15cd0273f)
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb b/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb index 41617a6b75..18f1892884 100644 --- a/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb +++ b/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb | |||
@@ -9,7 +9,33 @@ do_install () { | |||
9 | install -d ${D}${bindir_crossscripts}/ | 9 | install -d ${D}${bindir_crossscripts}/ |
10 | 10 | ||
11 | echo "#!/bin/sh" > ${D}${bindir_crossscripts}/qemuwrapper | 11 | echo "#!/bin/sh" > ${D}${bindir_crossscripts}/qemuwrapper |
12 | echo exec env ${@qemu_target_binary(d)} \"\$@\" >> ${D}${bindir_crossscripts}/qemuwrapper | 12 | qemu_binary=${@qemu_target_binary(d)} |
13 | echo "$qemu_binary \"\$@\"" >> ${D}${bindir_crossscripts}/qemuwrapper | ||
14 | fallback_qemu_bin= | ||
15 | case $qemu_binary in | ||
16 | "qemu-i386") | ||
17 | fallback_qemu_bin=qemu-x86_64 | ||
18 | ;; | ||
19 | "qemu-x86_64") | ||
20 | fallback_qemu_bin=qemu-i386 | ||
21 | ;; | ||
22 | *) | ||
23 | ;; | ||
24 | esac | ||
25 | |||
26 | if [ -n "$fallback_qemu_bin" ]; then | ||
27 | |||
28 | cat >> ${D}${bindir_crossscripts}/qemuwrapper << EOF | ||
29 | rc=\$? | ||
30 | if [ \$rc = 255 ]; then | ||
31 | $fallback_qemu_bin "\$@" | ||
32 | rc=\$? | ||
33 | fi | ||
34 | exit \$rc | ||
35 | EOF | ||
36 | |||
37 | fi | ||
38 | |||
13 | chmod +x ${D}${bindir_crossscripts}/qemuwrapper | 39 | chmod +x ${D}${bindir_crossscripts}/qemuwrapper |
14 | } | 40 | } |
15 | 41 | ||