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