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 1278b72798SAndrew Geisslerinherit pkgconfig ptest 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 \ 20d583833aSAndrew Geissler file://0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch \ 21d583833aSAndrew Geissler file://0002-chardev-connect-socket-to-a-spawned-command.patch \ 22d583833aSAndrew Geissler file://0003-apic-fixup-fallthrough-to-PIC.patch \ 23d583833aSAndrew Geissler file://0004-configure-Add-pkg-config-handling-for-libgcrypt.patch \ 24d583833aSAndrew Geissler file://0005-qemu-Do-not-include-file-if-not-exists.patch \ 25d583833aSAndrew Geissler file://0006-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch \ 26d583833aSAndrew Geissler file://0007-qemu-Determinism-fixes.patch \ 27d583833aSAndrew Geissler file://0008-tests-meson.build-use-relative-path-to-refer-to-file.patch \ 28d583833aSAndrew Geissler file://0009-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch \ 29d583833aSAndrew Geissler file://0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch \ 30*87f5cff0SAndrew Geissler file://0001-net-tulip-Restrict-DMA-engine-to-memories.patch \ 31*87f5cff0SAndrew Geissler file://arm-cpreg-fix.patch \ 3219323693SBrad Bishop " 3319323693SBrad BishopUPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" 3419323693SBrad Bishop 35*87f5cff0SAndrew GeisslerSRC_URI[sha256sum] = "a0634e536bded57cf38ec8a751adb124b89c776fe0846f21ab6c6728f1cbbbe6" 36d1e89497SAndrew Geissler 37213cb269SPatrick WilliamsSRC_URI:append:class-target = " file://cross.patch" 38213cb269SPatrick WilliamsSRC_URI:append:class-nativesdk = " file://cross.patch" 3919323693SBrad Bishop 40ac69b488SWilliam A. Kennington III# Applies against virglrender < 0.6.0 and not qemu itself 417e0e3c0cSAndrew GeisslerCVE_CHECK_IGNORE += "CVE-2017-5957" 42ac69b488SWilliam A. Kennington III 43ac69b488SWilliam A. Kennington III# The VNC server can expose host files uder some circumstances. We don't 44ac69b488SWilliam A. Kennington III# enable it by default. 457e0e3c0cSAndrew GeisslerCVE_CHECK_IGNORE += "CVE-2007-0998" 46ac69b488SWilliam A. Kennington III 47ac69b488SWilliam A. Kennington III# 'The issues identified by this CVE were determined to not constitute a vulnerability.' 48ac69b488SWilliam A. Kennington III# https://bugzilla.redhat.com/show_bug.cgi?id=1609015#c11 497e0e3c0cSAndrew GeisslerCVE_CHECK_IGNORE += "CVE-2018-18438" 50ac69b488SWilliam A. Kennington III 51213cb269SPatrick WilliamsCOMPATIBLE_HOST:mipsarchn32 = "null" 52213cb269SPatrick WilliamsCOMPATIBLE_HOST:mipsarchn64 = "null" 53595f6308SAndrew GeisslerCOMPATIBLE_HOST:riscv32 = "null" 5419323693SBrad Bishop 55c9f7865aSAndrew Geissler# Per https://lists.nongnu.org/archive/html/qemu-devel/2020-09/msg03873.html 56c9f7865aSAndrew Geissler# upstream states qemu doesn't work without optimization 57c9f7865aSAndrew GeisslerDEBUG_BUILD = "0" 58c9f7865aSAndrew Geissler 59213cb269SPatrick Williamsdo_install:append() { 6019323693SBrad Bishop # Prevent QA warnings about installed ${localstatedir}/run 6119323693SBrad Bishop if [ -d ${D}${localstatedir}/run ]; then rmdir ${D}${localstatedir}/run; fi 6219323693SBrad Bishop} 6319323693SBrad Bishop 6419323693SBrad Bishopdo_install_ptest() { 6519323693SBrad Bishop cp -rL ${B}/tests ${D}${PTEST_PATH} 66d1e89497SAndrew Geissler find ${D}${PTEST_PATH}/tests -type f -name "*.[Sshcodp]" | xargs -i rm -rf {} 6719323693SBrad Bishop 6819323693SBrad Bishop # Don't check the file genreated by configure 69635e0e46SAndrew Geissler sed -i -e "1s,#!/usr/bin/bash,#!${base_bindir}/bash," ${D}${PTEST_PATH}/tests/data/acpi/disassemle-aml.sh 7090fd73cbSAndrew Geissler 7190fd73cbSAndrew Geissler # Strip the paths from the QEMU variable, we can use PATH 7290fd73cbSAndrew Geissler sed -i -e "s#^QEMU=.*/qemu-#QEMU=qemu-#g" ${D}${PTEST_PATH}/tests/tcg/*.mak 73eff27476SAndrew Geissler 74eff27476SAndrew Geissler # Strip compiler flags as they break reproducibility 75*87f5cff0SAndrew Geissler sed -i -e "s,^CC=.*,CC=gcc," \ 76*87f5cff0SAndrew Geissler -e "s,^CCAS=.*,CCAS=gcc," \ 77*87f5cff0SAndrew Geissler -e "s,^LD=.*,LD=ld," ${D}${PTEST_PATH}/tests/tcg/*.mak 78*87f5cff0SAndrew Geissler 79*87f5cff0SAndrew Geissler # Update SRC_PATH variable to the right place on target 80*87f5cff0SAndrew Geissler sed -i -e "s#^SRC_PATH=.*#SRC_PATH=${PTEST_PATH}#g" ${D}${PTEST_PATH}/tests/tcg/*.mak 81*87f5cff0SAndrew Geissler 8219323693SBrad Bishop} 8319323693SBrad Bishop 84eb8dc403SDave Cobbley# QEMU_TARGETS is overridable variable 8582c905dcSAndrew GeisslerQEMU_TARGETS ?= "arm aarch64 i386 mips mipsel mips64 mips64el ppc ppc64 ppc64le riscv32 riscv64 sh4 x86_64" 86eb8dc403SDave Cobbley 87eb8dc403SDave CobbleyEXTRA_OECONF = " \ 88eb8dc403SDave Cobbley --prefix=${prefix} \ 89eb8dc403SDave Cobbley --bindir=${bindir} \ 90eb8dc403SDave Cobbley --includedir=${includedir} \ 91eb8dc403SDave Cobbley --libdir=${libdir} \ 92eb8dc403SDave Cobbley --mandir=${mandir} \ 93eb8dc403SDave Cobbley --datadir=${datadir} \ 94eb8dc403SDave Cobbley --docdir=${docdir}/${BPN} \ 95eb8dc403SDave Cobbley --sysconfdir=${sysconfdir} \ 96eb8dc403SDave Cobbley --libexecdir=${libexecdir} \ 97eb8dc403SDave Cobbley --localstatedir=${localstatedir} \ 98d1e89497SAndrew Geissler --with-suffix=${BPN} \ 99eb8dc403SDave Cobbley --disable-strip \ 100eb8dc403SDave Cobbley --disable-werror \ 101eb8dc403SDave Cobbley --extra-cflags='${CFLAGS}' \ 102d25ed324SAndrew Geissler --extra-ldflags='${LDFLAGS}' \ 10382c905dcSAndrew Geissler --with-git=/bin/false \ 104ac69b488SWilliam A. Kennington III --with-git-submodules=ignore \ 105d1e89497SAndrew Geissler --meson=meson \ 1061a4b7ee2SBrad Bishop ${PACKAGECONFIG_CONFARGS} \ 107eb8dc403SDave Cobbley " 108eb8dc403SDave Cobbley 1091a4b7ee2SBrad BishopB = "${WORKDIR}/build" 1101a4b7ee2SBrad Bishop 1110ca19ccfSPatrick Williams#EXTRA_OECONF:append = " --python=${HOSTTOOLS_DIR}/python3" 11296ff1984SBrad Bishop 113213cb269SPatrick Williamsdo_configure:prepend:class-native() { 114eb8dc403SDave Cobbley # Append build host pkg-config paths for native target since the host may provide sdl 115eb8dc403SDave Cobbley BHOST_PKGCONFIG_PATH=$(PATH=/usr/bin:/bin pkg-config --variable pc_path pkg-config || echo "") 116eb8dc403SDave Cobbley if [ ! -z "$BHOST_PKGCONFIG_PATH" ]; then 117eb8dc403SDave Cobbley export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$BHOST_PKGCONFIG_PATH 118eb8dc403SDave Cobbley fi 119eb8dc403SDave Cobbley} 120eb8dc403SDave Cobbley 121eb8dc403SDave Cobbleydo_configure() { 122eb8dc403SDave Cobbley ${S}/configure ${EXTRA_OECONF} 123eb8dc403SDave Cobbley} 12464c979e8SBrad Bishopdo_configure[cleandirs] += "${B}" 125eb8dc403SDave Cobbley 126eb8dc403SDave Cobbleydo_install () { 1271a4b7ee2SBrad Bishop export STRIP="" 1281a4b7ee2SBrad Bishop oe_runmake 'DESTDIR=${D}' install 129eb8dc403SDave Cobbley} 130eb8dc403SDave Cobbley 131eb8dc403SDave Cobbley# The following fragment will create a wrapper for qemu-mips user emulation 132eb8dc403SDave Cobbley# binary in order to work around a segmentation fault issue. Basically, by 133eb8dc403SDave Cobbley# default, the reserved virtual address space for 32-on-64 bit is set to 4GB. 134eb8dc403SDave Cobbley# This will trigger a MMU access fault in the virtual CPU. With this change, 135eb8dc403SDave Cobbley# the qemu-mips works fine. 136eb8dc403SDave Cobbley# IMPORTANT: This piece needs to be removed once the root cause is fixed! 137213cb269SPatrick Williamsdo_install:append() { 138eb8dc403SDave Cobbley if [ -e "${D}/${bindir}/qemu-mips" ]; then 139eb8dc403SDave Cobbley create_wrapper ${D}/${bindir}/qemu-mips \ 140eb8dc403SDave Cobbley QEMU_RESERVED_VA=0x0 141eb8dc403SDave Cobbley fi 142eb8dc403SDave Cobbley} 143eb8dc403SDave Cobbley# END of qemu-mips workaround 144eb8dc403SDave Cobbley 14519323693SBrad Bishop# Disable kvm/virgl/mesa on targets that do not support it 1469aee5003SAndrew GeisslerPACKAGECONFIG:remove:darwin = "kvm virglrenderer epoxy gtk+" 1479aee5003SAndrew GeisslerPACKAGECONFIG:remove:mingw32 = "kvm virglrenderer epoxy gtk+" 148eb8dc403SDave Cobbley 149c342db35SBrad BishopPACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,libsdl2" 150b7d28619SAndrew GeisslerPACKAGECONFIG[virtfs] = "--enable-virtfs --enable-attr --enable-cap-ng,--disable-virtfs,libcap-ng attr," 151eb8dc403SDave CobbleyPACKAGECONFIG[aio] = "--enable-linux-aio,--disable-linux-aio,libaio," 152db4c27eeSPatrick WilliamsPACKAGECONFIG[uring] = "--enable-linux-io-uring,--disable-linux-io-uring,liburing" 15382c905dcSAndrew GeisslerPACKAGECONFIG[xen] = "--enable-xen,--disable-xen,xen-tools,xen-tools-libxenstore xen-tools-libxenctrl xen-tools-libxenguest" 154eb8dc403SDave CobbleyPACKAGECONFIG[vnc-sasl] = "--enable-vnc --enable-vnc-sasl,--disable-vnc-sasl,cyrus-sasl," 155eb8dc403SDave CobbleyPACKAGECONFIG[vnc-jpeg] = "--enable-vnc --enable-vnc-jpeg,--disable-vnc-jpeg,jpeg," 15679641f25SBrad BishopPACKAGECONFIG[libcurl] = "--enable-curl,--disable-curl,curl," 157eb8dc403SDave CobbleyPACKAGECONFIG[nss] = "--enable-smartcard,--disable-smartcard,nss," 158eb8dc403SDave CobbleyPACKAGECONFIG[curses] = "--enable-curses,--disable-curses,ncurses," 159c342db35SBrad BishopPACKAGECONFIG[gtk+] = "--enable-gtk,--disable-gtk,gtk+3 gettext-native" 160c342db35SBrad BishopPACKAGECONFIG[vte] = "--enable-vte,--disable-vte,vte gettext-native" 161eb8dc403SDave CobbleyPACKAGECONFIG[libcap-ng] = "--enable-cap-ng,--disable-cap-ng,libcap-ng," 162c68388fcSBrad BishopPACKAGECONFIG[ssh] = "--enable-libssh,--disable-libssh,libssh," 163eb8dc403SDave CobbleyPACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt," 164eb8dc403SDave CobbleyPACKAGECONFIG[nettle] = "--enable-nettle,--disable-nettle,nettle" 165eb8dc403SDave CobbleyPACKAGECONFIG[libusb] = "--enable-libusb,--disable-libusb,libusb1" 166eb8dc403SDave CobbleyPACKAGECONFIG[fdt] = "--enable-fdt,--disable-fdt,dtc" 167595f6308SAndrew GeisslerPACKAGECONFIG[alsa] = "--audio-drv-list=default,,alsa-lib" 1689aee5003SAndrew GeisslerPACKAGECONFIG[epoxy] = "--enable-opengl,--disable-opengl,libepoxy" 169eb8dc403SDave CobbleyPACKAGECONFIG[lzo] = "--enable-lzo,--disable-lzo,lzo" 170eb8dc403SDave CobbleyPACKAGECONFIG[numa] = "--enable-numa,--disable-numa,numactl" 171eb8dc403SDave CobbleyPACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls" 172eb8dc403SDave CobbleyPACKAGECONFIG[bzip2] = "--enable-bzip2,--disable-bzip2,bzip2" 173eb8dc403SDave CobbleyPACKAGECONFIG[libiscsi] = "--enable-libiscsi,--disable-libiscsi" 174eb8dc403SDave CobbleyPACKAGECONFIG[kvm] = "--enable-kvm,--disable-kvm" 1751a4b7ee2SBrad BishopPACKAGECONFIG[virglrenderer] = "--enable-virglrenderer,--disable-virglrenderer,virglrenderer" 1761a4b7ee2SBrad Bishop# spice will be in meta-networking layer 1771a4b7ee2SBrad BishopPACKAGECONFIG[spice] = "--enable-spice,--disable-spice,spice" 1781a4b7ee2SBrad Bishop# usbredir will be in meta-networking layer 1791a4b7ee2SBrad BishopPACKAGECONFIG[usb-redir] = "--enable-usb-redir,--disable-usb-redir,usbredir" 180c342db35SBrad BishopPACKAGECONFIG[snappy] = "--enable-snappy,--disable-snappy,snappy" 181d25ed324SAndrew GeisslerPACKAGECONFIG[glusterfs] = "--enable-glusterfs,--disable-glusterfs,glusterfs" 18282c905dcSAndrew GeisslerPACKAGECONFIG[xkbcommon] = "--enable-xkbcommon,--disable-xkbcommon,libxkbcommon" 18382c905dcSAndrew GeisslerPACKAGECONFIG[libudev] = "--enable-libudev,--disable-libudev,eudev" 184d25ed324SAndrew GeisslerPACKAGECONFIG[attr] = "--enable-attr,--disable-attr,attr," 185d25ed324SAndrew GeisslerPACKAGECONFIG[rbd] = "--enable-rbd,--disable-rbd,ceph,ceph" 186d25ed324SAndrew GeisslerPACKAGECONFIG[vhost] = "--enable-vhost-net,--disable-vhost-net,," 187d25ed324SAndrew GeisslerPACKAGECONFIG[ust] = "--enable-trace-backend=ust,--enable-trace-backend=nop,lttng-ust," 188d25ed324SAndrew GeisslerPACKAGECONFIG[pie] = "--enable-pie,--disable-pie,," 189d1e89497SAndrew GeisslerPACKAGECONFIG[seccomp] = "--enable-seccomp,--disable-seccomp,libseccomp" 190eff27476SAndrew Geissler# libnfs is currently provided by meta-kodi 191eff27476SAndrew GeisslerPACKAGECONFIG[libnfs] = "--enable-libnfs,--disable-libnfs,libnfs" 192eff27476SAndrew GeisslerPACKAGECONFIG[pmem] = "--enable-libpmem,--disable-libpmem,pmdk" 193595f6308SAndrew GeisslerPACKAGECONFIG[pulsedio] = "--enable-pa,--disable-pa,pulseaudio" 194595f6308SAndrew GeisslerPACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux" 195d583833aSAndrew GeisslerPACKAGECONFIG[bpf] = "--enable-bpf,--disable-bpf,libbpf" 196615f2f11SAndrew GeisslerPACKAGECONFIG[capstone] = "--enable-capstone,--disable-capstone" 197615f2f11SAndrew GeisslerPACKAGECONFIG[rdma] = "--enable-rdma,--disable-rdma" 198615f2f11SAndrew GeisslerPACKAGECONFIG[vde] = "--enable-vde,--disable-vde" 199615f2f11SAndrew GeisslerPACKAGECONFIG[slirp] = "--enable-slirp=internal,--disable-slirp" 200615f2f11SAndrew GeisslerPACKAGECONFIG[brlapi] = "--enable-brlapi,--disable-brlapi" 201eb8dc403SDave Cobbley 202213cb269SPatrick WilliamsINSANE_SKIP:${PN} = "arch" 203c342db35SBrad Bishop 204213cb269SPatrick WilliamsFILES:${PN} += "${datadir}/icons" 205