blob: a625809597fbda3a707bdf1e5745532e57a81f3e [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "Fast open source processor emulator"
Brad Bishopf3f93bb2019-10-16 14:33:32 -04002DESCRIPTION = "QEMU is a hosted virtual machine monitor: it emulates the \
3machine's processor through dynamic binary translation and provides a set \
4of different hardware and device models for the machine, enabling it to run \
5a variety of guest operating systems"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05006HOMEPAGE = "http://qemu.org"
7LICENSE = "GPLv2 & LGPLv2.1"
Brad Bishop19323692019-04-05 15:28:33 -04008
Andrew Geisslerd1e89492021-02-12 15:35:20 -06009RDEPENDS_${PN}-ptest = "bash"
Brad Bishop19323692019-04-05 15:28:33 -040010
Brad Bishop15ae2502019-06-18 21:44:24 -040011require qemu-targets.inc
Brad Bishop96ff1982019-08-19 13:50:42 -040012inherit pkgconfig ptest
Brad Bishop15ae2502019-06-18 21:44:24 -040013
Brad Bishop19323692019-04-05 15:28:33 -040014LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
Brad Bishopc342db32019-05-15 21:57:59 -040015 file://COPYING.LIB;endline=24;md5=8c5efda6cf1e1b03dcfd0e6c0d271c7f"
Brad Bishop19323692019-04-05 15:28:33 -040016
17SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
18 file://powerpc_rom.bin \
Brad Bishop19323692019-04-05 15:28:33 -040019 file://run-ptest \
Brad Bishopc342db32019-05-15 21:57:59 -040020 file://0001-qemu-Add-missing-wacom-HID-descriptor.patch \
Brad Bishopc342db32019-05-15 21:57:59 -040021 file://0003-qemu-Add-addition-environment-space-to-boot-loader-q.patch \
22 file://0004-qemu-disable-Valgrind.patch \
Brad Bishopc68388fc2019-08-26 01:33:31 -040023 file://0006-chardev-connect-socket-to-a-spawned-command.patch \
24 file://0007-apic-fixup-fallthrough-to-PIC.patch \
Brad Bishop79641f22019-09-10 07:20:22 -040025 file://0010-configure-Add-pkg-config-handling-for-libgcrypt.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050026 file://0001-Add-enable-disable-udev.patch \
Andrew Geisslerc9f78652020-09-18 14:11:35 -050027 file://0001-qemu-Do-not-include-file-if-not-exists.patch \
Andrew Geisslerd1e89492021-02-12 15:35:20 -060028 file://mingwfix.patch \
29 file://mmap.patch \
30 file://mmap2.patch \
Andrew Geissler90fd73c2021-03-05 15:25:55 -060031 file://determinism.patch \
Andrew Geisslerd1e89492021-02-12 15:35:20 -060032 file://0001-tests-meson.build-use-relative-path-to-refer-to-file.patch \
Andrew Geissler95ac1b82021-03-31 14:34:31 -050033 file://CVE-2021-20203.patch \
Andrew Geisslerc9f78652020-09-18 14:11:35 -050034 "
Brad Bishop19323692019-04-05 15:28:33 -040035UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
36
Andrew Geisslerd1e89492021-02-12 15:35:20 -060037SRC_URI[sha256sum] = "cb18d889b628fbe637672b0326789d9b0e3b8027e0445b936537c78549df17bc"
38
39SRC_URI_append_class-target = " file://cross.patch"
40SRC_URI_append_class-nativesdk = " file://cross.patch"
Brad Bishop19323692019-04-05 15:28:33 -040041
42COMPATIBLE_HOST_mipsarchn32 = "null"
43COMPATIBLE_HOST_mipsarchn64 = "null"
44
Andrew Geisslerc9f78652020-09-18 14:11:35 -050045# Per https://lists.nongnu.org/archive/html/qemu-devel/2020-09/msg03873.html
46# upstream states qemu doesn't work without optimization
47DEBUG_BUILD = "0"
48
Brad Bishop19323692019-04-05 15:28:33 -040049do_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 Bishop19323692019-04-05 15:28:33 -040054do_install_ptest() {
55 cp -rL ${B}/tests ${D}${PTEST_PATH}
Andrew Geisslerd1e89492021-02-12 15:35:20 -060056 find ${D}${PTEST_PATH}/tests -type f -name "*.[Sshcodp]" | xargs -i rm -rf {}
Brad Bishop19323692019-04-05 15:28:33 -040057
Brad Bishop19323692019-04-05 15:28:33 -040058 # Don't check the file genreated by configure
Andrew Geissler82c905d2020-04-13 13:39:40 -050059 sed -i -e 's,${HOSTTOOLS_DIR}/python3,${bindir}/python3,' \
60 ${D}/${PTEST_PATH}/tests/qemu-iotests/common.env
Andrew Geissler635e0e42020-08-21 15:58:33 -050061 sed -i -e "1s,#!/usr/bin/bash,#!${base_bindir}/bash," ${D}${PTEST_PATH}/tests/data/acpi/disassemle-aml.sh
Andrew Geissler90fd73c2021-03-05 15:25:55 -060062
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 Bishop19323692019-04-05 15:28:33 -040065}
66
Patrick Williamsc124f4f2015-09-15 14:41:29 -050067# QEMU_TARGETS is overridable variable
Andrew Geissler82c905d2020-04-13 13:39:40 -050068QEMU_TARGETS ?= "arm aarch64 i386 mips mipsel mips64 mips64el ppc ppc64 ppc64le riscv32 riscv64 sh4 x86_64"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050069
Brad Bishop6e60e8b2018-02-01 10:27:11 -050070EXTRA_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 Geisslerd1e89492021-02-12 15:35:20 -060081 --with-suffix=${BPN} \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050082 --disable-strip \
83 --disable-werror \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050084 --extra-cflags='${CFLAGS}' \
Andrew Geisslerd25ed322020-06-27 00:28:28 -050085 --extra-ldflags='${LDFLAGS}' \
Andrew Geissler82c905d2020-04-13 13:39:40 -050086 --with-git=/bin/false \
87 --disable-git-update \
Andrew Geisslerd1e89492021-02-12 15:35:20 -060088 --meson=meson \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080089 ${PACKAGECONFIG_CONFARGS} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050090 "
Patrick Williamsc0f7c042017-02-23 20:41:17 -060091
Patrick Williamsc124f4f2015-09-15 14:41:29 -050092export LIBTOOL="${HOST_SYS}-libtool"
93
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080094B = "${WORKDIR}/build"
95
Andrew Geisslerd1e89492021-02-12 15:35:20 -060096#EXTRA_OECONF_append = " --python=${HOSTTOOLS_DIR}/python3"
Brad Bishop96ff1982019-08-19 13:50:42 -040097
Patrick Williamsc124f4f2015-09-15 14:41:29 -050098do_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 Williamsc124f4f2015-09-15 14:41:29 -0500103 fi
104}
105
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500106do_configure() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500107 ${S}/configure ${EXTRA_OECONF}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500108}
Brad Bishop64c979e2019-11-04 13:55:29 -0500109do_configure[cleandirs] += "${B}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500110
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500111do_install () {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800112 export STRIP=""
113 oe_runmake 'DESTDIR=${D}' install
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500114}
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!
122do_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 Bishop19323692019-04-05 15:28:33 -0400130make_qemu_wrapper() {
131 gdk_pixbuf_module_file=`pkg-config --variable=gdk_pixbuf_cache_file gdk-pixbuf-2.0`
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500132
Brad Bishop19323692019-04-05 15:28:33 -0400133 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 Bishop6e60e8b2018-02-01 10:27:11 -0500140
Brad Bishop19323692019-04-05 15:28:33 -0400141# Disable kvm/virgl/mesa on targets that do not support it
142PACKAGECONFIG_remove_darwin = "kvm virglrenderer glx gtk+"
143PACKAGECONFIG_remove_mingw32 = "kvm virglrenderer glx gtk+"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600144
Brad Bishopc342db32019-05-15 21:57:59 -0400145PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,libsdl2"
Andrew Geisslerb7d28612020-07-24 16:15:54 -0500146PACKAGECONFIG[virtfs] = "--enable-virtfs --enable-attr --enable-cap-ng,--disable-virtfs,libcap-ng attr,"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500147PACKAGECONFIG[aio] = "--enable-linux-aio,--disable-linux-aio,libaio,"
148PACKAGECONFIG[xfs] = "--enable-xfsctl,--disable-xfsctl,xfsprogs,"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500149PACKAGECONFIG[xen] = "--enable-xen,--disable-xen,xen-tools,xen-tools-libxenstore xen-tools-libxenctrl xen-tools-libxenguest"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500150PACKAGECONFIG[vnc-sasl] = "--enable-vnc --enable-vnc-sasl,--disable-vnc-sasl,cyrus-sasl,"
151PACKAGECONFIG[vnc-jpeg] = "--enable-vnc --enable-vnc-jpeg,--disable-vnc-jpeg,jpeg,"
152PACKAGECONFIG[vnc-png] = "--enable-vnc --enable-vnc-png,--disable-vnc-png,libpng,"
Brad Bishop79641f22019-09-10 07:20:22 -0400153PACKAGECONFIG[libcurl] = "--enable-curl,--disable-curl,curl,"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500154PACKAGECONFIG[nss] = "--enable-smartcard,--disable-smartcard,nss,"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500155PACKAGECONFIG[curses] = "--enable-curses,--disable-curses,ncurses,"
Brad Bishopc342db32019-05-15 21:57:59 -0400156PACKAGECONFIG[gtk+] = "--enable-gtk,--disable-gtk,gtk+3 gettext-native"
157PACKAGECONFIG[vte] = "--enable-vte,--disable-vte,vte gettext-native"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500158PACKAGECONFIG[libcap-ng] = "--enable-cap-ng,--disable-cap-ng,libcap-ng,"
Brad Bishopc68388fc2019-08-26 01:33:31 -0400159PACKAGECONFIG[ssh] = "--enable-libssh,--disable-libssh,libssh,"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500160PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt,"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500161PACKAGECONFIG[nettle] = "--enable-nettle,--disable-nettle,nettle"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500162PACKAGECONFIG[libusb] = "--enable-libusb,--disable-libusb,libusb1"
163PACKAGECONFIG[fdt] = "--enable-fdt,--disable-fdt,dtc"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500164PACKAGECONFIG[alsa] = "--audio-drv-list='oss alsa',,alsa-lib"
Andrew Geissler635e0e42020-08-21 15:58:33 -0500165PACKAGECONFIG[glx] = "--enable-opengl,--disable-opengl,virtual/libgl"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500166PACKAGECONFIG[lzo] = "--enable-lzo,--disable-lzo,lzo"
167PACKAGECONFIG[numa] = "--enable-numa,--disable-numa,numactl"
168PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600169PACKAGECONFIG[bzip2] = "--enable-bzip2,--disable-bzip2,bzip2"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500170PACKAGECONFIG[libiscsi] = "--enable-libiscsi,--disable-libiscsi"
171PACKAGECONFIG[kvm] = "--enable-kvm,--disable-kvm"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800172PACKAGECONFIG[virglrenderer] = "--enable-virglrenderer,--disable-virglrenderer,virglrenderer"
173# spice will be in meta-networking layer
174PACKAGECONFIG[spice] = "--enable-spice,--disable-spice,spice"
175# usbredir will be in meta-networking layer
176PACKAGECONFIG[usb-redir] = "--enable-usb-redir,--disable-usb-redir,usbredir"
Brad Bishopc342db32019-05-15 21:57:59 -0400177PACKAGECONFIG[snappy] = "--enable-snappy,--disable-snappy,snappy"
Andrew Geisslerd25ed322020-06-27 00:28:28 -0500178PACKAGECONFIG[glusterfs] = "--enable-glusterfs,--disable-glusterfs,glusterfs"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500179PACKAGECONFIG[xkbcommon] = "--enable-xkbcommon,--disable-xkbcommon,libxkbcommon"
180PACKAGECONFIG[libudev] = "--enable-libudev,--disable-libudev,eudev"
181PACKAGECONFIG[libxml2] = "--enable-libxml2,--disable-libxml2,libxml2"
Andrew Geisslerd25ed322020-06-27 00:28:28 -0500182PACKAGECONFIG[attr] = "--enable-attr,--disable-attr,attr,"
183PACKAGECONFIG[rbd] = "--enable-rbd,--disable-rbd,ceph,ceph"
184PACKAGECONFIG[vhost] = "--enable-vhost-net,--disable-vhost-net,,"
185PACKAGECONFIG[ust] = "--enable-trace-backend=ust,--enable-trace-backend=nop,lttng-ust,"
186PACKAGECONFIG[pie] = "--enable-pie,--disable-pie,,"
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600187PACKAGECONFIG[seccomp] = "--enable-seccomp,--disable-seccomp,libseccomp"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500188
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500189INSANE_SKIP_${PN} = "arch"
Brad Bishopc342db32019-05-15 21:57:59 -0400190
191FILES_${PN} += "${datadir}/icons"