blob: c983fbae6676033bdc7c18d2f032e7dcc032c07e [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "QEMU wrapper script"
Brad Bishopd7bf8c12018-02-25 22:55:05 -05002HOMEPAGE = "http://qemu.org"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05003LICENSE = "MIT"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05004
5S = "${WORKDIR}"
6
Brad Bishop6e60e8b2018-02-01 10:27:11 -05007DEPENDS += "qemu-native"
8
Patrick Williamsc124f4f2015-09-15 14:41:29 -05009inherit qemu
10
Brad Bishop6e60e8b2018-02-01 10:27:11 -050011do_populate_sysroot[depends] = ""
12
Patrick Williamsc124f4f2015-09-15 14:41:29 -050013do_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
35rc=\$?
36if [ \$rc = 255 ]; then
37 $fallback_qemu_bin "\$@"
38 rc=\$?
39fi
40exit \$rc
41EOF
42
43 fi
44
45 chmod +x ${D}${bindir_crossscripts}/qemuwrapper
46}
47
Patrick Williamsc0f7c042017-02-23 20:41:17 -060048SYSROOT_DIRS += "${bindir_crossscripts}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050049
50INHIBIT_DEFAULT_DEPS = "1"