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