blob: 6c0edcb706fb165c0fa4403659f8b2de9becd881 [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 \
Andrew Geissler82c905d2020-04-13 13:39:40 -050030 file://0001-Add-enable-disable-udev.patch \
Andrew Geisslerc9f78652020-09-18 14:11:35 -050031 file://0001-qemu-Do-not-include-file-if-not-exists.patch \
32 file://find_datadir.patch \
33 file://usb-fix-setup_len-init.patch \
Andrew Geisslerf0343792020-11-18 10:42:21 -060034 file://0001-mips-add-34Kf-64tlb-fictitious-cpu-type-like-34Kf-bu.patch \
Andrew Geisslerc9f78652020-09-18 14:11:35 -050035 "
Brad Bishop19323692019-04-05 15:28:33 -040036UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
37
Andrew Geissler635e0e42020-08-21 15:58:33 -050038SRC_URI[sha256sum] = "c9174eb5933d9eb5e61f541cd6d1184cd3118dfe4c5c4955bc1bdc4d390fa4e5"
Brad Bishop19323692019-04-05 15:28:33 -040039
40COMPATIBLE_HOST_mipsarchn32 = "null"
41COMPATIBLE_HOST_mipsarchn64 = "null"
42
Andrew Geisslerc9f78652020-09-18 14:11:35 -050043# Per https://lists.nongnu.org/archive/html/qemu-devel/2020-09/msg03873.html
44# upstream states qemu doesn't work without optimization
45DEBUG_BUILD = "0"
46
Brad Bishop19323692019-04-05 15:28:33 -040047do_install_append() {
48 # Prevent QA warnings about installed ${localstatedir}/run
49 if [ -d ${D}${localstatedir}/run ]; then rmdir ${D}${localstatedir}/run; fi
50}
51
52do_compile_ptest() {
53 make buildtest-TESTS
54}
55
56do_install_ptest() {
57 cp -rL ${B}/tests ${D}${PTEST_PATH}
58 find ${D}${PTEST_PATH}/tests -type f -name "*.[Sshcod]" | xargs -i rm -rf {}
59
60 cp ${S}/tests/Makefile.include ${D}${PTEST_PATH}/tests
61 # Don't check the file genreated by configure
62 sed -i -e '/wildcard config-host.mak/d' \
63 -e '$ {/endif/d}' ${D}${PTEST_PATH}/tests/Makefile.include
Andrew Geissler82c905d2020-04-13 13:39:40 -050064 sed -i -e 's,${HOSTTOOLS_DIR}/python3,${bindir}/python3,' \
65 ${D}/${PTEST_PATH}/tests/qemu-iotests/common.env
Andrew Geissler635e0e42020-08-21 15:58:33 -050066 sed -i -e "1s,#!/usr/bin/bash,#!${base_bindir}/bash," ${D}${PTEST_PATH}/tests/data/acpi/disassemle-aml.sh
Brad Bishop19323692019-04-05 15:28:33 -040067}
68
Patrick Williamsc124f4f2015-09-15 14:41:29 -050069# QEMU_TARGETS is overridable variable
Andrew Geissler82c905d2020-04-13 13:39:40 -050070QEMU_TARGETS ?= "arm aarch64 i386 mips mipsel mips64 mips64el ppc ppc64 ppc64le riscv32 riscv64 sh4 x86_64"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050071
Brad Bishop6e60e8b2018-02-01 10:27:11 -050072EXTRA_OECONF = " \
73 --prefix=${prefix} \
74 --bindir=${bindir} \
75 --includedir=${includedir} \
76 --libdir=${libdir} \
77 --mandir=${mandir} \
78 --datadir=${datadir} \
79 --docdir=${docdir}/${BPN} \
80 --sysconfdir=${sysconfdir} \
81 --libexecdir=${libexecdir} \
82 --localstatedir=${localstatedir} \
83 --with-confsuffix=/${BPN} \
84 --disable-strip \
85 --disable-werror \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050086 --extra-cflags='${CFLAGS}' \
Andrew Geisslerd25ed322020-06-27 00:28:28 -050087 --extra-ldflags='${LDFLAGS}' \
Andrew Geissler82c905d2020-04-13 13:39:40 -050088 --with-git=/bin/false \
89 --disable-git-update \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080090 ${PACKAGECONFIG_CONFARGS} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050091 "
Patrick Williamsc0f7c042017-02-23 20:41:17 -060092
Patrick Williamsc124f4f2015-09-15 14:41:29 -050093export LIBTOOL="${HOST_SYS}-libtool"
94
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080095B = "${WORKDIR}/build"
96
Brad Bishop96ff1982019-08-19 13:50:42 -040097EXTRA_OECONF_append = " --python=${HOSTTOOLS_DIR}/python3"
98
Patrick Williamsc124f4f2015-09-15 14:41:29 -050099do_configure_prepend_class-native() {
100 # Append build host pkg-config paths for native target since the host may provide sdl
101 BHOST_PKGCONFIG_PATH=$(PATH=/usr/bin:/bin pkg-config --variable pc_path pkg-config || echo "")
102 if [ ! -z "$BHOST_PKGCONFIG_PATH" ]; then
103 export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$BHOST_PKGCONFIG_PATH
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500104 fi
105}
106
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500107do_configure() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500108 ${S}/configure ${EXTRA_OECONF}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500109}
Brad Bishop64c979e2019-11-04 13:55:29 -0500110do_configure[cleandirs] += "${B}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500111
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500112do_install () {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800113 export STRIP=""
114 oe_runmake 'DESTDIR=${D}' install
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500115}
116
117# The following fragment will create a wrapper for qemu-mips user emulation
118# binary in order to work around a segmentation fault issue. Basically, by
119# default, the reserved virtual address space for 32-on-64 bit is set to 4GB.
120# This will trigger a MMU access fault in the virtual CPU. With this change,
121# the qemu-mips works fine.
122# IMPORTANT: This piece needs to be removed once the root cause is fixed!
123do_install_append() {
124 if [ -e "${D}/${bindir}/qemu-mips" ]; then
125 create_wrapper ${D}/${bindir}/qemu-mips \
126 QEMU_RESERVED_VA=0x0
127 fi
128}
129# END of qemu-mips workaround
130
Brad Bishop19323692019-04-05 15:28:33 -0400131make_qemu_wrapper() {
132 gdk_pixbuf_module_file=`pkg-config --variable=gdk_pixbuf_cache_file gdk-pixbuf-2.0`
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500133
Brad Bishop19323692019-04-05 15:28:33 -0400134 for tool in `ls ${D}${bindir}/qemu-system-*`; do
135 create_wrapper $tool \
136 GDK_PIXBUF_MODULE_FILE=$gdk_pixbuf_module_file \
137 FONTCONFIG_PATH=/etc/fonts \
138 GTK_THEME=Adwaita
139 done
140}
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500141
Brad Bishop19323692019-04-05 15:28:33 -0400142# Disable kvm/virgl/mesa on targets that do not support it
143PACKAGECONFIG_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"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500165PACKAGECONFIG[alsa] = "--audio-drv-list='oss alsa',,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,,"
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"