blob: e40cdafc94d7655595afd6d5d269a634dc2bd0f7 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "QEMU wrapper script"
2LICENSE = "MIT"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05003
4S = "${WORKDIR}"
5
Brad Bishop6e60e8b2018-02-01 10:27:11 -05006DEPENDS += "qemu-native"
7
Patrick Williamsc124f4f2015-09-15 14:41:29 -05008inherit qemu
9
Brad Bishop6e60e8b2018-02-01 10:27:11 -050010do_populate_sysroot[depends] = ""
11
Patrick Williamsc124f4f2015-09-15 14:41:29 -050012do_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
34rc=\$?
35if [ \$rc = 255 ]; then
36 $fallback_qemu_bin "\$@"
37 rc=\$?
38fi
39exit \$rc
40EOF
41
42 fi
43
44 chmod +x ${D}${bindir_crossscripts}/qemuwrapper
45}
46
Patrick Williamsc0f7c042017-02-23 20:41:17 -060047SYSROOT_DIRS += "${bindir_crossscripts}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050048
49INHIBIT_DEFAULT_DEPS = "1"