Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | SUMMARY = "Fast open source processor emulator" |
Brad Bishop | f3f93bb | 2019-10-16 14:33:32 -0400 | [diff] [blame] | 2 | DESCRIPTION = "QEMU is a hosted virtual machine monitor: it emulates the \ |
| 3 | machine's processor through dynamic binary translation and provides a set \ |
| 4 | of different hardware and device models for the machine, enabling it to run \ |
| 5 | a variety of guest operating systems" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 6 | HOMEPAGE = "http://qemu.org" |
| 7 | LICENSE = "GPLv2 & LGPLv2.1" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 8 | |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 9 | RDEPENDS_${PN}-ptest = "bash" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 10 | |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 11 | require qemu-targets.inc |
Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame] | 12 | inherit pkgconfig ptest |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 13 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 14 | LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 15 | file://COPYING.LIB;endline=24;md5=8c5efda6cf1e1b03dcfd0e6c0d271c7f" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 16 | |
| 17 | SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \ |
| 18 | file://powerpc_rom.bin \ |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 19 | file://run-ptest \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 20 | file://0001-qemu-Add-missing-wacom-HID-descriptor.patch \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 21 | file://0003-qemu-Add-addition-environment-space-to-boot-loader-q.patch \ |
| 22 | file://0004-qemu-disable-Valgrind.patch \ |
Brad Bishop | c68388fc | 2019-08-26 01:33:31 -0400 | [diff] [blame] | 23 | file://0006-chardev-connect-socket-to-a-spawned-command.patch \ |
| 24 | file://0007-apic-fixup-fallthrough-to-PIC.patch \ |
Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 25 | file://0010-configure-Add-pkg-config-handling-for-libgcrypt.patch \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 26 | file://0001-Add-enable-disable-udev.patch \ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 27 | file://0001-qemu-Do-not-include-file-if-not-exists.patch \ |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 28 | file://mingwfix.patch \ |
| 29 | file://mmap.patch \ |
| 30 | file://mmap2.patch \ |
Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 31 | file://determinism.patch \ |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 32 | file://0001-tests-meson.build-use-relative-path-to-refer-to-file.patch \ |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame^] | 33 | file://CVE-2021-20203.patch \ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 34 | " |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 35 | UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" |
| 36 | |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 37 | SRC_URI[sha256sum] = "cb18d889b628fbe637672b0326789d9b0e3b8027e0445b936537c78549df17bc" |
| 38 | |
| 39 | SRC_URI_append_class-target = " file://cross.patch" |
| 40 | SRC_URI_append_class-nativesdk = " file://cross.patch" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 41 | |
| 42 | COMPATIBLE_HOST_mipsarchn32 = "null" |
| 43 | COMPATIBLE_HOST_mipsarchn64 = "null" |
| 44 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 45 | # Per https://lists.nongnu.org/archive/html/qemu-devel/2020-09/msg03873.html |
| 46 | # upstream states qemu doesn't work without optimization |
| 47 | DEBUG_BUILD = "0" |
| 48 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 49 | do_install_append() { |
| 50 | # Prevent QA warnings about installed ${localstatedir}/run |
| 51 | if [ -d ${D}${localstatedir}/run ]; then rmdir ${D}${localstatedir}/run; fi |
| 52 | } |
| 53 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 54 | do_install_ptest() { |
| 55 | cp -rL ${B}/tests ${D}${PTEST_PATH} |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 56 | find ${D}${PTEST_PATH}/tests -type f -name "*.[Sshcodp]" | xargs -i rm -rf {} |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 57 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 58 | # Don't check the file genreated by configure |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 59 | sed -i -e 's,${HOSTTOOLS_DIR}/python3,${bindir}/python3,' \ |
| 60 | ${D}/${PTEST_PATH}/tests/qemu-iotests/common.env |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 61 | sed -i -e "1s,#!/usr/bin/bash,#!${base_bindir}/bash," ${D}${PTEST_PATH}/tests/data/acpi/disassemle-aml.sh |
Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 62 | |
| 63 | # Strip the paths from the QEMU variable, we can use PATH |
| 64 | sed -i -e "s#^QEMU=.*/qemu-#QEMU=qemu-#g" ${D}${PTEST_PATH}/tests/tcg/*.mak |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 65 | } |
| 66 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 67 | # QEMU_TARGETS is overridable variable |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 68 | QEMU_TARGETS ?= "arm aarch64 i386 mips mipsel mips64 mips64el ppc ppc64 ppc64le riscv32 riscv64 sh4 x86_64" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 69 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 70 | EXTRA_OECONF = " \ |
| 71 | --prefix=${prefix} \ |
| 72 | --bindir=${bindir} \ |
| 73 | --includedir=${includedir} \ |
| 74 | --libdir=${libdir} \ |
| 75 | --mandir=${mandir} \ |
| 76 | --datadir=${datadir} \ |
| 77 | --docdir=${docdir}/${BPN} \ |
| 78 | --sysconfdir=${sysconfdir} \ |
| 79 | --libexecdir=${libexecdir} \ |
| 80 | --localstatedir=${localstatedir} \ |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 81 | --with-suffix=${BPN} \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 82 | --disable-strip \ |
| 83 | --disable-werror \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 84 | --extra-cflags='${CFLAGS}' \ |
Andrew Geissler | d25ed32 | 2020-06-27 00:28:28 -0500 | [diff] [blame] | 85 | --extra-ldflags='${LDFLAGS}' \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 86 | --with-git=/bin/false \ |
| 87 | --disable-git-update \ |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 88 | --meson=meson \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 89 | ${PACKAGECONFIG_CONFARGS} \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 90 | " |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 91 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 92 | export LIBTOOL="${HOST_SYS}-libtool" |
| 93 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 94 | B = "${WORKDIR}/build" |
| 95 | |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 96 | #EXTRA_OECONF_append = " --python=${HOSTTOOLS_DIR}/python3" |
Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame] | 97 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 98 | do_configure_prepend_class-native() { |
| 99 | # Append build host pkg-config paths for native target since the host may provide sdl |
| 100 | BHOST_PKGCONFIG_PATH=$(PATH=/usr/bin:/bin pkg-config --variable pc_path pkg-config || echo "") |
| 101 | if [ ! -z "$BHOST_PKGCONFIG_PATH" ]; then |
| 102 | export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$BHOST_PKGCONFIG_PATH |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 103 | fi |
| 104 | } |
| 105 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 106 | do_configure() { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 107 | ${S}/configure ${EXTRA_OECONF} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 108 | } |
Brad Bishop | 64c979e | 2019-11-04 13:55:29 -0500 | [diff] [blame] | 109 | do_configure[cleandirs] += "${B}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 110 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 111 | do_install () { |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 112 | export STRIP="" |
| 113 | oe_runmake 'DESTDIR=${D}' install |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 114 | } |
| 115 | |
| 116 | # The following fragment will create a wrapper for qemu-mips user emulation |
| 117 | # binary in order to work around a segmentation fault issue. Basically, by |
| 118 | # default, the reserved virtual address space for 32-on-64 bit is set to 4GB. |
| 119 | # This will trigger a MMU access fault in the virtual CPU. With this change, |
| 120 | # the qemu-mips works fine. |
| 121 | # IMPORTANT: This piece needs to be removed once the root cause is fixed! |
| 122 | do_install_append() { |
| 123 | if [ -e "${D}/${bindir}/qemu-mips" ]; then |
| 124 | create_wrapper ${D}/${bindir}/qemu-mips \ |
| 125 | QEMU_RESERVED_VA=0x0 |
| 126 | fi |
| 127 | } |
| 128 | # END of qemu-mips workaround |
| 129 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 130 | make_qemu_wrapper() { |
| 131 | gdk_pixbuf_module_file=`pkg-config --variable=gdk_pixbuf_cache_file gdk-pixbuf-2.0` |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 132 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 133 | for tool in `ls ${D}${bindir}/qemu-system-*`; do |
| 134 | create_wrapper $tool \ |
| 135 | GDK_PIXBUF_MODULE_FILE=$gdk_pixbuf_module_file \ |
| 136 | FONTCONFIG_PATH=/etc/fonts \ |
| 137 | GTK_THEME=Adwaita |
| 138 | done |
| 139 | } |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 140 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 141 | # Disable kvm/virgl/mesa on targets that do not support it |
| 142 | PACKAGECONFIG_remove_darwin = "kvm virglrenderer glx gtk+" |
| 143 | PACKAGECONFIG_remove_mingw32 = "kvm virglrenderer glx gtk+" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 144 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 145 | PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,libsdl2" |
Andrew Geissler | b7d2861 | 2020-07-24 16:15:54 -0500 | [diff] [blame] | 146 | PACKAGECONFIG[virtfs] = "--enable-virtfs --enable-attr --enable-cap-ng,--disable-virtfs,libcap-ng attr," |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 147 | PACKAGECONFIG[aio] = "--enable-linux-aio,--disable-linux-aio,libaio," |
| 148 | PACKAGECONFIG[xfs] = "--enable-xfsctl,--disable-xfsctl,xfsprogs," |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 149 | PACKAGECONFIG[xen] = "--enable-xen,--disable-xen,xen-tools,xen-tools-libxenstore xen-tools-libxenctrl xen-tools-libxenguest" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 150 | PACKAGECONFIG[vnc-sasl] = "--enable-vnc --enable-vnc-sasl,--disable-vnc-sasl,cyrus-sasl," |
| 151 | PACKAGECONFIG[vnc-jpeg] = "--enable-vnc --enable-vnc-jpeg,--disable-vnc-jpeg,jpeg," |
| 152 | PACKAGECONFIG[vnc-png] = "--enable-vnc --enable-vnc-png,--disable-vnc-png,libpng," |
Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 153 | PACKAGECONFIG[libcurl] = "--enable-curl,--disable-curl,curl," |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 154 | PACKAGECONFIG[nss] = "--enable-smartcard,--disable-smartcard,nss," |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 155 | PACKAGECONFIG[curses] = "--enable-curses,--disable-curses,ncurses," |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 156 | PACKAGECONFIG[gtk+] = "--enable-gtk,--disable-gtk,gtk+3 gettext-native" |
| 157 | PACKAGECONFIG[vte] = "--enable-vte,--disable-vte,vte gettext-native" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 158 | PACKAGECONFIG[libcap-ng] = "--enable-cap-ng,--disable-cap-ng,libcap-ng," |
Brad Bishop | c68388fc | 2019-08-26 01:33:31 -0400 | [diff] [blame] | 159 | PACKAGECONFIG[ssh] = "--enable-libssh,--disable-libssh,libssh," |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 160 | PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt," |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 161 | PACKAGECONFIG[nettle] = "--enable-nettle,--disable-nettle,nettle" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 162 | PACKAGECONFIG[libusb] = "--enable-libusb,--disable-libusb,libusb1" |
| 163 | PACKAGECONFIG[fdt] = "--enable-fdt,--disable-fdt,dtc" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 164 | PACKAGECONFIG[alsa] = "--audio-drv-list='oss alsa',,alsa-lib" |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 165 | PACKAGECONFIG[glx] = "--enable-opengl,--disable-opengl,virtual/libgl" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 166 | PACKAGECONFIG[lzo] = "--enable-lzo,--disable-lzo,lzo" |
| 167 | PACKAGECONFIG[numa] = "--enable-numa,--disable-numa,numactl" |
| 168 | PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 169 | PACKAGECONFIG[bzip2] = "--enable-bzip2,--disable-bzip2,bzip2" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 170 | PACKAGECONFIG[libiscsi] = "--enable-libiscsi,--disable-libiscsi" |
| 171 | PACKAGECONFIG[kvm] = "--enable-kvm,--disable-kvm" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 172 | PACKAGECONFIG[virglrenderer] = "--enable-virglrenderer,--disable-virglrenderer,virglrenderer" |
| 173 | # spice will be in meta-networking layer |
| 174 | PACKAGECONFIG[spice] = "--enable-spice,--disable-spice,spice" |
| 175 | # usbredir will be in meta-networking layer |
| 176 | PACKAGECONFIG[usb-redir] = "--enable-usb-redir,--disable-usb-redir,usbredir" |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 177 | PACKAGECONFIG[snappy] = "--enable-snappy,--disable-snappy,snappy" |
Andrew Geissler | d25ed32 | 2020-06-27 00:28:28 -0500 | [diff] [blame] | 178 | PACKAGECONFIG[glusterfs] = "--enable-glusterfs,--disable-glusterfs,glusterfs" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 179 | PACKAGECONFIG[xkbcommon] = "--enable-xkbcommon,--disable-xkbcommon,libxkbcommon" |
| 180 | PACKAGECONFIG[libudev] = "--enable-libudev,--disable-libudev,eudev" |
| 181 | PACKAGECONFIG[libxml2] = "--enable-libxml2,--disable-libxml2,libxml2" |
Andrew Geissler | d25ed32 | 2020-06-27 00:28:28 -0500 | [diff] [blame] | 182 | PACKAGECONFIG[attr] = "--enable-attr,--disable-attr,attr," |
| 183 | PACKAGECONFIG[rbd] = "--enable-rbd,--disable-rbd,ceph,ceph" |
| 184 | PACKAGECONFIG[vhost] = "--enable-vhost-net,--disable-vhost-net,," |
| 185 | PACKAGECONFIG[ust] = "--enable-trace-backend=ust,--enable-trace-backend=nop,lttng-ust," |
| 186 | PACKAGECONFIG[pie] = "--enable-pie,--disable-pie,," |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 187 | PACKAGECONFIG[seccomp] = "--enable-seccomp,--disable-seccomp,libseccomp" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 188 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 189 | INSANE_SKIP_${PN} = "arch" |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 190 | |
| 191 | FILES_${PN} += "${datadir}/icons" |