Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | SUMMARY = "Fast open source processor emulator" |
| 2 | HOMEPAGE = "http://qemu.org" |
| 3 | LICENSE = "GPLv2 & LGPLv2.1" |
| 4 | DEPENDS = "glib-2.0 zlib pixman" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 5 | RDEPENDS_${PN}_class-target += "bash" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 6 | RDEPENDS_${PN}-ptest = "bash make" |
| 7 | |
| 8 | require qemu-targets.inc |
| 9 | inherit autotools ptest |
| 10 | BBCLASSEXTEND = "native nativesdk" |
| 11 | |
| 12 | PR = "r1" |
| 13 | |
| 14 | # QEMU_TARGETS is overridable variable |
| 15 | QEMU_TARGETS ?= "arm aarch64 i386 mips mipsel mips64 mips64el ppc sh4 x86_64" |
| 16 | |
| 17 | SRC_URI = "\ |
| 18 | file://powerpc_rom.bin \ |
| 19 | file://disable-grabs.patch \ |
| 20 | file://exclude-some-arm-EABI-obsolete-syscalls.patch \ |
| 21 | file://wacom.patch \ |
| 22 | file://add-ptest-in-makefile.patch \ |
| 23 | file://run-ptest \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 24 | file://0001-target-mips-add-24KEc-CPU-definition.patch \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 25 | " |
| 26 | |
| 27 | SRC_URI_append_class-native = "\ |
| 28 | file://fix-libcap-header-issue-on-some-distro.patch \ |
| 29 | file://cpus.c-qemu_cpu_kick_thread_debugging.patch \ |
| 30 | " |
| 31 | |
| 32 | EXTRA_OECONF += "--target-list=${@get_qemu_target_list(d)} --disable-werror --disable-bluez --disable-libiscsi --with-system-pixman --extra-cflags='${CFLAGS}'" |
| 33 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 34 | EXTRA_OECONF_class-nativesdk = "--target-list=${@get_qemu_target_list(d)} --disable-werror" |
| 35 | |
| 36 | EXTRA_OEMAKE_append_class-native = " LD='${LD}' AR='${AR}' OBJCOPY='${OBJCOPY}' LDFLAGS='${LDFLAGS}'" |
| 37 | |
| 38 | LDFLAGS_append_class-native = " -fuse-ld=bfd" |
| 39 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 40 | export LIBTOOL="${HOST_SYS}-libtool" |
| 41 | |
| 42 | do_configure_prepend_class-native() { |
| 43 | # Append build host pkg-config paths for native target since the host may provide sdl |
| 44 | BHOST_PKGCONFIG_PATH=$(PATH=/usr/bin:/bin pkg-config --variable pc_path pkg-config || echo "") |
| 45 | if [ ! -z "$BHOST_PKGCONFIG_PATH" ]; then |
| 46 | export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$BHOST_PKGCONFIG_PATH |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 47 | fi |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 48 | |
| 49 | # Alter target makefiles to accept CFLAGS set via env |
| 50 | sed -i -r \ |
| 51 | -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \ |
| 52 | "${S}"/Makefile "${S}"/Makefile.target |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | KVMENABLE = "--enable-kvm" |
| 56 | KVMENABLE_darwin = "--disable-kvm" |
| 57 | KVMENABLE_mingw32 = "--disable-kvm" |
| 58 | |
| 59 | do_configure() { |
| 60 | # Handle distros such as CentOS 5 32-bit that do not have kvm support |
| 61 | KVMOPTS="--disable-kvm" |
| 62 | if [ "${PN}" != "qemu-native" -a "${PN}" != "nativesdk-qemu" ] \ |
| 63 | || [ -f /usr/include/linux/kvm.h ] ; then |
| 64 | KVMOPTS="${KVMENABLE}" |
| 65 | fi |
| 66 | |
| 67 | ${S}/configure --prefix=${prefix} --sysconfdir=${sysconfdir} --libexecdir=${libexecdir} --localstatedir=${localstatedir} --disable-strip ${EXTRA_OECONF} $KVMOPTS |
| 68 | test ! -e ${S}/target-i386/beginend_funcs.sh || chmod a+x ${S}/target-i386/beginend_funcs.sh |
| 69 | } |
| 70 | |
| 71 | do_compile_ptest() { |
| 72 | make buildtest-TESTS |
| 73 | } |
| 74 | |
| 75 | do_install_ptest() { |
| 76 | cp -rL ${B}/tests ${D}${PTEST_PATH} |
| 77 | find ${D}${PTEST_PATH}/tests -type f -name "*.[Sshcod]" | xargs -i rm -rf {} |
| 78 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 79 | cp ${S}/tests/Makefile.include ${D}${PTEST_PATH}/tests |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | do_install () { |
| 83 | export STRIP="true" |
| 84 | autotools_do_install |
| 85 | install -d ${D}${datadir}/qemu |
| 86 | install -m 0755 ${WORKDIR}/powerpc_rom.bin ${D}${datadir}/qemu |
| 87 | } |
| 88 | |
| 89 | # The following fragment will create a wrapper for qemu-mips user emulation |
| 90 | # binary in order to work around a segmentation fault issue. Basically, by |
| 91 | # default, the reserved virtual address space for 32-on-64 bit is set to 4GB. |
| 92 | # This will trigger a MMU access fault in the virtual CPU. With this change, |
| 93 | # the qemu-mips works fine. |
| 94 | # IMPORTANT: This piece needs to be removed once the root cause is fixed! |
| 95 | do_install_append() { |
| 96 | if [ -e "${D}/${bindir}/qemu-mips" ]; then |
| 97 | create_wrapper ${D}/${bindir}/qemu-mips \ |
| 98 | QEMU_RESERVED_VA=0x0 |
| 99 | fi |
| 100 | } |
| 101 | # END of qemu-mips workaround |
| 102 | |
| 103 | PACKAGECONFIG ??= " \ |
| 104 | fdt sdl \ |
| 105 | ${@bb.utils.contains('DISTRO_FEATURES', 'alsa', 'alsa', '', d)} \ |
| 106 | ${@bb.utils.contains('DISTRO_FEATURES', 'xen', 'xen', '', d)} \ |
| 107 | " |
| 108 | PACKAGECONFIG_class-native ??= "fdt alsa uuid" |
| 109 | PACKAGECONFIG_class-nativesdk ??= "fdt sdl" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 110 | |
| 111 | PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,libsdl" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 112 | PACKAGECONFIG[virtfs] = "--enable-virtfs --enable-attr,--disable-virtfs,libcap attr," |
| 113 | PACKAGECONFIG[aio] = "--enable-linux-aio,--disable-linux-aio,libaio," |
| 114 | PACKAGECONFIG[xfs] = "--enable-xfsctl,--disable-xfsctl,xfsprogs," |
| 115 | PACKAGECONFIG[xen] = "--enable-xen,--disable-xen,xen,xen-libxenstore xen-libxenctrl xen-libxenguest" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 116 | PACKAGECONFIG[vnc-sasl] = "--enable-vnc --enable-vnc-sasl,--disable-vnc-sasl,cyrus-sasl," |
| 117 | PACKAGECONFIG[vnc-jpeg] = "--enable-vnc --enable-vnc-jpeg,--disable-vnc-jpeg,jpeg," |
| 118 | PACKAGECONFIG[vnc-png] = "--enable-vnc --enable-vnc-png,--disable-vnc-png,libpng," |
| 119 | PACKAGECONFIG[libcurl] = "--enable-curl,--disable-curl,libcurl," |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 120 | PACKAGECONFIG[nss] = "--enable-smartcard,--disable-smartcard,nss," |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 121 | PACKAGECONFIG[uuid] = "--enable-uuid,--disable-uuid,util-linux," |
| 122 | PACKAGECONFIG[curses] = "--enable-curses,--disable-curses,ncurses," |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 123 | PACKAGECONFIG[gtk+] = "--enable-gtk --with-gtkabi=3.0 --enable-vte,--disable-gtk --disable-vte,gtk+3 vte" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 124 | PACKAGECONFIG[libcap-ng] = "--enable-cap-ng,--disable-cap-ng,libcap-ng," |
| 125 | PACKAGECONFIG[ssh2] = "--enable-libssh2,--disable-libssh2,libssh2," |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 126 | PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,gcrypt," |
| 127 | PACKAGECONFIG[nettle] = "--enable-nettle,--disable-nettle,nettle" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 128 | PACKAGECONFIG[libusb] = "--enable-libusb,--disable-libusb,libusb1" |
| 129 | PACKAGECONFIG[fdt] = "--enable-fdt,--disable-fdt,dtc" |
| 130 | PACKAGECONFIG[alsa] = ",,alsa-lib" |
| 131 | PACKAGECONFIG[glx] = "--enable-opengl,--disable-opengl,mesa" |
| 132 | PACKAGECONFIG[lzo] = "--enable-lzo,--disable-lzo,lzo" |
| 133 | PACKAGECONFIG[numa] = "--enable-numa,--disable-numa,numactl" |
| 134 | PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 135 | PACKAGECONFIG[bzip2] = "--enable-bzip2,--disable-bzip2,bzip2" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 136 | |
| 137 | EXTRA_OECONF += "${@bb.utils.contains('PACKAGECONFIG', 'alsa', '--audio-drv-list=oss,alsa', '', d)}" |
| 138 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 139 | INSANE_SKIP_${PN} = "arch" |