generic-poky/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb
Laurentiu Palcu fe240006fb 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>
2013-04-29 14:45:09 +01:00

49 lines
1,014 B
BlitzBasic

DESCRIPTION = "Qemu wrapper script"
LICENSE = "MIT"
PR = "r0"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
inherit qemu
do_install () {
install -d ${D}${bindir_crossscripts}/
echo "#!/bin/sh" > ${D}${bindir_crossscripts}/qemuwrapper
qemu_binary=${@qemu_target_binary(d)}
echo "$qemu_binary \"\$@\"" >> ${D}${bindir_crossscripts}/qemuwrapper
fallback_qemu_bin=
case $qemu_binary in
"qemu-i386")
fallback_qemu_bin=qemu-x86_64
;;
"qemu-x86_64")
fallback_qemu_bin=qemu-i386
;;
*)
;;
esac
if [ -n "$fallback_qemu_bin" ]; then
cat >> ${D}${bindir_crossscripts}/qemuwrapper << EOF
rc=\$?
if [ \$rc = 255 ]; then
$fallback_qemu_bin "\$@"
rc=\$?
fi
exit \$rc
EOF
fi
chmod +x ${D}${bindir_crossscripts}/qemuwrapper
}
SYSROOT_PREPROCESS_FUNCS += "qemuwrapper_sysroot_preprocess"
qemuwrapper_sysroot_preprocess () {
sysroot_stage_dir ${D}${bindir_crossscripts} ${SYSROOT_DESTDIR}${bindir_crossscripts}
}
INHIBIT_DEFAULT_DEPS = "1"