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