1eb8dc403SDave CobbleySUMMARY = "Fast open source processor emulator" 2f3f93bb8SBrad BishopDESCRIPTION = "QEMU is a hosted virtual machine monitor: it emulates the \ 3f3f93bb8SBrad Bishopmachine's processor through dynamic binary translation and provides a set \ 4f3f93bb8SBrad Bishopof different hardware and device models for the machine, enabling it to run \ 5f3f93bb8SBrad Bishopa variety of guest operating systems" 6eb8dc403SDave CobbleyHOMEPAGE = "http://qemu.org" 77e0e3c0cSAndrew GeisslerLICENSE = "GPL-2.0-only & LGPL-2.1-only" 819323693SBrad Bishop 9213cb269SPatrick WilliamsRDEPENDS:${PN}-ptest = "bash" 1019323693SBrad Bishop 1115ae2509SBrad Bishoprequire qemu-targets.inc 12eff27476SAndrew Geisslerinherit pkgconfig ptest python3-dir 1315ae2509SBrad Bishop 1419323693SBrad BishopLIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \ 15c342db35SBrad Bishop file://COPYING.LIB;endline=24;md5=8c5efda6cf1e1b03dcfd0e6c0d271c7f" 1619323693SBrad Bishop 1719323693SBrad BishopSRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \ 1819323693SBrad Bishop file://powerpc_rom.bin \ 1919323693SBrad Bishop file://run-ptest \ 20c342db35SBrad Bishop file://0001-qemu-Add-missing-wacom-HID-descriptor.patch \ 21c342db35SBrad Bishop file://0003-qemu-Add-addition-environment-space-to-boot-loader-q.patch \ 22c68388fcSBrad Bishop file://0006-chardev-connect-socket-to-a-spawned-command.patch \ 23c68388fcSBrad Bishop file://0007-apic-fixup-fallthrough-to-PIC.patch \ 2479641f25SBrad Bishop file://0010-configure-Add-pkg-config-handling-for-libgcrypt.patch \ 2582c905dcSAndrew Geissler file://0001-qemu-Do-not-include-file-if-not-exists.patch \ 26d1e89497SAndrew Geissler file://mmap2.patch \ 2790fd73cbSAndrew Geissler file://determinism.patch \ 28d1e89497SAndrew Geissler file://0001-tests-meson.build-use-relative-path-to-refer-to-file.patch \ 29595f6308SAndrew Geissler file://0001-riscv-Set-5.4-as-minimum-kernel-version-for-riscv32.patch \ 307e0e3c0cSAndrew Geissler file://0001-acpi-tpm-Add-missing-device-identification-objects.patch \ 31*9aee5003SAndrew Geissler file://0001-ppc-Include-asm-ptrace.h-for-pt_regs-struct-definiti.patch \ 32*9aee5003SAndrew Geissler file://0001-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch \ 33*9aee5003SAndrew Geissler file://0001-vhost-vsock-detach-the-virqueue-element-in-case-of-e.patch \ 34*9aee5003SAndrew Geissler file://0002-virtio-net-fix-map-leaking-on-error-during-receive.patch \ 3519323693SBrad Bishop " 3619323693SBrad BishopUPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" 3719323693SBrad Bishop 38595f6308SAndrew GeisslerSRC_URI[sha256sum] = "68e15d8e45ac56326e0b9a4afa8b49a3dfe8aba3488221d098c84698bca65b45" 39d1e89497SAndrew Geissler 40213cb269SPatrick WilliamsSRC_URI:append:class-target = " file://cross.patch" 41213cb269SPatrick WilliamsSRC_URI:append:class-nativesdk = " file://cross.patch" 4219323693SBrad Bishop 43ac69b488SWilliam A. Kennington III# Applies against virglrender < 0.6.0 and not qemu itself 447e0e3c0cSAndrew GeisslerCVE_CHECK_IGNORE += "CVE-2017-5957" 45ac69b488SWilliam A. Kennington III 46ac69b488SWilliam A. Kennington III# The VNC server can expose host files uder some circumstances. We don't 47ac69b488SWilliam A. Kennington III# enable it by default. 487e0e3c0cSAndrew GeisslerCVE_CHECK_IGNORE += "CVE-2007-0998" 49ac69b488SWilliam A. Kennington III 50ac69b488SWilliam A. Kennington III# 'The issues identified by this CVE were determined to not constitute a vulnerability.' 51ac69b488SWilliam A. Kennington III# https://bugzilla.redhat.com/show_bug.cgi?id=1609015#c11 527e0e3c0cSAndrew GeisslerCVE_CHECK_IGNORE += "CVE-2018-18438" 53ac69b488SWilliam A. Kennington III 54213cb269SPatrick WilliamsCOMPATIBLE_HOST:mipsarchn32 = "null" 55213cb269SPatrick WilliamsCOMPATIBLE_HOST:mipsarchn64 = "null" 56595f6308SAndrew GeisslerCOMPATIBLE_HOST:riscv32 = "null" 5719323693SBrad Bishop 58c9f7865aSAndrew Geissler# Per https://lists.nongnu.org/archive/html/qemu-devel/2020-09/msg03873.html 59c9f7865aSAndrew Geissler# upstream states qemu doesn't work without optimization 60c9f7865aSAndrew GeisslerDEBUG_BUILD = "0" 61c9f7865aSAndrew Geissler 62213cb269SPatrick Williamsdo_install:append() { 6319323693SBrad Bishop # Prevent QA warnings about installed ${localstatedir}/run 6419323693SBrad Bishop if [ -d ${D}${localstatedir}/run ]; then rmdir ${D}${localstatedir}/run; fi 6519323693SBrad Bishop} 6619323693SBrad Bishop 6719323693SBrad Bishopdo_install_ptest() { 6819323693SBrad Bishop cp -rL ${B}/tests ${D}${PTEST_PATH} 69d1e89497SAndrew Geissler find ${D}${PTEST_PATH}/tests -type f -name "*.[Sshcodp]" | xargs -i rm -rf {} 7019323693SBrad Bishop 7119323693SBrad Bishop # Don't check the file genreated by configure 72635e0e46SAndrew Geissler sed -i -e "1s,#!/usr/bin/bash,#!${base_bindir}/bash," ${D}${PTEST_PATH}/tests/data/acpi/disassemle-aml.sh 7390fd73cbSAndrew Geissler 7490fd73cbSAndrew Geissler # Strip the paths from the QEMU variable, we can use PATH 7590fd73cbSAndrew Geissler sed -i -e "s#^QEMU=.*/qemu-#QEMU=qemu-#g" ${D}${PTEST_PATH}/tests/tcg/*.mak 76eff27476SAndrew Geissler 77eff27476SAndrew Geissler # Strip compiler flags as they break reproducibility 78eff27476SAndrew Geissler sed -i -e "s,CROSS_CC_GUEST=.*,CROSS_CC_GUEST=," ${D}${PTEST_PATH}/tests/tcg/*.mak 7919323693SBrad Bishop} 8019323693SBrad Bishop 81eb8dc403SDave Cobbley# QEMU_TARGETS is overridable variable 8282c905dcSAndrew GeisslerQEMU_TARGETS ?= "arm aarch64 i386 mips mipsel mips64 mips64el ppc ppc64 ppc64le riscv32 riscv64 sh4 x86_64" 83eb8dc403SDave Cobbley 84eb8dc403SDave CobbleyEXTRA_OECONF = " \ 85eb8dc403SDave Cobbley --prefix=${prefix} \ 86eb8dc403SDave Cobbley --bindir=${bindir} \ 87eb8dc403SDave Cobbley --includedir=${includedir} \ 88eb8dc403SDave Cobbley --libdir=${libdir} \ 89eb8dc403SDave Cobbley --mandir=${mandir} \ 90eb8dc403SDave Cobbley --datadir=${datadir} \ 91eb8dc403SDave Cobbley --docdir=${docdir}/${BPN} \ 92eb8dc403SDave Cobbley --sysconfdir=${sysconfdir} \ 93eb8dc403SDave Cobbley --libexecdir=${libexecdir} \ 94eb8dc403SDave Cobbley --localstatedir=${localstatedir} \ 95d1e89497SAndrew Geissler --with-suffix=${BPN} \ 96eb8dc403SDave Cobbley --disable-strip \ 97eb8dc403SDave Cobbley --disable-werror \ 98eb8dc403SDave Cobbley --extra-cflags='${CFLAGS}' \ 99d25ed324SAndrew Geissler --extra-ldflags='${LDFLAGS}' \ 10082c905dcSAndrew Geissler --with-git=/bin/false \ 101ac69b488SWilliam A. Kennington III --with-git-submodules=ignore \ 102d1e89497SAndrew Geissler --meson=meson \ 1031a4b7ee2SBrad Bishop ${PACKAGECONFIG_CONFARGS} \ 104eb8dc403SDave Cobbley " 105eb8dc403SDave Cobbley 1061a4b7ee2SBrad BishopB = "${WORKDIR}/build" 1071a4b7ee2SBrad Bishop 1080ca19ccfSPatrick Williams#EXTRA_OECONF:append = " --python=${HOSTTOOLS_DIR}/python3" 10996ff1984SBrad Bishop 110213cb269SPatrick Williamsdo_configure:prepend:class-native() { 111eb8dc403SDave Cobbley # Append build host pkg-config paths for native target since the host may provide sdl 112eb8dc403SDave Cobbley BHOST_PKGCONFIG_PATH=$(PATH=/usr/bin:/bin pkg-config --variable pc_path pkg-config || echo "") 113eb8dc403SDave Cobbley if [ ! -z "$BHOST_PKGCONFIG_PATH" ]; then 114eb8dc403SDave Cobbley export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$BHOST_PKGCONFIG_PATH 115eb8dc403SDave Cobbley fi 116eb8dc403SDave Cobbley} 117eb8dc403SDave Cobbley 118eb8dc403SDave Cobbleydo_configure() { 119eff27476SAndrew Geissler # This is taken from meson.bbclass to avoid errors when updating to a 120eff27476SAndrew Geissler # new version of meson. 121eff27476SAndrew Geissler rmdir ${STAGING_LIBDIR_NATIVE}/${PYTHON_DIR}/site-packages/*.egg-info 2>/dev/null || : 122eff27476SAndrew Geissler 123eb8dc403SDave Cobbley ${S}/configure ${EXTRA_OECONF} 124eb8dc403SDave Cobbley} 12564c979e8SBrad Bishopdo_configure[cleandirs] += "${B}" 126eb8dc403SDave Cobbley 127eb8dc403SDave Cobbleydo_install () { 1281a4b7ee2SBrad Bishop export STRIP="" 1291a4b7ee2SBrad Bishop oe_runmake 'DESTDIR=${D}' install 130eb8dc403SDave Cobbley} 131eb8dc403SDave Cobbley 132eb8dc403SDave Cobbley# The following fragment will create a wrapper for qemu-mips user emulation 133eb8dc403SDave Cobbley# binary in order to work around a segmentation fault issue. Basically, by 134eb8dc403SDave Cobbley# default, the reserved virtual address space for 32-on-64 bit is set to 4GB. 135eb8dc403SDave Cobbley# This will trigger a MMU access fault in the virtual CPU. With this change, 136eb8dc403SDave Cobbley# the qemu-mips works fine. 137eb8dc403SDave Cobbley# IMPORTANT: This piece needs to be removed once the root cause is fixed! 138213cb269SPatrick Williamsdo_install:append() { 139eb8dc403SDave Cobbley if [ -e "${D}/${bindir}/qemu-mips" ]; then 140eb8dc403SDave Cobbley create_wrapper ${D}/${bindir}/qemu-mips \ 141eb8dc403SDave Cobbley QEMU_RESERVED_VA=0x0 142eb8dc403SDave Cobbley fi 143eb8dc403SDave Cobbley} 144eb8dc403SDave Cobbley# END of qemu-mips workaround 145eb8dc403SDave Cobbley 14619323693SBrad Bishop# Disable kvm/virgl/mesa on targets that do not support it 147*9aee5003SAndrew GeisslerPACKAGECONFIG:remove:darwin = "kvm virglrenderer epoxy gtk+" 148*9aee5003SAndrew GeisslerPACKAGECONFIG:remove:mingw32 = "kvm virglrenderer epoxy gtk+" 149eb8dc403SDave Cobbley 150c342db35SBrad BishopPACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,libsdl2" 151b7d28619SAndrew GeisslerPACKAGECONFIG[virtfs] = "--enable-virtfs --enable-attr --enable-cap-ng,--disable-virtfs,libcap-ng attr," 152eb8dc403SDave CobbleyPACKAGECONFIG[aio] = "--enable-linux-aio,--disable-linux-aio,libaio," 153eb8dc403SDave CobbleyPACKAGECONFIG[xfs] = "--enable-xfsctl,--disable-xfsctl,xfsprogs," 15482c905dcSAndrew GeisslerPACKAGECONFIG[xen] = "--enable-xen,--disable-xen,xen-tools,xen-tools-libxenstore xen-tools-libxenctrl xen-tools-libxenguest" 155eb8dc403SDave CobbleyPACKAGECONFIG[vnc-sasl] = "--enable-vnc --enable-vnc-sasl,--disable-vnc-sasl,cyrus-sasl," 156eb8dc403SDave CobbleyPACKAGECONFIG[vnc-jpeg] = "--enable-vnc --enable-vnc-jpeg,--disable-vnc-jpeg,jpeg," 157eb8dc403SDave CobbleyPACKAGECONFIG[vnc-png] = "--enable-vnc --enable-vnc-png,--disable-vnc-png,libpng," 15879641f25SBrad BishopPACKAGECONFIG[libcurl] = "--enable-curl,--disable-curl,curl," 159eb8dc403SDave CobbleyPACKAGECONFIG[nss] = "--enable-smartcard,--disable-smartcard,nss," 160eb8dc403SDave CobbleyPACKAGECONFIG[curses] = "--enable-curses,--disable-curses,ncurses," 161c342db35SBrad BishopPACKAGECONFIG[gtk+] = "--enable-gtk,--disable-gtk,gtk+3 gettext-native" 162c342db35SBrad BishopPACKAGECONFIG[vte] = "--enable-vte,--disable-vte,vte gettext-native" 163eb8dc403SDave CobbleyPACKAGECONFIG[libcap-ng] = "--enable-cap-ng,--disable-cap-ng,libcap-ng," 164c68388fcSBrad BishopPACKAGECONFIG[ssh] = "--enable-libssh,--disable-libssh,libssh," 165eb8dc403SDave CobbleyPACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt," 166eb8dc403SDave CobbleyPACKAGECONFIG[nettle] = "--enable-nettle,--disable-nettle,nettle" 167eb8dc403SDave CobbleyPACKAGECONFIG[libusb] = "--enable-libusb,--disable-libusb,libusb1" 168eb8dc403SDave CobbleyPACKAGECONFIG[fdt] = "--enable-fdt,--disable-fdt,dtc" 169595f6308SAndrew GeisslerPACKAGECONFIG[alsa] = "--audio-drv-list=default,,alsa-lib" 170*9aee5003SAndrew GeisslerPACKAGECONFIG[epoxy] = "--enable-opengl,--disable-opengl,libepoxy" 171eb8dc403SDave CobbleyPACKAGECONFIG[lzo] = "--enable-lzo,--disable-lzo,lzo" 172eb8dc403SDave CobbleyPACKAGECONFIG[numa] = "--enable-numa,--disable-numa,numactl" 173eb8dc403SDave CobbleyPACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls" 174eb8dc403SDave CobbleyPACKAGECONFIG[bzip2] = "--enable-bzip2,--disable-bzip2,bzip2" 175eb8dc403SDave CobbleyPACKAGECONFIG[libiscsi] = "--enable-libiscsi,--disable-libiscsi" 176eb8dc403SDave CobbleyPACKAGECONFIG[kvm] = "--enable-kvm,--disable-kvm" 1771a4b7ee2SBrad BishopPACKAGECONFIG[virglrenderer] = "--enable-virglrenderer,--disable-virglrenderer,virglrenderer" 1781a4b7ee2SBrad Bishop# spice will be in meta-networking layer 1791a4b7ee2SBrad BishopPACKAGECONFIG[spice] = "--enable-spice,--disable-spice,spice" 1801a4b7ee2SBrad Bishop# usbredir will be in meta-networking layer 1811a4b7ee2SBrad BishopPACKAGECONFIG[usb-redir] = "--enable-usb-redir,--disable-usb-redir,usbredir" 182c342db35SBrad BishopPACKAGECONFIG[snappy] = "--enable-snappy,--disable-snappy,snappy" 183d25ed324SAndrew GeisslerPACKAGECONFIG[glusterfs] = "--enable-glusterfs,--disable-glusterfs,glusterfs" 18482c905dcSAndrew GeisslerPACKAGECONFIG[xkbcommon] = "--enable-xkbcommon,--disable-xkbcommon,libxkbcommon" 18582c905dcSAndrew GeisslerPACKAGECONFIG[libudev] = "--enable-libudev,--disable-libudev,eudev" 18682c905dcSAndrew GeisslerPACKAGECONFIG[libxml2] = "--enable-libxml2,--disable-libxml2,libxml2" 187d25ed324SAndrew GeisslerPACKAGECONFIG[attr] = "--enable-attr,--disable-attr,attr," 188d25ed324SAndrew GeisslerPACKAGECONFIG[rbd] = "--enable-rbd,--disable-rbd,ceph,ceph" 189d25ed324SAndrew GeisslerPACKAGECONFIG[vhost] = "--enable-vhost-net,--disable-vhost-net,," 190d25ed324SAndrew GeisslerPACKAGECONFIG[ust] = "--enable-trace-backend=ust,--enable-trace-backend=nop,lttng-ust," 191d25ed324SAndrew GeisslerPACKAGECONFIG[pie] = "--enable-pie,--disable-pie,," 192d1e89497SAndrew GeisslerPACKAGECONFIG[seccomp] = "--enable-seccomp,--disable-seccomp,libseccomp" 193eff27476SAndrew Geissler# libnfs is currently provided by meta-kodi 194eff27476SAndrew GeisslerPACKAGECONFIG[libnfs] = "--enable-libnfs,--disable-libnfs,libnfs" 195eff27476SAndrew GeisslerPACKAGECONFIG[pmem] = "--enable-libpmem,--disable-libpmem,pmdk" 196595f6308SAndrew GeisslerPACKAGECONFIG[pulsedio] = "--enable-pa,--disable-pa,pulseaudio" 197595f6308SAndrew GeisslerPACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux" 198eb8dc403SDave Cobbley 199213cb269SPatrick WilliamsINSANE_SKIP:${PN} = "arch" 200c342db35SBrad Bishop 201213cb269SPatrick WilliamsFILES:${PN} += "${datadir}/icons" 202