Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame^] | 1 | SUMMARY = "QEMU wrapper script" |
| 2 | LICENSE = "MIT" |
| 3 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" |
| 4 | |
| 5 | S = "${WORKDIR}" |
| 6 | |
| 7 | inherit qemu |
| 8 | |
| 9 | do_install () { |
| 10 | install -d ${D}${bindir_crossscripts}/ |
| 11 | |
| 12 | echo "#!/bin/sh" > ${D}${bindir_crossscripts}/qemuwrapper |
| 13 | qemu_binary=${@qemu_target_binary(d)} |
| 14 | qemu_options='${QEMU_OPTIONS}' |
| 15 | echo "$qemu_binary $qemu_options \"\$@\"" >> ${D}${bindir_crossscripts}/qemuwrapper |
| 16 | fallback_qemu_bin= |
| 17 | case $qemu_binary in |
| 18 | "qemu-i386") |
| 19 | fallback_qemu_bin=qemu-x86_64 |
| 20 | ;; |
| 21 | "qemu-x86_64") |
| 22 | fallback_qemu_bin=qemu-i386 |
| 23 | ;; |
| 24 | *) |
| 25 | ;; |
| 26 | esac |
| 27 | |
| 28 | if [ -n "$fallback_qemu_bin" ]; then |
| 29 | |
| 30 | cat >> ${D}${bindir_crossscripts}/qemuwrapper << EOF |
| 31 | rc=\$? |
| 32 | if [ \$rc = 255 ]; then |
| 33 | $fallback_qemu_bin "\$@" |
| 34 | rc=\$? |
| 35 | fi |
| 36 | exit \$rc |
| 37 | EOF |
| 38 | |
| 39 | fi |
| 40 | |
| 41 | chmod +x ${D}${bindir_crossscripts}/qemuwrapper |
| 42 | } |
| 43 | |
| 44 | SYSROOT_PREPROCESS_FUNCS += "qemuwrapper_sysroot_preprocess" |
| 45 | |
| 46 | qemuwrapper_sysroot_preprocess () { |
| 47 | sysroot_stage_dir ${D}${bindir_crossscripts} ${SYSROOT_DESTDIR}${bindir_crossscripts} |
| 48 | } |
| 49 | |
| 50 | INHIBIT_DEFAULT_DEPS = "1" |