diff options
Diffstat (limited to 'meta/recipes-devtools/qemu/qemu.inc')
-rw-r--r-- | meta/recipes-devtools/qemu/qemu.inc | 242 |
1 files changed, 157 insertions, 85 deletions
diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc index b865223db5..92828e8f2d 100644 --- a/meta/recipes-devtools/qemu/qemu.inc +++ b/meta/recipes-devtools/qemu/qemu.inc @@ -1,88 +1,135 @@ SUMMARY = "Fast open source processor emulator" +DESCRIPTION = "QEMU is a hosted virtual machine monitor: it emulates the \ +machine's processor through dynamic binary translation and provides a set \ +of different hardware and device models for the machine, enabling it to run \ +a variety of guest operating systems" HOMEPAGE = "http://qemu.org" -LICENSE = "GPLv2 & LGPLv2.1" -DEPENDS = "glib-2.0 zlib pixman" -RDEPENDS_${PN}_class-target += "bash" -RDEPENDS_${PN}-ptest = "bash make" +LICENSE = "GPL-2.0-only & LGPL-2.1-only" + +RDEPENDS:${PN}-ptest = "bash" require qemu-targets.inc -inherit autotools ptest -BBCLASSEXTEND = "native nativesdk" +inherit pkgconfig ptest + +LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \ + file://COPYING.LIB;endline=24;md5=8c5efda6cf1e1b03dcfd0e6c0d271c7f" + +SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \ + file://powerpc_rom.bin \ + file://run-ptest \ + file://0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch \ + file://0002-chardev-connect-socket-to-a-spawned-command.patch \ + file://0003-apic-fixup-fallthrough-to-PIC.patch \ + file://0004-configure-Add-pkg-config-handling-for-libgcrypt.patch \ + file://0005-qemu-Do-not-include-file-if-not-exists.patch \ + file://0006-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch \ + file://0007-qemu-Determinism-fixes.patch \ + file://0008-tests-meson.build-use-relative-path-to-refer-to-file.patch \ + file://0009-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch \ + file://0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch \ + file://0001-contrib-vhost-user-blk-Replace-lseek64-with-lseek.patch \ + file://0002-linux-user-Replace-use-of-lfs64-related-functions-an.patch \ + file://0001-configure-Fix-check-tcg-not-executing-any-tests.patch \ + " +UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" + +SRC_URI[sha256sum] = "5b49ce2687744dad494ae90a898c52204a3406e84d072482a1e1be854eeb2157" + +SRC_URI:append:class-target = " file://cross.patch" +SRC_URI:append:class-nativesdk = " file://cross.patch" + +# Applies against virglrender < 0.6.0 and not qemu itself +CVE_CHECK_IGNORE += "CVE-2017-5957" + +# The VNC server can expose host files uder some circumstances. We don't +# enable it by default. +CVE_CHECK_IGNORE += "CVE-2007-0998" + +# 'The issues identified by this CVE were determined to not constitute a vulnerability.' +# https://bugzilla.redhat.com/show_bug.cgi?id=1609015#c11 +CVE_CHECK_IGNORE += "CVE-2018-18438" + +COMPATIBLE_HOST:mipsarchn32 = "null" +COMPATIBLE_HOST:mipsarchn64 = "null" +COMPATIBLE_HOST:riscv32 = "null" + +# Per https://lists.nongnu.org/archive/html/qemu-devel/2020-09/msg03873.html +# upstream states qemu doesn't work without optimization +DEBUG_BUILD = "0" + +do_install:append() { + # Prevent QA warnings about installed ${localstatedir}/run + if [ -d ${D}${localstatedir}/run ]; then rmdir ${D}${localstatedir}/run; fi +} -PR = "r1" +do_install_ptest() { + cp -rL ${B}/tests ${D}${PTEST_PATH} + find ${D}${PTEST_PATH}/tests -type f -name "*.[Sshcodp]" | xargs -i rm -rf {} -# QEMU_TARGETS is overridable variable -QEMU_TARGETS ?= "arm aarch64 i386 mips mipsel mips64 mips64el ppc sh4 x86_64" - -SRC_URI = "\ - file://powerpc_rom.bin \ - file://disable-grabs.patch \ - file://exclude-some-arm-EABI-obsolete-syscalls.patch \ - file://wacom.patch \ - file://add-ptest-in-makefile.patch \ - file://run-ptest \ - " + # Don't check the file genreated by configure + sed -i -e "1s,#!/usr/bin/bash,#!${base_bindir}/bash," ${D}${PTEST_PATH}/tests/data/acpi/disassemle-aml.sh -SRC_URI_append_class-native = "\ - file://fix-libcap-header-issue-on-some-distro.patch \ - file://cpus.c-qemu_cpu_kick_thread_debugging.patch \ - " + # Strip the paths from the QEMU variable, we can use PATH + makfiles=$(find ${D}${PTEST_PATH} -name "*.mak") + sed -i -e "s#^QEMU=.*/qemu-#QEMU=qemu-#g" $makfiles + + # Strip compiler flags as they break reproducibility + sed -i -e "s,^CC=.*,CC=gcc," \ + -e "s,^CCAS=.*,CCAS=gcc," \ + -e "s,^LD=.*,LD=ld," $makfiles -EXTRA_OECONF += "--target-list=${@get_qemu_target_list(d)} --disable-werror --disable-bluez --disable-libiscsi --with-system-pixman --extra-cflags='${CFLAGS}'" + # Update SRC_PATH variable to the right place on target + sed -i -e "s#^SRC_PATH=.*#SRC_PATH=${PTEST_PATH}#g" $makfiles -EXTRA_OECONF_class-nativesdk = "--target-list=${@get_qemu_target_list(d)} --disable-werror" + # https://gitlab.com/qemu-project/qemu/-/issues/1403 + rm ${D}${PTEST_PATH}/tests/unit/test-io-channel-command +} -EXTRA_OEMAKE_append_class-native = " LD='${LD}' AR='${AR}' OBJCOPY='${OBJCOPY}' LDFLAGS='${LDFLAGS}'" +# QEMU_TARGETS is overridable variable +QEMU_TARGETS ?= "arm aarch64 i386 loongarch64 mips mipsel mips64 mips64el ppc ppc64 ppc64le riscv32 riscv64 sh4 x86_64" + +EXTRA_OECONF = " \ + --prefix=${prefix} \ + --bindir=${bindir} \ + --includedir=${includedir} \ + --libdir=${libdir} \ + --mandir=${mandir} \ + --datadir=${datadir} \ + --docdir=${docdir}/${BPN} \ + --sysconfdir=${sysconfdir} \ + --libexecdir=${libexecdir} \ + --localstatedir=${localstatedir} \ + --with-suffix=${BPN} \ + --disable-strip \ + --disable-werror \ + --extra-cflags='${CFLAGS}' \ + --extra-ldflags='${LDFLAGS}' \ + --with-git=/bin/false \ + --with-git-submodules=ignore \ + --meson=meson \ + ${PACKAGECONFIG_CONFARGS} \ + " -LDFLAGS_append_class-native = " -fuse-ld=bfd" +B = "${WORKDIR}/build" -export LIBTOOL="${HOST_SYS}-libtool" +#EXTRA_OECONF:append = " --python=${HOSTTOOLS_DIR}/python3" -do_configure_prepend_class-native() { +do_configure:prepend:class-native() { # Append build host pkg-config paths for native target since the host may provide sdl BHOST_PKGCONFIG_PATH=$(PATH=/usr/bin:/bin pkg-config --variable pc_path pkg-config || echo "") if [ ! -z "$BHOST_PKGCONFIG_PATH" ]; then export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$BHOST_PKGCONFIG_PATH fi - - # Alter target makefiles to accept CFLAGS set via env - sed -i -r \ - -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \ - "${S}"/Makefile "${S}"/Makefile.target } -KVMENABLE = "--enable-kvm" -KVMENABLE_darwin = "--disable-kvm" -KVMENABLE_mingw32 = "--disable-kvm" - do_configure() { - # Handle distros such as CentOS 5 32-bit that do not have kvm support - KVMOPTS="--disable-kvm" - if [ "${PN}" != "qemu-native" -a "${PN}" != "nativesdk-qemu" ] \ - || [ -f /usr/include/linux/kvm.h ] ; then - KVMOPTS="${KVMENABLE}" - fi - - ${S}/configure --prefix=${prefix} --sysconfdir=${sysconfdir} --libexecdir=${libexecdir} --localstatedir=${localstatedir} --disable-strip ${EXTRA_OECONF} $KVMOPTS - test ! -e ${S}/target-i386/beginend_funcs.sh || chmod a+x ${S}/target-i386/beginend_funcs.sh -} - -do_compile_ptest() { - make buildtest-TESTS -} - -do_install_ptest() { - cp -rL ${B}/tests ${D}${PTEST_PATH} - find ${D}${PTEST_PATH}/tests -type f -name "*.[Sshcod]" | xargs -i rm -rf {} - - cp ${S}/tests/Makefile ${D}${PTEST_PATH}/tests + ${S}/configure ${EXTRA_OECONF} } +do_configure[cleandirs] += "${B}" do_install () { - export STRIP="true" - autotools_do_install - install -d ${D}${datadir}/qemu - install -m 0755 ${WORKDIR}/powerpc_rom.bin ${D}${datadir}/qemu + export STRIP="" + oe_runmake 'DESTDIR=${D}' install } # The following fragment will create a wrapper for qemu-mips user emulation @@ -91,7 +138,7 @@ do_install () { # This will trigger a MMU access fault in the virtual CPU. With this change, # the qemu-mips works fine. # IMPORTANT: This piece needs to be removed once the root cause is fixed! -do_install_append() { +do_install:append() { if [ -e "${D}/${bindir}/qemu-mips" ]; then create_wrapper ${D}/${bindir}/qemu-mips \ QEMU_RESERVED_VA=0x0 @@ -99,40 +146,65 @@ do_install_append() { } # END of qemu-mips workaround -PACKAGECONFIG ??= " \ - fdt sdl \ - ${@bb.utils.contains('DISTRO_FEATURES', 'alsa', 'alsa', '', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'xen', 'xen', '', d)} \ - " -PACKAGECONFIG_class-native ??= "fdt alsa uuid" -PACKAGECONFIG_class-nativesdk ??= "fdt sdl" +# Disable kvm/virgl/mesa on targets that do not support it +PACKAGECONFIG:remove:darwin = "kvm virglrenderer epoxy gtk+" +PACKAGECONFIG:remove:mingw32 = "kvm virglrenderer epoxy gtk+" -PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,libsdl" -PACKAGECONFIG[virtfs] = "--enable-virtfs --enable-attr,--disable-virtfs,libcap attr," +PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,libsdl2" +PACKAGECONFIG[png] = "--enable-png,--disable-png,libpng" +PACKAGECONFIG[virtfs] = "--enable-virtfs --enable-attr --enable-cap-ng,--disable-virtfs,libcap-ng attr," PACKAGECONFIG[aio] = "--enable-linux-aio,--disable-linux-aio,libaio," -PACKAGECONFIG[xfs] = "--enable-xfsctl,--disable-xfsctl,xfsprogs," -PACKAGECONFIG[xen] = "--enable-xen,--disable-xen,xen,xen-libxenstore xen-libxenctrl xen-libxenguest" +PACKAGECONFIG[uring] = "--enable-linux-io-uring,--disable-linux-io-uring,liburing" +PACKAGECONFIG[xen] = "--enable-xen,--disable-xen,xen-tools,xen-tools-libxenstore xen-tools-libxenctrl xen-tools-libxenguest" PACKAGECONFIG[vnc-sasl] = "--enable-vnc --enable-vnc-sasl,--disable-vnc-sasl,cyrus-sasl," PACKAGECONFIG[vnc-jpeg] = "--enable-vnc --enable-vnc-jpeg,--disable-vnc-jpeg,jpeg," -PACKAGECONFIG[vnc-png] = "--enable-vnc --enable-vnc-png,--disable-vnc-png,libpng," -PACKAGECONFIG[libcurl] = "--enable-curl,--disable-curl,libcurl," +PACKAGECONFIG[libcurl] = "--enable-curl,--disable-curl,curl," PACKAGECONFIG[nss] = "--enable-smartcard,--disable-smartcard,nss," -PACKAGECONFIG[uuid] = "--enable-uuid,--disable-uuid,util-linux," PACKAGECONFIG[curses] = "--enable-curses,--disable-curses,ncurses," -PACKAGECONFIG[gtk+] = "--enable-gtk --with-gtkabi=3.0 --enable-vte,--disable-gtk --disable-vte,gtk+3 vte" +PACKAGECONFIG[gtk+] = "--enable-gtk,--disable-gtk,gtk+3 gettext-native" +PACKAGECONFIG[vte] = "--enable-vte,--disable-vte,vte gettext-native" PACKAGECONFIG[libcap-ng] = "--enable-cap-ng,--disable-cap-ng,libcap-ng," -PACKAGECONFIG[ssh2] = "--enable-libssh2,--disable-libssh2,libssh2," -PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,gcrypt," +PACKAGECONFIG[ssh] = "--enable-libssh,--disable-libssh,libssh," +PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt," PACKAGECONFIG[nettle] = "--enable-nettle,--disable-nettle,nettle" PACKAGECONFIG[libusb] = "--enable-libusb,--disable-libusb,libusb1" PACKAGECONFIG[fdt] = "--enable-fdt,--disable-fdt,dtc" -PACKAGECONFIG[alsa] = ",,alsa-lib" -PACKAGECONFIG[glx] = "--enable-opengl,--disable-opengl,mesa" +PACKAGECONFIG[alsa] = "--audio-drv-list=default,,alsa-lib" +PACKAGECONFIG[epoxy] = "--enable-opengl,--disable-opengl,libepoxy" PACKAGECONFIG[lzo] = "--enable-lzo,--disable-lzo,lzo" PACKAGECONFIG[numa] = "--enable-numa,--disable-numa,numactl" PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls" PACKAGECONFIG[bzip2] = "--enable-bzip2,--disable-bzip2,bzip2" - -EXTRA_OECONF += "${@bb.utils.contains('PACKAGECONFIG', 'alsa', '--audio-drv-list=oss,alsa', '', d)}" - -INSANE_SKIP_${PN} = "arch" +PACKAGECONFIG[libiscsi] = "--enable-libiscsi,--disable-libiscsi" +PACKAGECONFIG[kvm] = "--enable-kvm,--disable-kvm" +PACKAGECONFIG[virglrenderer] = "--enable-virglrenderer,--disable-virglrenderer,virglrenderer" +# spice will be in meta-networking layer +PACKAGECONFIG[spice] = "--enable-spice,--disable-spice,spice" +# usbredir will be in meta-networking layer +PACKAGECONFIG[usb-redir] = "--enable-usb-redir,--disable-usb-redir,usbredir" +PACKAGECONFIG[snappy] = "--enable-snappy,--disable-snappy,snappy" +PACKAGECONFIG[glusterfs] = "--enable-glusterfs,--disable-glusterfs,glusterfs" +PACKAGECONFIG[xkbcommon] = "--enable-xkbcommon,--disable-xkbcommon,libxkbcommon" +PACKAGECONFIG[libudev] = "--enable-libudev,--disable-libudev,eudev" +PACKAGECONFIG[attr] = "--enable-attr,--disable-attr,attr," +PACKAGECONFIG[rbd] = "--enable-rbd,--disable-rbd,ceph,ceph" +PACKAGECONFIG[vhost] = "--enable-vhost-net,--disable-vhost-net,," +PACKAGECONFIG[ust] = "--enable-trace-backend=ust,--enable-trace-backend=nop,lttng-ust," +PACKAGECONFIG[pie] = "--enable-pie,--disable-pie,," +PACKAGECONFIG[seccomp] = "--enable-seccomp,--disable-seccomp,libseccomp" +# libnfs is currently provided by meta-kodi +PACKAGECONFIG[libnfs] = "--enable-libnfs,--disable-libnfs,libnfs" +PACKAGECONFIG[pmem] = "--enable-libpmem,--disable-libpmem,pmdk" +PACKAGECONFIG[pulsedio] = "--enable-pa,--disable-pa,pulseaudio" +PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux" +PACKAGECONFIG[bpf] = "--enable-bpf,--disable-bpf,libbpf" +PACKAGECONFIG[capstone] = "--enable-capstone,--disable-capstone" +PACKAGECONFIG[rdma] = "--enable-rdma,--disable-rdma" +PACKAGECONFIG[vde] = "--enable-vde,--disable-vde" +PACKAGECONFIG[slirp] = "--enable-slirp,--disable-slirp,libslirp" +PACKAGECONFIG[brlapi] = "--enable-brlapi,--disable-brlapi" +PACKAGECONFIG[jack] = "--enable-jack,--disable-jack,jack," + +INSANE_SKIP:${PN} = "arch" + +FILES:${PN} += "${datadir}/icons" |