aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb28
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 41617a6b756..18f18928843 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 () {
install -d ${D}${bindir_crossscripts}/
echo "#!/bin/sh" > ${D}${bindir_crossscripts}/qemuwrapper
- echo exec env ${@qemu_target_binary(d)} \"\$@\" >> ${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
}