blob: cbbb99f611dd359ddf3bf5e4258ba9e366edcb2b [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"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00007LICENSE = "GPL-2.0-only & LGPL-2.1-only"
Brad Bishop19323692019-04-05 15:28:33 -04008
Patrick Williams213cb262021-08-07 19:21:33 -05009RDEPENDS:${PN}-ptest = "bash"
Brad Bishop19323692019-04-05 15:28:33 -040010
Brad Bishop15ae2502019-06-18 21:44:24 -040011require qemu-targets.inc
Andrew Geisslereff27472021-10-29 15:35:00 -050012inherit pkgconfig ptest python3-dir
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 \
Brad Bishopc68388fc2019-08-26 01:33:31 -040022 file://0006-chardev-connect-socket-to-a-spawned-command.patch \
23 file://0007-apic-fixup-fallthrough-to-PIC.patch \
Brad Bishop79641f22019-09-10 07:20:22 -040024 file://0010-configure-Add-pkg-config-handling-for-libgcrypt.patch \
Andrew Geisslerc9f78652020-09-18 14:11:35 -050025 file://0001-qemu-Do-not-include-file-if-not-exists.patch \
Andrew Geisslerd1e89492021-02-12 15:35:20 -060026 file://mmap2.patch \
Andrew Geissler90fd73c2021-03-05 15:25:55 -060027 file://determinism.patch \
Andrew Geisslerd1e89492021-02-12 15:35:20 -060028 file://0001-tests-meson.build-use-relative-path-to-refer-to-file.patch \
Andrew Geissler595f6302022-01-24 19:11:47 +000029 file://0001-riscv-Set-5.4-as-minimum-kernel-version-for-riscv32.patch \
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000030 file://0001-acpi-tpm-Add-missing-device-identification-objects.patch \
Andrew Geisslerc9f78652020-09-18 14:11:35 -050031 "
Brad Bishop19323692019-04-05 15:28:33 -040032UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
33
Andrew Geissler595f6302022-01-24 19:11:47 +000034SRC_URI[sha256sum] = "68e15d8e45ac56326e0b9a4afa8b49a3dfe8aba3488221d098c84698bca65b45"
Andrew Geisslerd1e89492021-02-12 15:35:20 -060035
Patrick Williams213cb262021-08-07 19:21:33 -050036SRC_URI:append:class-target = " file://cross.patch"
37SRC_URI:append:class-nativesdk = " file://cross.patch"
Brad Bishop19323692019-04-05 15:28:33 -040038
William A. Kennington IIIac69b482021-06-02 12:28:27 -070039# Applies against virglrender < 0.6.0 and not qemu itself
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000040CVE_CHECK_IGNORE += "CVE-2017-5957"
William A. Kennington IIIac69b482021-06-02 12:28:27 -070041
42# The VNC server can expose host files uder some circumstances. We don't
43# enable it by default.
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000044CVE_CHECK_IGNORE += "CVE-2007-0998"
William A. Kennington IIIac69b482021-06-02 12:28:27 -070045
46# 'The issues identified by this CVE were determined to not constitute a vulnerability.'
47# https://bugzilla.redhat.com/show_bug.cgi?id=1609015#c11
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000048CVE_CHECK_IGNORE += "CVE-2018-18438"
William A. Kennington IIIac69b482021-06-02 12:28:27 -070049
Patrick Williams213cb262021-08-07 19:21:33 -050050COMPATIBLE_HOST:mipsarchn32 = "null"
51COMPATIBLE_HOST:mipsarchn64 = "null"
Andrew Geissler595f6302022-01-24 19:11:47 +000052COMPATIBLE_HOST:riscv32 = "null"
Brad Bishop19323692019-04-05 15:28:33 -040053
Andrew Geisslerc9f78652020-09-18 14:11:35 -050054# Per https://lists.nongnu.org/archive/html/qemu-devel/2020-09/msg03873.html
55# upstream states qemu doesn't work without optimization
56DEBUG_BUILD = "0"
57
Patrick Williams213cb262021-08-07 19:21:33 -050058do_install:append() {
Brad Bishop19323692019-04-05 15:28:33 -040059 # Prevent QA warnings about installed ${localstatedir}/run
60 if [ -d ${D}${localstatedir}/run ]; then rmdir ${D}${localstatedir}/run; fi
61}
62
Brad Bishop19323692019-04-05 15:28:33 -040063do_install_ptest() {
64 cp -rL ${B}/tests ${D}${PTEST_PATH}
Andrew Geisslerd1e89492021-02-12 15:35:20 -060065 find ${D}${PTEST_PATH}/tests -type f -name "*.[Sshcodp]" | xargs -i rm -rf {}
Brad Bishop19323692019-04-05 15:28:33 -040066
Brad Bishop19323692019-04-05 15:28:33 -040067 # Don't check the file genreated by configure
Andrew Geissler635e0e42020-08-21 15:58:33 -050068 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 -060069
70 # Strip the paths from the QEMU variable, we can use PATH
71 sed -i -e "s#^QEMU=.*/qemu-#QEMU=qemu-#g" ${D}${PTEST_PATH}/tests/tcg/*.mak
Andrew Geisslereff27472021-10-29 15:35:00 -050072
73 # Strip compiler flags as they break reproducibility
74 sed -i -e "s,CROSS_CC_GUEST=.*,CROSS_CC_GUEST=," ${D}${PTEST_PATH}/tests/tcg/*.mak
Brad Bishop19323692019-04-05 15:28:33 -040075}
76
Patrick Williamsc124f4f2015-09-15 14:41:29 -050077# QEMU_TARGETS is overridable variable
Andrew Geissler82c905d2020-04-13 13:39:40 -050078QEMU_TARGETS ?= "arm aarch64 i386 mips mipsel mips64 mips64el ppc ppc64 ppc64le riscv32 riscv64 sh4 x86_64"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050079
Brad Bishop6e60e8b2018-02-01 10:27:11 -050080EXTRA_OECONF = " \
81 --prefix=${prefix} \
82 --bindir=${bindir} \
83 --includedir=${includedir} \
84 --libdir=${libdir} \
85 --mandir=${mandir} \
86 --datadir=${datadir} \
87 --docdir=${docdir}/${BPN} \
88 --sysconfdir=${sysconfdir} \
89 --libexecdir=${libexecdir} \
90 --localstatedir=${localstatedir} \
Andrew Geisslerd1e89492021-02-12 15:35:20 -060091 --with-suffix=${BPN} \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050092 --disable-strip \
93 --disable-werror \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050094 --extra-cflags='${CFLAGS}' \
Andrew Geisslerd25ed322020-06-27 00:28:28 -050095 --extra-ldflags='${LDFLAGS}' \
Andrew Geissler82c905d2020-04-13 13:39:40 -050096 --with-git=/bin/false \
William A. Kennington IIIac69b482021-06-02 12:28:27 -070097 --with-git-submodules=ignore \
Andrew Geisslerd1e89492021-02-12 15:35:20 -060098 --meson=meson \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080099 ${PACKAGECONFIG_CONFARGS} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500100 "
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600101
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800102B = "${WORKDIR}/build"
103
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500104#EXTRA_OECONF:append = " --python=${HOSTTOOLS_DIR}/python3"
Brad Bishop96ff1982019-08-19 13:50:42 -0400105
Patrick Williams213cb262021-08-07 19:21:33 -0500106do_configure:prepend:class-native() {
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500107 # Append build host pkg-config paths for native target since the host may provide sdl
108 BHOST_PKGCONFIG_PATH=$(PATH=/usr/bin:/bin pkg-config --variable pc_path pkg-config || echo "")
109 if [ ! -z "$BHOST_PKGCONFIG_PATH" ]; then
110 export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$BHOST_PKGCONFIG_PATH
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500111 fi
112}
113
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500114do_configure() {
Andrew Geisslereff27472021-10-29 15:35:00 -0500115 # This is taken from meson.bbclass to avoid errors when updating to a
116 # new version of meson.
117 rmdir ${STAGING_LIBDIR_NATIVE}/${PYTHON_DIR}/site-packages/*.egg-info 2>/dev/null || :
118
119 ${S}/configure ${EXTRA_OECONF}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500120}
Brad Bishop64c979e2019-11-04 13:55:29 -0500121do_configure[cleandirs] += "${B}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500122
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500123do_install () {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800124 export STRIP=""
125 oe_runmake 'DESTDIR=${D}' install
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500126}
127
128# The following fragment will create a wrapper for qemu-mips user emulation
129# binary in order to work around a segmentation fault issue. Basically, by
130# default, the reserved virtual address space for 32-on-64 bit is set to 4GB.
131# This will trigger a MMU access fault in the virtual CPU. With this change,
132# the qemu-mips works fine.
133# IMPORTANT: This piece needs to be removed once the root cause is fixed!
Patrick Williams213cb262021-08-07 19:21:33 -0500134do_install:append() {
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500135 if [ -e "${D}/${bindir}/qemu-mips" ]; then
136 create_wrapper ${D}/${bindir}/qemu-mips \
137 QEMU_RESERVED_VA=0x0
138 fi
139}
140# END of qemu-mips workaround
141
Brad Bishop19323692019-04-05 15:28:33 -0400142# Disable kvm/virgl/mesa on targets that do not support it
Patrick Williams213cb262021-08-07 19:21:33 -0500143PACKAGECONFIG:remove:darwin = "kvm virglrenderer glx gtk+"
144PACKAGECONFIG:remove:mingw32 = "kvm virglrenderer glx gtk+"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600145
Brad Bishopc342db32019-05-15 21:57:59 -0400146PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,libsdl2"
Andrew Geisslerb7d28612020-07-24 16:15:54 -0500147PACKAGECONFIG[virtfs] = "--enable-virtfs --enable-attr --enable-cap-ng,--disable-virtfs,libcap-ng attr,"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500148PACKAGECONFIG[aio] = "--enable-linux-aio,--disable-linux-aio,libaio,"
149PACKAGECONFIG[xfs] = "--enable-xfsctl,--disable-xfsctl,xfsprogs,"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500150PACKAGECONFIG[xen] = "--enable-xen,--disable-xen,xen-tools,xen-tools-libxenstore xen-tools-libxenctrl xen-tools-libxenguest"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500151PACKAGECONFIG[vnc-sasl] = "--enable-vnc --enable-vnc-sasl,--disable-vnc-sasl,cyrus-sasl,"
152PACKAGECONFIG[vnc-jpeg] = "--enable-vnc --enable-vnc-jpeg,--disable-vnc-jpeg,jpeg,"
153PACKAGECONFIG[vnc-png] = "--enable-vnc --enable-vnc-png,--disable-vnc-png,libpng,"
Brad Bishop79641f22019-09-10 07:20:22 -0400154PACKAGECONFIG[libcurl] = "--enable-curl,--disable-curl,curl,"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500155PACKAGECONFIG[nss] = "--enable-smartcard,--disable-smartcard,nss,"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500156PACKAGECONFIG[curses] = "--enable-curses,--disable-curses,ncurses,"
Brad Bishopc342db32019-05-15 21:57:59 -0400157PACKAGECONFIG[gtk+] = "--enable-gtk,--disable-gtk,gtk+3 gettext-native"
158PACKAGECONFIG[vte] = "--enable-vte,--disable-vte,vte gettext-native"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500159PACKAGECONFIG[libcap-ng] = "--enable-cap-ng,--disable-cap-ng,libcap-ng,"
Brad Bishopc68388fc2019-08-26 01:33:31 -0400160PACKAGECONFIG[ssh] = "--enable-libssh,--disable-libssh,libssh,"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500161PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt,"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500162PACKAGECONFIG[nettle] = "--enable-nettle,--disable-nettle,nettle"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500163PACKAGECONFIG[libusb] = "--enable-libusb,--disable-libusb,libusb1"
164PACKAGECONFIG[fdt] = "--enable-fdt,--disable-fdt,dtc"
Andrew Geissler595f6302022-01-24 19:11:47 +0000165PACKAGECONFIG[alsa] = "--audio-drv-list=default,,alsa-lib"
Andrew Geissler635e0e42020-08-21 15:58:33 -0500166PACKAGECONFIG[glx] = "--enable-opengl,--disable-opengl,virtual/libgl"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500167PACKAGECONFIG[lzo] = "--enable-lzo,--disable-lzo,lzo"
168PACKAGECONFIG[numa] = "--enable-numa,--disable-numa,numactl"
169PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600170PACKAGECONFIG[bzip2] = "--enable-bzip2,--disable-bzip2,bzip2"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500171PACKAGECONFIG[libiscsi] = "--enable-libiscsi,--disable-libiscsi"
172PACKAGECONFIG[kvm] = "--enable-kvm,--disable-kvm"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800173PACKAGECONFIG[virglrenderer] = "--enable-virglrenderer,--disable-virglrenderer,virglrenderer"
174# spice will be in meta-networking layer
175PACKAGECONFIG[spice] = "--enable-spice,--disable-spice,spice"
176# usbredir will be in meta-networking layer
177PACKAGECONFIG[usb-redir] = "--enable-usb-redir,--disable-usb-redir,usbredir"
Brad Bishopc342db32019-05-15 21:57:59 -0400178PACKAGECONFIG[snappy] = "--enable-snappy,--disable-snappy,snappy"
Andrew Geisslerd25ed322020-06-27 00:28:28 -0500179PACKAGECONFIG[glusterfs] = "--enable-glusterfs,--disable-glusterfs,glusterfs"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500180PACKAGECONFIG[xkbcommon] = "--enable-xkbcommon,--disable-xkbcommon,libxkbcommon"
181PACKAGECONFIG[libudev] = "--enable-libudev,--disable-libudev,eudev"
182PACKAGECONFIG[libxml2] = "--enable-libxml2,--disable-libxml2,libxml2"
Andrew Geisslerd25ed322020-06-27 00:28:28 -0500183PACKAGECONFIG[attr] = "--enable-attr,--disable-attr,attr,"
184PACKAGECONFIG[rbd] = "--enable-rbd,--disable-rbd,ceph,ceph"
185PACKAGECONFIG[vhost] = "--enable-vhost-net,--disable-vhost-net,,"
186PACKAGECONFIG[ust] = "--enable-trace-backend=ust,--enable-trace-backend=nop,lttng-ust,"
187PACKAGECONFIG[pie] = "--enable-pie,--disable-pie,,"
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600188PACKAGECONFIG[seccomp] = "--enable-seccomp,--disable-seccomp,libseccomp"
Andrew Geisslereff27472021-10-29 15:35:00 -0500189# libnfs is currently provided by meta-kodi
190PACKAGECONFIG[libnfs] = "--enable-libnfs,--disable-libnfs,libnfs"
191PACKAGECONFIG[pmem] = "--enable-libpmem,--disable-libpmem,pmdk"
Andrew Geissler595f6302022-01-24 19:11:47 +0000192PACKAGECONFIG[pulsedio] = "--enable-pa,--disable-pa,pulseaudio"
193PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500194
Patrick Williams213cb262021-08-07 19:21:33 -0500195INSANE_SKIP:${PN} = "arch"
Brad Bishopc342db32019-05-15 21:57:59 -0400196
Patrick Williams213cb262021-08-07 19:21:33 -0500197FILES:${PN} += "${datadir}/icons"