blob: 601fc2286b32289b511c2a71d6fc36e60757f32f [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
9RDEPENDS_${PN}-ptest = "bash make"
10
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 \
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 \
Brad Bishopc68388fc2019-08-26 01:33:31 -040024 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 \
Brad Bishop79641f22019-09-10 07:20:22 -040029 file://0010-configure-Add-pkg-config-handling-for-libgcrypt.patch \
Brad Bishopa34c0302019-09-23 22:34:48 -040030 file://CVE-2019-15890.patch \
Brad Bishop64c979e2019-11-04 13:55:29 -050031 file://CVE-2019-12068.patch \
Brad Bishop19323692019-04-05 15:28:33 -040032 "
33UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
34
Brad Bishopc68388fc2019-08-26 01:33:31 -040035SRC_URI[md5sum] = "cdf2b5ca52b9abac9bacb5842fa420f8"
36SRC_URI[sha256sum] = "656e60218689bdeec69903087fd7582d5d3e72238d02f4481d8dc6d79fd909c6"
Brad Bishop19323692019-04-05 15:28:33 -040037
38COMPATIBLE_HOST_mipsarchn32 = "null"
39COMPATIBLE_HOST_mipsarchn64 = "null"
40
41do_install_append() {
42 # Prevent QA warnings about installed ${localstatedir}/run
43 if [ -d ${D}${localstatedir}/run ]; then rmdir ${D}${localstatedir}/run; fi
44}
45
46do_compile_ptest() {
47 make buildtest-TESTS
48}
49
50do_install_ptest() {
51 cp -rL ${B}/tests ${D}${PTEST_PATH}
52 find ${D}${PTEST_PATH}/tests -type f -name "*.[Sshcod]" | xargs -i rm -rf {}
53
54 cp ${S}/tests/Makefile.include ${D}${PTEST_PATH}/tests
55 # Don't check the file genreated by configure
56 sed -i -e '/wildcard config-host.mak/d' \
57 -e '$ {/endif/d}' ${D}${PTEST_PATH}/tests/Makefile.include
58}
59
Patrick Williamsc124f4f2015-09-15 14:41:29 -050060# QEMU_TARGETS is overridable variable
Brad Bishopf3f93bb2019-10-16 14:33:32 -040061QEMU_TARGETS ?= "arm aarch64 i386 mips mipsel mips64 mips64el ppc ppc64 riscv32 riscv64 sh4 x86_64"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050062
Brad Bishop6e60e8b2018-02-01 10:27:11 -050063EXTRA_OECONF = " \
64 --prefix=${prefix} \
65 --bindir=${bindir} \
66 --includedir=${includedir} \
67 --libdir=${libdir} \
68 --mandir=${mandir} \
69 --datadir=${datadir} \
70 --docdir=${docdir}/${BPN} \
71 --sysconfdir=${sysconfdir} \
72 --libexecdir=${libexecdir} \
73 --localstatedir=${localstatedir} \
74 --with-confsuffix=/${BPN} \
75 --disable-strip \
76 --disable-werror \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050077 --extra-cflags='${CFLAGS}' \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080078 ${PACKAGECONFIG_CONFARGS} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050079 "
Patrick Williamsc0f7c042017-02-23 20:41:17 -060080
Patrick Williamsc124f4f2015-09-15 14:41:29 -050081export LIBTOOL="${HOST_SYS}-libtool"
82
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080083B = "${WORKDIR}/build"
84
Brad Bishop96ff1982019-08-19 13:50:42 -040085EXTRA_OECONF_append = " --python=${HOSTTOOLS_DIR}/python3"
86
Patrick Williamsc124f4f2015-09-15 14:41:29 -050087do_configure_prepend_class-native() {
88 # Append build host pkg-config paths for native target since the host may provide sdl
89 BHOST_PKGCONFIG_PATH=$(PATH=/usr/bin:/bin pkg-config --variable pc_path pkg-config || echo "")
90 if [ ! -z "$BHOST_PKGCONFIG_PATH" ]; then
91 export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$BHOST_PKGCONFIG_PATH
Patrick Williamsc124f4f2015-09-15 14:41:29 -050092 fi
93}
94
Patrick Williamsc124f4f2015-09-15 14:41:29 -050095do_configure() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050096 ${S}/configure ${EXTRA_OECONF}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050097}
Brad Bishop64c979e2019-11-04 13:55:29 -050098do_configure[cleandirs] += "${B}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050099
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500100do_install () {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800101 export STRIP=""
102 oe_runmake 'DESTDIR=${D}' install
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500103}
104
105# The following fragment will create a wrapper for qemu-mips user emulation
106# binary in order to work around a segmentation fault issue. Basically, by
107# default, the reserved virtual address space for 32-on-64 bit is set to 4GB.
108# This will trigger a MMU access fault in the virtual CPU. With this change,
109# the qemu-mips works fine.
110# IMPORTANT: This piece needs to be removed once the root cause is fixed!
111do_install_append() {
112 if [ -e "${D}/${bindir}/qemu-mips" ]; then
113 create_wrapper ${D}/${bindir}/qemu-mips \
114 QEMU_RESERVED_VA=0x0
115 fi
116}
117# END of qemu-mips workaround
118
Brad Bishop19323692019-04-05 15:28:33 -0400119make_qemu_wrapper() {
120 gdk_pixbuf_module_file=`pkg-config --variable=gdk_pixbuf_cache_file gdk-pixbuf-2.0`
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500121
Brad Bishop19323692019-04-05 15:28:33 -0400122 for tool in `ls ${D}${bindir}/qemu-system-*`; do
123 create_wrapper $tool \
124 GDK_PIXBUF_MODULE_FILE=$gdk_pixbuf_module_file \
125 FONTCONFIG_PATH=/etc/fonts \
126 GTK_THEME=Adwaita
127 done
128}
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500129
Brad Bishop19323692019-04-05 15:28:33 -0400130# Disable kvm/virgl/mesa on targets that do not support it
131PACKAGECONFIG_remove_darwin = "kvm virglrenderer glx gtk+"
132PACKAGECONFIG_remove_mingw32 = "kvm virglrenderer glx gtk+"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600133
Brad Bishopc342db32019-05-15 21:57:59 -0400134PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,libsdl2"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500135PACKAGECONFIG[virtfs] = "--enable-virtfs --enable-attr,--disable-virtfs,libcap attr,"
136PACKAGECONFIG[aio] = "--enable-linux-aio,--disable-linux-aio,libaio,"
137PACKAGECONFIG[xfs] = "--enable-xfsctl,--disable-xfsctl,xfsprogs,"
138PACKAGECONFIG[xen] = "--enable-xen,--disable-xen,xen,xen-libxenstore xen-libxenctrl xen-libxenguest"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500139PACKAGECONFIG[vnc-sasl] = "--enable-vnc --enable-vnc-sasl,--disable-vnc-sasl,cyrus-sasl,"
140PACKAGECONFIG[vnc-jpeg] = "--enable-vnc --enable-vnc-jpeg,--disable-vnc-jpeg,jpeg,"
141PACKAGECONFIG[vnc-png] = "--enable-vnc --enable-vnc-png,--disable-vnc-png,libpng,"
Brad Bishop79641f22019-09-10 07:20:22 -0400142PACKAGECONFIG[libcurl] = "--enable-curl,--disable-curl,curl,"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500143PACKAGECONFIG[nss] = "--enable-smartcard,--disable-smartcard,nss,"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500144PACKAGECONFIG[curses] = "--enable-curses,--disable-curses,ncurses,"
Brad Bishopc342db32019-05-15 21:57:59 -0400145PACKAGECONFIG[gtk+] = "--enable-gtk,--disable-gtk,gtk+3 gettext-native"
146PACKAGECONFIG[vte] = "--enable-vte,--disable-vte,vte gettext-native"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500147PACKAGECONFIG[libcap-ng] = "--enable-cap-ng,--disable-cap-ng,libcap-ng,"
Brad Bishopc68388fc2019-08-26 01:33:31 -0400148PACKAGECONFIG[ssh] = "--enable-libssh,--disable-libssh,libssh,"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500149PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt,"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500150PACKAGECONFIG[nettle] = "--enable-nettle,--disable-nettle,nettle"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500151PACKAGECONFIG[libusb] = "--enable-libusb,--disable-libusb,libusb1"
152PACKAGECONFIG[fdt] = "--enable-fdt,--disable-fdt,dtc"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500153PACKAGECONFIG[alsa] = "--audio-drv-list='oss alsa',,alsa-lib"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500154PACKAGECONFIG[glx] = "--enable-opengl,--disable-opengl,mesa"
155PACKAGECONFIG[lzo] = "--enable-lzo,--disable-lzo,lzo"
156PACKAGECONFIG[numa] = "--enable-numa,--disable-numa,numactl"
157PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600158PACKAGECONFIG[bzip2] = "--enable-bzip2,--disable-bzip2,bzip2"
Brad Bishop96ff1982019-08-19 13:50:42 -0400159PACKAGECONFIG[bluez] = "--enable-bluez,--disable-bluez,bluez5"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500160PACKAGECONFIG[libiscsi] = "--enable-libiscsi,--disable-libiscsi"
161PACKAGECONFIG[kvm] = "--enable-kvm,--disable-kvm"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800162PACKAGECONFIG[virglrenderer] = "--enable-virglrenderer,--disable-virglrenderer,virglrenderer"
163# spice will be in meta-networking layer
164PACKAGECONFIG[spice] = "--enable-spice,--disable-spice,spice"
165# usbredir will be in meta-networking layer
166PACKAGECONFIG[usb-redir] = "--enable-usb-redir,--disable-usb-redir,usbredir"
Brad Bishopc342db32019-05-15 21:57:59 -0400167PACKAGECONFIG[snappy] = "--enable-snappy,--disable-snappy,snappy"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500168
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500169INSANE_SKIP_${PN} = "arch"
Brad Bishopc342db32019-05-15 21:57:59 -0400170
171FILES_${PN} += "${datadir}/icons"