diff options
Diffstat (limited to 'meta/recipes-devtools/qemu')
30 files changed, 767 insertions, 760 deletions
diff --git a/meta/recipes-devtools/qemu/nativesdk-qemu-helper_1.0.bb b/meta/recipes-devtools/qemu/nativesdk-qemu-helper_1.0.bb index abba7fe159..90bba84b03 100644 --- a/meta/recipes-devtools/qemu/nativesdk-qemu-helper_1.0.bb +++ b/meta/recipes-devtools/qemu/nativesdk-qemu-helper_1.0.bb @@ -1,13 +1,11 @@ SUMMARY = "Qemu helper scripts" LICENSE = "GPL-2.0-only" -RDEPENDS:${PN} = "nativesdk-qemu \ +RDEPENDS:${PN} = "nativesdk-qemu nativesdk-unfs3 nativesdk-pseudo \ nativesdk-python3-shell nativesdk-python3-fcntl nativesdk-python3-logging \ " -PR = "r9" -LIC_FILES_CHKSUM = "file://${WORKDIR}/tunctl.c;endline=4;md5=ff3a09996bc5fff6bc5d4e0b4c28f999 \ - file://${COREBASE}/scripts/runqemu;beginline=5;endline=10;md5=ac2b489a58739c7628a2604698db5e7f" +LIC_FILES_CHKSUM = "file://${COREBASE}/scripts/runqemu;beginline=5;endline=10;md5=ac2b489a58739c7628a2604698db5e7f" SRC_URI = "file://${COREBASE}/scripts/runqemu \ @@ -18,20 +16,19 @@ SRC_URI = "file://${COREBASE}/scripts/runqemu \ file://${COREBASE}/scripts/oe-find-native-sysroot \ file://${COREBASE}/scripts/runqemu-extract-sdk \ file://${COREBASE}/scripts/runqemu-export-rootfs \ - file://tunctl.c \ " -S = "${WORKDIR}" +S = "${WORKDIR}/sources" +UNPACKDIR = "${S}" inherit nativesdk do_compile() { - ${CC} tunctl.c -o tunctl + : } do_install() { install -d ${D}${bindir} - install -m 0755 ${WORKDIR}${COREBASE}/scripts/oe-* ${D}${bindir}/ - install -m 0755 ${WORKDIR}${COREBASE}/scripts/runqemu* ${D}${bindir}/ - install tunctl ${D}${bindir}/ + install -m 0755 ${S}${COREBASE}/scripts/oe-* ${D}${bindir}/ + install -m 0755 ${S}${COREBASE}/scripts/runqemu* ${D}${bindir}/ } diff --git a/meta/recipes-devtools/qemu/qemu-helper-native_1.0.bb b/meta/recipes-devtools/qemu/qemu-helper-native_1.0.bb index aa9e499c77..28a3b95c4e 100644 --- a/meta/recipes-devtools/qemu/qemu-helper-native_1.0.bb +++ b/meta/recipes-devtools/qemu/qemu-helper-native_1.0.bb @@ -1,29 +1,24 @@ SUMMARY = "Helper utilities needed by the runqemu script" LICENSE = "GPL-2.0-only" RDEPENDS:${PN} = "qemu-system-native" -PR = "r1" -LIC_FILES_CHKSUM = "file://${WORKDIR}/tunctl.c;endline=4;md5=ff3a09996bc5fff6bc5d4e0b4c28f999" +LIC_FILES_CHKSUM = "file://${S}/qemu-oe-bridge-helper.c;endline=4;md5=ae00a3bab86f2caaa8462eacda77f4d7" -SRC_URI = "\ - file://tunctl.c \ - file://qemu-oe-bridge-helper \ - " +SRC_URI = "file://qemu-oe-bridge-helper.c" -S = "${WORKDIR}" +S = "${WORKDIR}/sources" +UNPACKDIR = "${S}" inherit native do_compile() { - ${CC} ${CFLAGS} ${LDFLAGS} -Wall tunctl.c -o tunctl + ${CC} ${CFLAGS} ${LDFLAGS} -Wall qemu-oe-bridge-helper.c -o qemu-oe-bridge-helper } do_install() { install -d ${D}${bindir} - install tunctl ${D}${bindir}/ - - install -m 755 ${WORKDIR}/qemu-oe-bridge-helper ${D}${bindir}/ + install qemu-oe-bridge-helper ${D}${bindir}/ } -DEPENDS += "qemu-system-native" +DEPENDS += "qemu-system-native unfs3-native pseudo-native" addtask addto_recipe_sysroot after do_populate_sysroot before do_build diff --git a/meta/recipes-devtools/qemu/qemu-helper/qemu-oe-bridge-helper b/meta/recipes-devtools/qemu/qemu-helper/qemu-oe-bridge-helper deleted file mode 100755 index f057d4eef0..0000000000 --- a/meta/recipes-devtools/qemu/qemu-helper/qemu-oe-bridge-helper +++ /dev/null @@ -1,25 +0,0 @@ -#! /bin/sh -# Copyright 2020 Garmin Ltd. or its subsidiaries -# -# SPDX-License-Identifier: GPL-2.0 -# -# Attempts to find and exec the host qemu-bridge-helper program - -# If the QEMU_BRIDGE_HELPER variable is set by the user, exec it. -if [ -n "$QEMU_BRIDGE_HELPER" ]; then - exec "$QEMU_BRIDGE_HELPER" "$@" -fi - -# Search common paths for the helper program -BN="qemu-bridge-helper" -PATHS="/usr/libexec/ /usr/lib/qemu/" - -for p in $PATHS; do - if [ -e "$p/$BN" ]; then - exec "$p/$BN" "$@" - fi -done - -echo "$BN not found!" > /dev/stderr -exit 1 - diff --git a/meta/recipes-devtools/qemu/qemu-helper/qemu-oe-bridge-helper.c b/meta/recipes-devtools/qemu/qemu-helper/qemu-oe-bridge-helper.c new file mode 100644 index 0000000000..c34aa00567 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu-helper/qemu-oe-bridge-helper.c @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Garmin Ltd. or its subsidiaries + * + * SPDX-License-Identifier: GPL-2.0 + * + * Attempts to find and exec the host qemu-bridge-helper program + */ + +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <stdlib.h> + +void try_program(char const* path, char** args) { + if (access(path, X_OK) == 0) { + execv(path, args); + } +} + +int main(int argc, char** argv) { + char* var; + + var = getenv("QEMU_BRIDGE_HELPER"); + if (var && var[0] != '\0') { + execvp(var, argv); + return 1; + } + + if (argc == 2 && strcmp(argv[1], "--help") == 0) { + fprintf(stderr, "Helper function to find and exec qemu-bridge-helper. Set QEMU_BRIDGE_HELPER to override default search path\n"); + return 0; + } + + try_program("/usr/libexec/qemu-bridge-helper", argv); + try_program("/usr/lib/qemu/qemu-bridge-helper", argv); + + fprintf(stderr, "No bridge helper found\n"); + return 1; +} + diff --git a/meta/recipes-devtools/qemu/qemu-helper/tunctl.c b/meta/recipes-devtools/qemu/qemu-helper/tunctl.c deleted file mode 100644 index d745dd06cb..0000000000 --- a/meta/recipes-devtools/qemu/qemu-helper/tunctl.c +++ /dev/null @@ -1,158 +0,0 @@ -/* Copyright 2002 Jeff Dike - * Licensed under the GPL - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> -#include <fcntl.h> -#include <unistd.h> -#include <pwd.h> -#include <grp.h> -#include <net/if.h> -#include <sys/ioctl.h> -#include <linux/if_tun.h> - -/* TUNSETGROUP appeared in 2.6.23 */ -#ifndef TUNSETGROUP -#define TUNSETGROUP _IOW('T', 206, int) -#endif - -static void Usage(char *name, int status) -{ - fprintf(stderr, "Create: %s [-b] [-u owner] [-g group] [-t device-name] " - "[-f tun-clone-device]\n", name); - fprintf(stderr, "Delete: %s -d device-name [-f tun-clone-device]\n\n", - name); - fprintf(stderr, "The default tun clone device is /dev/net/tun - some systems" - " use\n/dev/misc/net/tun instead\n\n"); - fprintf(stderr, "-b will result in brief output (just the device name)\n"); - exit(status); -} - -int main(int argc, char **argv) -{ - struct ifreq ifr; - struct passwd *pw; - struct group *gr; - uid_t owner = -1; - gid_t group = -1; - int tap_fd, opt, delete = 0, brief = 0; - char *tun = "", *file = "/dev/net/tun", *name = argv[0], *end; - - while((opt = getopt(argc, argv, "bd:f:t:u:g:h")) > 0){ - switch(opt) { - case 'b': - brief = 1; - break; - case 'd': - delete = 1; - tun = optarg; - break; - case 'f': - file = optarg; - break; - case 'u': - pw = getpwnam(optarg); - if(pw != NULL){ - owner = pw->pw_uid; - break; - } - owner = strtol(optarg, &end, 0); - if(*end != '\0'){ - fprintf(stderr, "'%s' is neither a username nor a numeric uid.\n", - optarg); - Usage(name, 1); - } - break; - case 'g': - gr = getgrnam(optarg); - if(gr != NULL){ - group = gr->gr_gid; - break; - } - group = strtol(optarg, &end, 0); - if(*end != '\0'){ - fprintf(stderr, "'%s' is neither a groupname nor a numeric group.\n", - optarg); - Usage(name, 1); - } - break; - - case 't': - tun = optarg; - break; - case 'h': - Usage(name, 0); - break; - default: - Usage(name, 1); - } - } - - argv += optind; - argc -= optind; - - if(argc > 0) - Usage(name, 1); - - if((tap_fd = open(file, O_RDWR)) < 0){ - fprintf(stderr, "Failed to open '%s' : ", file); - perror(""); - exit(1); - } - - memset(&ifr, 0, sizeof(ifr)); - - ifr.ifr_flags = IFF_TAP | IFF_NO_PI; - strncpy(ifr.ifr_name, tun, sizeof(ifr.ifr_name) - 1); - if(ioctl(tap_fd, TUNSETIFF, (void *) &ifr) < 0){ - perror("TUNSETIFF"); - exit(1); - } - - if(delete){ - if(ioctl(tap_fd, TUNSETPERSIST, 0) < 0){ - perror("disabling TUNSETPERSIST"); - exit(1); - } - printf("Set '%s' nonpersistent\n", ifr.ifr_name); - } - else { - /* emulate behaviour prior to TUNSETGROUP */ - if(owner == -1 && group == -1) { - owner = geteuid(); - } - - if(owner != -1) { - if(ioctl(tap_fd, TUNSETOWNER, owner) < 0){ - perror("TUNSETOWNER"); - exit(1); - } - } - if(group != -1) { - if(ioctl(tap_fd, TUNSETGROUP, group) < 0){ - perror("TUNSETGROUP"); - exit(1); - } - } - - if(ioctl(tap_fd, TUNSETPERSIST, 1) < 0){ - perror("enabling TUNSETPERSIST"); - exit(1); - } - - if(brief) - printf("%s\n", ifr.ifr_name); - else { - printf("Set '%s' persistent and owned by", ifr.ifr_name); - if(owner != -1) - printf(" uid %d", owner); - if(group != -1) - printf(" gid %d", group); - printf("\n"); - } - } - return(0); -} diff --git a/meta/recipes-devtools/qemu/qemu-native.inc b/meta/recipes-devtools/qemu/qemu-native.inc index d9acc613f9..891dc5e2a1 100644 --- a/meta/recipes-devtools/qemu/qemu-native.inc +++ b/meta/recipes-devtools/qemu/qemu-native.inc @@ -1,6 +1,6 @@ require qemu.inc -inherit native +inherit_defer native EXTRA_OEMAKE:append = " LD='${LD}' AR='${AR}' OBJCOPY='${OBJCOPY}' LDFLAGS='${LDFLAGS}'" diff --git a/meta/recipes-devtools/qemu/qemu-native_7.0.0.bb b/meta/recipes-devtools/qemu/qemu-native_7.0.0.bb deleted file mode 100644 index a94dc0b61e..0000000000 --- a/meta/recipes-devtools/qemu/qemu-native_7.0.0.bb +++ /dev/null @@ -1,9 +0,0 @@ -BPN = "qemu" - -DEPENDS = "glib-2.0-native zlib-native ninja-native meson-native" - -require qemu-native.inc - -EXTRA_OECONF:append = " --target-list=${@get_qemu_usermode_target_list(d)} --disable-tools --disable-blobs --disable-guest-agent" - -PACKAGECONFIG ??= "pie" diff --git a/meta/recipes-devtools/qemu/qemu-native_9.0.0.bb b/meta/recipes-devtools/qemu/qemu-native_9.0.0.bb new file mode 100644 index 0000000000..a77953529b --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu-native_9.0.0.bb @@ -0,0 +1,9 @@ +BPN = "qemu" + +DEPENDS += "glib-2.0-native zlib-native" + +require qemu-native.inc + +EXTRA_OECONF:append = " --target-list=${@get_qemu_usermode_target_list(d)} --disable-tools --disable-install-blobs --disable-guest-agent" + +PACKAGECONFIG ??= "pie" diff --git a/meta/recipes-devtools/qemu/qemu-system-native_7.0.0.bb b/meta/recipes-devtools/qemu/qemu-system-native_9.0.0.bb index 5ccede5095..5d2fbcbc02 100644 --- a/meta/recipes-devtools/qemu/qemu-system-native_7.0.0.bb +++ b/meta/recipes-devtools/qemu/qemu-system-native_9.0.0.bb @@ -1,17 +1,15 @@ BPN = "qemu" -inherit python3-dir - require qemu-native.inc # As some of the files installed by qemu-native and qemu-system-native # are the same, we depend on qemu-native to get the full installation set # and avoid file clashes -DEPENDS = "glib-2.0-native zlib-native pixman-native qemu-native bison-native meson-native ninja-native" +DEPENDS += "glib-2.0-native zlib-native pixman-native qemu-native" EXTRA_OECONF:append = " --target-list=${@get_qemu_system_target_list(d)}" -PACKAGECONFIG ??= "fdt alsa kvm pie slirp \ +PACKAGECONFIG ??= "fdt alsa kvm pie slirp png \ ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'virglrenderer epoxy', '', d)} \ " @@ -19,7 +17,7 @@ PACKAGECONFIG ??= "fdt alsa kvm pie slirp \ PACKAGECONFIG:remove = "${@'kvm' if not os.path.exists('/usr/include/linux/kvm.h') else ''}" do_install:append() { - install -Dm 0755 ${WORKDIR}/powerpc_rom.bin ${D}${datadir}/qemu + install -Dm 0755 ${UNPACKDIR}/powerpc_rom.bin ${D}${datadir}/qemu # The following is also installed by qemu-native rm -f ${D}${datadir}/qemu/trace-events-all @@ -28,5 +26,6 @@ do_install:append() { rm -rf ${D}${includedir}/qemu-plugin.h # Install qmp.py to be used with testimage - install -D ${S}/python/qemu/qmp/__init__.py ${D}${libdir}/qemu-python/qmp.py + install -d ${D}${libdir}/qemu-python/qmp/ + install -D ${S}/python/qemu/qmp/* ${D}${libdir}/qemu-python/qmp/ } diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc index bcaa56bbba..fb38fb44de 100644 --- a/meta/recipes-devtools/qemu/qemu.inc +++ b/meta/recipes-devtools/qemu/qemu.inc @@ -6,10 +6,14 @@ a variety of guest operating systems" HOMEPAGE = "http://qemu.org" LICENSE = "GPL-2.0-only & LGPL-2.1-only" +DEPENDS += "bison-native meson-native ninja-native" + RDEPENDS:${PN}-ptest = "bash" require qemu-targets.inc -inherit pkgconfig ptest +# https://gitlab.com/qemu-project/qemu/-/commit/81e2b198a8cb4ee5fdf108bd438f44b193ee3a36 means +# we need a full python3-native setup +inherit pkgconfig ptest update-rc.d systemd python3native LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \ file://COPYING.LIB;endline=24;md5=8c5efda6cf1e1b03dcfd0e6c0d271c7f" @@ -18,35 +22,30 @@ 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://qemu-7.0.0-glibc-2.36.patch \ - file://CVE-2022-35414.patch \ + file://0002-apic-fixup-fallthrough-to-PIC.patch \ + file://0003-configure-Add-pkg-config-handling-for-libgcrypt.patch \ + file://0004-qemu-Do-not-include-file-if-not-exists.patch \ + file://0005-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch \ + file://0006-qemu-Determinism-fixes.patch \ + file://0007-tests-meson.build-use-relative-path-to-refer-to-file.patch \ + file://0008-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch \ + file://0009-linux-user-Replace-use-of-lfs64-related-functions-an.patch \ + file://0010-configure-lookup-meson-exutable-from-PATH.patch \ + file://0011-qemu-Ensure-pip-and-the-python-venv-aren-t-used-for-.patch \ + file://qemu-guest-agent.init \ + file://qemu-guest-agent.udev \ " UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" -SRC_URI[sha256sum] = "f6b375c7951f728402798b0baabb2d86478ca53d44cedbefabbe1c46bf46f839" - -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" +SRC_URI[sha256sum] = "32708ac66c30d8c892633ea968c771c1c76d597d70ddead21a0d22ccf386da69" -# The VNC server can expose host files uder some circumstances. We don't -# enable it by default. -CVE_CHECK_IGNORE += "CVE-2007-0998" +CVE_STATUS[CVE-2007-0998] = "not-applicable-config: The VNC server can expose host files uder some circumstances. We don't enable it by default." -# '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" +CVE_STATUS[CVE-2018-18438] = "disputed: The issues identified by this CVE were determined to not constitute a vulnerability." + +# As per https://bugzilla.redhat.com/show_bug.cgi?id=2203387 +CVE_STATUS[CVE-2023-2680] = "not-applicable-platform: RHEL specific issue." COMPATIBLE_HOST:mipsarchn32 = "null" COMPATIBLE_HOST:mipsarchn64 = "null" @@ -69,14 +68,23 @@ do_install_ptest() { sed -i -e "1s,#!/usr/bin/bash,#!${base_bindir}/bash," ${D}${PTEST_PATH}/tests/data/acpi/disassemle-aml.sh # Strip the paths from the QEMU variable, we can use PATH - sed -i -e "s#^QEMU=.*/qemu-#QEMU=qemu-#g" ${D}${PTEST_PATH}/tests/tcg/*.mak + 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 + + # Update SRC_PATH variable to the right place on target + sed -i -e "s#^SRC_PATH=.*#SRC_PATH=${PTEST_PATH}#g" $makfiles - # Strip compiler flags as they break reproducibility - sed -i -e "s,CROSS_CC_GUEST=.*,CROSS_CC_GUEST=," ${D}${PTEST_PATH}/tests/tcg/*.mak + # https://gitlab.com/qemu-project/qemu/-/issues/1403 + rm ${D}${PTEST_PATH}/tests/unit/test-io-channel-command } # QEMU_TARGETS is overridable variable -QEMU_TARGETS ?= "arm aarch64 i386 mips mipsel mips64 mips64el ppc ppc64 ppc64le riscv32 riscv64 sh4 x86_64" +QEMU_TARGETS ?= "arm aarch64 i386 loongarch64 mips mipsel mips64 mips64el ppc ppc64 ppc64le riscv32 riscv64 sh4 x86_64" EXTRA_OECONF = " \ --prefix=${prefix} \ @@ -94,12 +102,16 @@ EXTRA_OECONF = " \ --disable-werror \ --extra-cflags='${CFLAGS}' \ --extra-ldflags='${LDFLAGS}' \ - --with-git=/bin/false \ - --with-git-submodules=ignore \ - --meson=meson \ + --disable-download \ + --disable-docs \ + --host-cc='${BUILD_CC}' \ + --disable-af-xdp \ ${PACKAGECONFIG_CONFARGS} \ " +EXTRA_OECONF:append:class-target = " --cross-prefix=${HOST_PREFIX}" +EXTRA_OECONF:append:class-nativesdk = " --cross-prefix=${HOST_PREFIX}" + B = "${WORKDIR}/build" #EXTRA_OECONF:append = " --python=${HOSTTOOLS_DIR}/python3" @@ -113,6 +125,7 @@ do_configure:prepend:class-native() { } do_configure() { + export PKG_CONFIG=pkg-config ${S}/configure ${EXTRA_OECONF} } do_configure[cleandirs] += "${B}" @@ -120,6 +133,26 @@ do_configure[cleandirs] += "${B}" do_install () { export STRIP="" oe_runmake 'DESTDIR=${D}' install + + # If we built the guest agent, also install startup/udev rules + if [ -e "${D}${bindir}/qemu-ga" ]; then + install -d ${D}${sysconfdir}/init.d/ + install -m 0755 ${UNPACKDIR}/qemu-guest-agent.init ${D}${sysconfdir}/init.d/qemu-guest-agent + sed -i 's:@bindir@:${bindir}:' ${D}${sysconfdir}/init.d/qemu-guest-agent + + install -d ${D}${sysconfdir}/udev/rules.d/ + install -m 0644 ${UNPACKDIR}/qemu-guest-agent.udev ${D}${sysconfdir}/udev/rules.d/60-qemu-guest-agent.rules + + install -d ${D}${systemd_unitdir}/system/ + install -m 0644 ${S}/contrib/systemd/qemu-guest-agent.service ${D}${systemd_unitdir}/system + sed -i -e 's,-/usr/bin/,-${bindir}/,g' ${D}${systemd_unitdir}/system/qemu-guest-agent.service + fi + # ELF binary /usr/share/qemu/s390-netboot.img has relocations in .text + rm ${D}${datadir}/qemu/s390-netboot.img -f + # ELF binary /usr/share/qemu/s390-ccw.img has relocations in .text [textrel] + rm ${D}${datadir}/qemu/s390-ccw.img -f + # We don't support PARISC and these cause strip and SDK relocation errors + rm ${D}${datadir}/qemu/hppa* -f } # The following fragment will create a wrapper for qemu-mips user emulation @@ -138,16 +171,16 @@ do_install:append() { # 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:remove:mingw32 = "kvm virglrenderer epoxy gtk+ pie" 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[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,curl," PACKAGECONFIG[nss] = "--enable-smartcard,--disable-smartcard,nss," PACKAGECONFIG[curses] = "--enable-curses,--disable-curses,ncurses," @@ -162,6 +195,7 @@ PACKAGECONFIG[fdt] = "--enable-fdt,--disable-fdt,dtc" PACKAGECONFIG[alsa] = "--audio-drv-list=default,,alsa-lib" PACKAGECONFIG[epoxy] = "--enable-opengl,--disable-opengl,libepoxy" PACKAGECONFIG[lzo] = "--enable-lzo,--disable-lzo,lzo" +PACKAGECONFIG[dax] = "--enable-libdaxctl,--disable-libdaxctl,ndctl" PACKAGECONFIG[numa] = "--enable-numa,--disable-numa,numactl" PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls" PACKAGECONFIG[bzip2] = "--enable-bzip2,--disable-bzip2,bzip2" @@ -171,29 +205,77 @@ PACKAGECONFIG[virglrenderer] = "--enable-virglrenderer,--disable-virglrenderer,v # spice will be in meta-networking layer PACKAGECONFIG[spice] = "--enable-spice,--disable-spice,spice" # usbredir will be in meta-networking layer +PACKAGECONFIG[dbus-display] = "--enable-dbus-display,--disable-dbus-display,glib-2.0-native,dbus" 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[libudev] = "--enable-libudev,--disable-libudev,udev" 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[ust] = "--enable-trace-backends=ust,,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[pulseaudio] = "--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=internal,--disable-slirp" +PACKAGECONFIG[fuse] = "--enable-fuse --enable-fuse-lseek,--disable-fuse --disable-fuse-lseek,fuse3" +PACKAGECONFIG[slirp] = "--enable-slirp,--disable-slirp,libslirp" PACKAGECONFIG[brlapi] = "--enable-brlapi,--disable-brlapi" +PACKAGECONFIG[jack] = "--enable-jack,--disable-jack,jack," +PACKAGECONFIG[debuginfo] = "--enable-libdw,--disable-libdw,elfutils" +PACKAGECONFIG[pipewire] = "--enable-pipewire,--disable-pipewire,pipewire" +PACKAGECONFIG[sndio] = "--enable-sndio,--disable-sndio,sndio" -INSANE_SKIP:${PN} = "arch" +INSANE_SKIP:${PN}-common = "arch" FILES:${PN} += "${datadir}/icons" + +# For user who want to install all arch packages +PACKAGES =+ "${PN}-common" +RDEPENDS:${PN} += "${PN}-common" + +ALLOW_EMPTY:${PN} = "1" +FILES:${PN} = "" + +FILES:${PN}-common = "${bindir}/* ${includedir}/* ${libexecdir}/* ${datadir}/* ${localstatedir}" + +PACKAGES_DYNAMIC += "^${PN}-user-.* ^${PN}-system-.*" + +PACKAGESPLITFUNCS =+ "split_qemu_packages" + +python split_qemu_packages () { + archdir = d.expand('${bindir}/') + subpackages = do_split_packages(d, archdir, r'^qemu-system-(.*)$', '${PN}-system-%s', 'QEMU full system emulation binaries(%s)' , prepend=True, extra_depends='${PN}-common') + + subpackages += do_split_packages(d, archdir, r'^qemu-((?!system|edid|ga|img|io|nbd|pr-helper|storage-daemon).*)$', '${PN}-user-%s', 'QEMU full user emulation binaries(%s)' , prepend=True, extra_depends='${PN}-common') + if subpackages: + d.appendVar('RDEPENDS:' + d.getVar('PN'), ' ' + ' '.join(subpackages)) + mipspackage = d.getVar('PN') + "-user-mips" + if mipspackage in ' '.join(subpackages): + d.appendVar('RDEPENDS:' + mipspackage, ' ' + d.getVar("MLPREFIX") + 'bash') +} + +# Put the guest agent in a separate package +PACKAGES =+ "${PN}-guest-agent" +SUMMARY:${PN}-guest-agent = "QEMU guest agent" +FILES:${PN}-guest-agent += " \ + ${bindir}/qemu-ga \ + ${sysconfdir}/udev/rules.d/60-qemu-guest-agent.rules \ + ${sysconfdir}/init.d/qemu-guest-agent \ + ${systemd_unitdir}/system/qemu-guest-agent.service \ +" + +INITSCRIPT_PACKAGES = "${PN}-guest-agent" +INITSCRIPT_NAME:${PN}-guest-agent = "qemu-guest-agent" +INITSCRIPT_PARAMS:${PN}-guest-agent = "defaults" + +SYSTEMD_PACKAGES = "${PN}-guest-agent" +SYSTEMD_SERVICE:${PN}-guest-agent = "qemu-guest-agent.service" diff --git a/meta/recipes-devtools/qemu/qemu/0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch b/meta/recipes-devtools/qemu/qemu/0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch index 6fb160e6d3..2333cc8432 100644 --- a/meta/recipes-devtools/qemu/qemu/0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch +++ b/meta/recipes-devtools/qemu/qemu/0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch @@ -1,7 +1,7 @@ -From de64af82950a6908f9407dfc92b83c17e2af3eab Mon Sep 17 00:00:00 2001 +From e9baf07a667a1c04b57e14776cc4fa387448c908 Mon Sep 17 00:00:00 2001 From: Jason Wessel <jason.wessel@windriver.com> Date: Fri, 28 Mar 2014 17:42:43 +0800 -Subject: [PATCH 01/12] qemu: Add addition environment space to boot loader +Subject: [PATCH 01/11] qemu: Add addition environment space to boot loader qemu-system-mips Upstream-Status: Inappropriate - OE uses deep paths @@ -13,16 +13,15 @@ to only 256 bytes. This patch expands the limit. Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Roy Li <rongqing.li@windriver.com> - --- hw/mips/malta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/mips/malta.c b/hw/mips/malta.c -index 628851172..12d37f35d 100644 +index af74008c82..a588b9ad4e 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c -@@ -61,7 +61,7 @@ +@@ -63,7 +63,7 @@ #define ENVP_PADDR 0x2000 #define ENVP_VADDR cpu_mips_phys_to_kseg0(NULL, ENVP_PADDR) #define ENVP_NB_ENTRIES 16 @@ -32,5 +31,5 @@ index 628851172..12d37f35d 100644 /* Hardware addresses */ #define FLASH_ADDRESS 0x1e000000ULL -- -2.30.2 +2.44.0 diff --git a/meta/recipes-devtools/qemu/qemu/0003-apic-fixup-fallthrough-to-PIC.patch b/meta/recipes-devtools/qemu/qemu/0002-apic-fixup-fallthrough-to-PIC.patch index f350ffce47..5f8fe4faa3 100644 --- a/meta/recipes-devtools/qemu/qemu/0003-apic-fixup-fallthrough-to-PIC.patch +++ b/meta/recipes-devtools/qemu/qemu/0002-apic-fixup-fallthrough-to-PIC.patch @@ -1,7 +1,7 @@ -From dc2a8ccd440ee3741b61606eafed3f7e092f4312 Mon Sep 17 00:00:00 2001 +From 23bf534e463bf4c1ba2e1356eaf17be0b23b192e Mon Sep 17 00:00:00 2001 From: Mark Asselstine <mark.asselstine@windriver.com> Date: Tue, 26 Feb 2013 11:43:28 -0500 -Subject: [PATCH 03/12] apic: fixup fallthrough to PIC +Subject: [PATCH 02/11] apic: fixup fallthrough to PIC Commit 0e21e12bb311c4c1095d0269dc2ef81196ccb60a [Don't route PIC interrupts through the local APIC if the local APIC config says so.] @@ -24,16 +24,15 @@ serviced, is -1. Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2013-04/msg00878.html] Signed-off-by: He Zhe <zhe.he@windriver.com> - --- hw/intc/apic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/intc/apic.c b/hw/intc/apic.c -index 3df11c34d..9506c88ce 100644 +index 4186c57b34..43cd805a96 100644 --- a/hw/intc/apic.c +++ b/hw/intc/apic.c -@@ -605,7 +605,7 @@ int apic_accept_pic_intr(DeviceState *dev) +@@ -759,7 +759,7 @@ int apic_accept_pic_intr(DeviceState *dev) APICCommonState *s = APIC(dev); uint32_t lvt0; @@ -43,5 +42,5 @@ index 3df11c34d..9506c88ce 100644 lvt0 = s->lvt[APIC_LVT_LINT0]; -- -2.30.2 +2.44.0 diff --git a/meta/recipes-devtools/qemu/qemu/0002-chardev-connect-socket-to-a-spawned-command.patch b/meta/recipes-devtools/qemu/qemu/0002-chardev-connect-socket-to-a-spawned-command.patch deleted file mode 100644 index 63a99c9620..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0002-chardev-connect-socket-to-a-spawned-command.patch +++ /dev/null @@ -1,246 +0,0 @@ -From 14cd62607c9de232edf0a9b8503bd02783e03411 Mon Sep 17 00:00:00 2001 -From: Alistair Francis <alistair.francis@xilinx.com> -Date: Thu, 21 Dec 2017 11:35:16 -0800 -Subject: [PATCH 02/12] chardev: connect socket to a spawned command - -The command is started in a shell (sh -c) with stdin connect to QEMU -via a Unix domain stream socket. QEMU then exchanges data via its own -end of the socket, just like it normally does. - -"-chardev socket" supports some ways of connecting via protocols like -telnet, but that is only a subset of the functionality supported by -tools socat. To use socat instead, for example to connect via a socks -proxy, use: - - -chardev 'socket,id=socat,cmd=exec socat FD:0 SOCKS4A:socks-proxy.localdomain:example.com:9999,,socksuser=nobody' \ - -device usb-serial,chardev=socat - -Beware that commas in the command must be escaped as double commas. - -Or interactively in the console: - (qemu) chardev-add socket,id=cat,cmd=cat - (qemu) device_add usb-serial,chardev=cat - ^ac - # cat >/dev/ttyUSB0 - hello - hello - -Another usage is starting swtpm from inside QEMU. swtpm will -automatically shut down once it looses the connection to the parent -QEMU, so there is no risk of lingering processes: - - -chardev 'socket,id=chrtpm0,cmd=exec swtpm socket --terminate --ctrl type=unixio,,clientfd=0 --tpmstate dir=... --log file=swtpm.log' \ - -tpmdev emulator,id=tpm0,chardev=chrtpm0 \ - -device tpm-tis,tpmdev=tpm0 - -The patch was discussed upstream, but QEMU developers believe that the -code calling QEMU should be responsible for managing additional -processes. In OE-core, that would imply enhancing runqemu and -oeqa. This patch is a simpler solution. - -Because it is not going upstream, the patch was written so that it is -as simple as possible. - -Upstream-Status: Inappropriate [embedded specific] - -Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> - ---- - chardev/char-socket.c | 100 ++++++++++++++++++++++++++++++++++++++++++ - chardev/char.c | 3 ++ - qapi/char.json | 5 +++ - 3 files changed, 108 insertions(+) - -diff --git a/chardev/char-socket.c b/chardev/char-socket.c -index fab2d791d..c79641f24 100644 ---- a/chardev/char-socket.c -+++ b/chardev/char-socket.c -@@ -1315,6 +1315,67 @@ static bool qmp_chardev_validate_socket(ChardevSocket *sock, - return true; - } - -+#ifndef _WIN32 -+static void chardev_open_socket_cmd(Chardev *chr, -+ const char *cmd, -+ Error **errp) -+{ -+ int fds[2] = { -1, -1 }; -+ QIOChannelSocket *sioc = NULL; -+ pid_t pid = -1; -+ const char *argv[] = { "/bin/sh", "-c", cmd, NULL }; -+ -+ /* -+ * We need a Unix domain socket for commands like swtpm and a single -+ * connection, therefore we cannot use qio_channel_command_new_spawn() -+ * without patching it first. Duplicating the functionality is easier. -+ */ -+ if (socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0, fds)) { -+ error_setg_errno(errp, errno, "Error creating socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC)"); -+ goto error; -+ } -+ -+ pid = qemu_fork(errp); -+ if (pid < 0) { -+ goto error; -+ } -+ -+ if (!pid) { -+ /* child */ -+ dup2(fds[1], STDIN_FILENO); -+ execv(argv[0], (char * const *)argv); -+ _exit(1); -+ } -+ -+ /* -+ * Hand over our end of the socket pair to the qio channel. -+ * -+ * We don't reap the child because it is expected to keep -+ * running. We also don't support the "reconnect" option for the -+ * same reason. -+ */ -+ sioc = qio_channel_socket_new_fd(fds[0], errp); -+ if (!sioc) { -+ goto error; -+ } -+ fds[0] = -1; -+ -+ g_free(chr->filename); -+ chr->filename = g_strdup_printf("cmd:%s", cmd); -+ tcp_chr_new_client(chr, sioc); -+ -+ error: -+ if (fds[0] >= 0) { -+ close(fds[0]); -+ } -+ if (fds[1] >= 0) { -+ close(fds[1]); -+ } -+ if (sioc) { -+ object_unref(OBJECT(sioc)); -+ } -+} -+#endif - - static void qmp_chardev_open_socket(Chardev *chr, - ChardevBackend *backend, -@@ -1323,6 +1384,9 @@ static void qmp_chardev_open_socket(Chardev *chr, - { - SocketChardev *s = SOCKET_CHARDEV(chr); - ChardevSocket *sock = backend->u.socket.data; -+#ifndef _WIN32 -+ const char *cmd = sock->cmd; -+#endif - bool do_nodelay = sock->has_nodelay ? sock->nodelay : false; - bool is_listen = sock->has_server ? sock->server : true; - bool is_telnet = sock->has_telnet ? sock->telnet : false; -@@ -1393,6 +1457,14 @@ static void qmp_chardev_open_socket(Chardev *chr, - - update_disconnected_filename(s); - -+#ifndef _WIN32 -+ if (cmd) { -+ chardev_open_socket_cmd(chr, cmd, errp); -+ -+ /* everything ready (or failed permanently) before we return */ -+ *be_opened = true; -+ } else -+#endif - if (s->is_listen) { - if (qmp_chardev_open_socket_server(chr, is_telnet || is_tn3270, - is_waitconnect, errp) < 0) { -@@ -1412,6 +1484,9 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, - const char *host = qemu_opt_get(opts, "host"); - const char *port = qemu_opt_get(opts, "port"); - const char *fd = qemu_opt_get(opts, "fd"); -+#ifndef _WIN32 -+ const char *cmd = qemu_opt_get(opts, "cmd"); -+#endif - #ifdef CONFIG_LINUX - bool tight = qemu_opt_get_bool(opts, "tight", true); - bool abstract = qemu_opt_get_bool(opts, "abstract", false); -@@ -1419,6 +1494,20 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, - SocketAddressLegacy *addr; - ChardevSocket *sock; - -+#ifndef _WIN32 -+ if (cmd) { -+ /* -+ * Here we have to ensure that no options are set which are incompatible with -+ * spawning a command, otherwise unmodified code that doesn't know about -+ * command spawning (like socket_reconnect_timeout()) might get called. -+ */ -+ if (path || sock->server || sock->has_telnet || sock->has_tn3270 || sock->reconnect || host || port || sock->tls_creds) { -+ error_setg(errp, "chardev: socket: cmd does not support any additional options"); -+ return; -+ } -+ } else -+#endif -+ - if ((!!path + !!fd + !!host) > 1) { - error_setg(errp, - "None or one of 'path', 'fd' or 'host' option required."); -@@ -1469,13 +1558,24 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, - sock->tls_creds = g_strdup(qemu_opt_get(opts, "tls-creds")); - sock->has_tls_authz = qemu_opt_get(opts, "tls-authz"); - sock->tls_authz = g_strdup(qemu_opt_get(opts, "tls-authz")); -+#ifndef _WIN32 -+ sock->cmd = g_strdup(cmd); -+#endif - - addr = g_new0(SocketAddressLegacy, 1); -+#ifndef _WIN32 -+ if (path || cmd) { -+#else - if (path) { -+#endif - UnixSocketAddress *q_unix; - addr->type = SOCKET_ADDRESS_TYPE_UNIX; - q_unix = addr->u.q_unix.data = g_new0(UnixSocketAddress, 1); -+#ifndef _WIN32 -+ q_unix->path = cmd ? g_strdup_printf("cmd:%s", cmd) : g_strdup(path); -+#else - q_unix->path = g_strdup(path); -+#endif - #ifdef CONFIG_LINUX - q_unix->has_tight = true; - q_unix->tight = tight; -diff --git a/chardev/char.c b/chardev/char.c -index 0169d8dde..ce9a21f41 100644 ---- a/chardev/char.c -+++ b/chardev/char.c -@@ -835,6 +835,9 @@ QemuOptsList qemu_chardev_opts = { - },{ - .name = "path", - .type = QEMU_OPT_STRING, -+ },{ -+ .name = "cmd", -+ .type = QEMU_OPT_STRING, - },{ - .name = "host", - .type = QEMU_OPT_STRING, -diff --git a/qapi/char.json b/qapi/char.json -index 7b4215157..37feabdac 100644 ---- a/qapi/char.json -+++ b/qapi/char.json -@@ -250,6 +250,10 @@ - # - # @addr: socket address to listen on (server=true) - # or connect to (server=false) -+# @cmd: command to run via "sh -c" with stdin as one end of -+# a AF_UNIX SOCK_DSTREAM socket pair. The other end -+# is used by the chardev. Either an addr or a cmd can -+# be specified, but not both. - # @tls-creds: the ID of the TLS credentials object (since 2.6) - # @tls-authz: the ID of the QAuthZ authorization object against which - # the client's x509 distinguished name will be validated. This -@@ -276,6 +280,7 @@ - ## - { 'struct': 'ChardevSocket', - 'data': { 'addr': 'SocketAddressLegacy', -+ '*cmd': 'str', - '*tls-creds': 'str', - '*tls-authz' : 'str', - '*server': 'bool', --- -2.30.2 - diff --git a/meta/recipes-devtools/qemu/qemu/0004-configure-Add-pkg-config-handling-for-libgcrypt.patch b/meta/recipes-devtools/qemu/qemu/0003-configure-Add-pkg-config-handling-for-libgcrypt.patch index 6faebd4e09..30e269f8f4 100644 --- a/meta/recipes-devtools/qemu/qemu/0004-configure-Add-pkg-config-handling-for-libgcrypt.patch +++ b/meta/recipes-devtools/qemu/qemu/0003-configure-Add-pkg-config-handling-for-libgcrypt.patch @@ -1,7 +1,7 @@ -From d8265abdce5dc2bf74b3fccdf2b7257b4f3894f0 Mon Sep 17 00:00:00 2001 +From e4f6c6b9f43b28271bc9dc6cbcafad53f80387e0 Mon Sep 17 00:00:00 2001 From: He Zhe <zhe.he@windriver.com> Date: Wed, 28 Aug 2019 19:56:28 +0800 -Subject: [PATCH 04/12] configure: Add pkg-config handling for libgcrypt +Subject: [PATCH 03/11] configure: Add pkg-config handling for libgcrypt libgcrypt may also be controlled by pkg-config, this patch adds pkg-config handling for libgcrypt. @@ -9,24 +9,23 @@ handling for libgcrypt. Upstream-Status: Denied [https://lists.nongnu.org/archive/html/qemu-devel/2019-08/msg06333.html] Signed-off-by: He Zhe <zhe.he@windriver.com> - --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build -index 861de93c4..d45ff2d7c 100644 +index 91a0aa64c6..e8373d55b8 100644 --- a/meson.build +++ b/meson.build -@@ -1063,7 +1063,7 @@ endif +@@ -1655,7 +1655,7 @@ endif if not gnutls_crypto.found() if (not get_option('gcrypt').auto() or have_system) and not get_option('nettle').enabled() gcrypt = dependency('libgcrypt', version: '>=1.8', - method: 'config-tool', + method: 'pkg-config', - required: get_option('gcrypt'), - kwargs: static_kwargs) + required: get_option('gcrypt')) # Debian has removed -lgpg-error from libgcrypt-config + # as it "spreads unnecessary dependencies" which in -- -2.30.2 +2.44.0 diff --git a/meta/recipes-devtools/qemu/qemu/0005-qemu-Do-not-include-file-if-not-exists.patch b/meta/recipes-devtools/qemu/qemu/0004-qemu-Do-not-include-file-if-not-exists.patch index 3f3c39f996..d9cab428c4 100644 --- a/meta/recipes-devtools/qemu/qemu/0005-qemu-Do-not-include-file-if-not-exists.patch +++ b/meta/recipes-devtools/qemu/qemu/0004-qemu-Do-not-include-file-if-not-exists.patch @@ -1,7 +1,7 @@ -From f39e7bfc5ed07b5ecaeb705c4eae4855ca120d47 Mon Sep 17 00:00:00 2001 +From 5223d46a8d5302396f9fc7cc5d830769e87242fe Mon Sep 17 00:00:00 2001 From: Oleksiy Obitotskyy <oobitots@cisco.com> Date: Wed, 25 Mar 2020 21:21:35 +0200 -Subject: [PATCH 05/12] qemu: Do not include file if not exists +Subject: [PATCH 04/11] qemu: Do not include file if not exists Script configure checks for if_alg.h and check failed but if_alg.h still included. @@ -11,16 +11,15 @@ Signed-off-by: Oleksiy Obitotskyy <oobitots@cisco.com> [update patch context] Signed-off-by: Sakib Sajal <sakib.sajal@windriver.com> - --- linux-user/syscall.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c -index f65045efe..340e0c6f0 100644 +index 3df2b94d9a..18f09f1f07 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c -@@ -113,7 +113,9 @@ +@@ -116,7 +116,9 @@ #include <linux/blkpg.h> #include <netpacket/packet.h> #include <linux/netlink.h> @@ -31,5 +30,5 @@ index f65045efe..340e0c6f0 100644 #include <sound/asound.h> #ifdef HAVE_BTRFS_H -- -2.30.2 +2.44.0 diff --git a/meta/recipes-devtools/qemu/qemu/0006-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch b/meta/recipes-devtools/qemu/qemu/0005-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch index 75c0369318..3c7f5776ff 100644 --- a/meta/recipes-devtools/qemu/qemu/0006-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch +++ b/meta/recipes-devtools/qemu/qemu/0005-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch @@ -1,7 +1,7 @@ -From 375cae3dd6151ef33cae8f243f6a2c2da6c0c356 Mon Sep 17 00:00:00 2001 +From 1c295069857b9850f15f2cd6b33b133ea641a454 Mon Sep 17 00:00:00 2001 From: Richard Purdie <richard.purdie@linuxfoundation.org> Date: Fri, 8 Jan 2021 17:27:06 +0000 -Subject: [PATCH 06/12] qemu: Add some user space mmap tweaks to address musl +Subject: [PATCH 05/11] qemu: Add some user space mmap tweaks to address musl 32 bit When using qemu-i386 to build qemux86 webkitgtk on musl, it sits in an @@ -18,16 +18,15 @@ rather than ENOMEM so adjust the other part of the test to this. Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2021-01/msg01355.html] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org - --- linux-user/mmap.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c -index c125031b9..e651834a5 100644 +index be3b9a68eb..481286f01d 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c -@@ -749,12 +749,16 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, +@@ -1060,12 +1060,16 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, int prot; void *host_addr; @@ -48,5 +47,5 @@ index c125031b9..e651834a5 100644 } -- -2.30.2 +2.44.0 diff --git a/meta/recipes-devtools/qemu/qemu/0007-qemu-Determinism-fixes.patch b/meta/recipes-devtools/qemu/qemu/0006-qemu-Determinism-fixes.patch index 0d7dae3689..f07054f19a 100644 --- a/meta/recipes-devtools/qemu/qemu/0007-qemu-Determinism-fixes.patch +++ b/meta/recipes-devtools/qemu/qemu/0006-qemu-Determinism-fixes.patch @@ -1,7 +1,7 @@ -From 50bab5c2605b609ea7ea154f57a9be96d656725a Mon Sep 17 00:00:00 2001 +From 9d32df80e33a7541658858497f45bed1e59e3621 Mon Sep 17 00:00:00 2001 From: Richard Purdie <richard.purdie@linuxfoundation.org> Date: Mon, 1 Mar 2021 13:00:47 +0000 -Subject: [PATCH 07/12] qemu: Determinism fixes +Subject: [PATCH 06/11] qemu: Determinism fixes When sources are included within debug information, a couple of areas of the qemu build are not reproducible due to either full buildpaths or timestamps. @@ -11,16 +11,15 @@ meson to pass relative paths but we can fix that in the script. Upstream-Status: Pending [some version of all/part of this may be accepted] RP 2021/3/1 - --- scripts/decodetree.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/decodetree.py b/scripts/decodetree.py -index a03dc6b5e..4ea24c1f3 100644 +index e8b72da3a9..5cd86b1428 100644 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py -@@ -1328,7 +1328,7 @@ def main(): +@@ -1558,7 +1558,7 @@ def main(): toppat = ExcMultiPattern(0) for filename in args: @@ -30,5 +29,5 @@ index a03dc6b5e..4ea24c1f3 100644 parse_file(f, toppat) f.close() -- -2.30.2 +2.44.0 diff --git a/meta/recipes-devtools/qemu/qemu/0008-tests-meson.build-use-relative-path-to-refer-to-file.patch b/meta/recipes-devtools/qemu/qemu/0007-tests-meson.build-use-relative-path-to-refer-to-file.patch index 43d3c7cf1f..74de158b2e 100644 --- a/meta/recipes-devtools/qemu/qemu/0008-tests-meson.build-use-relative-path-to-refer-to-file.patch +++ b/meta/recipes-devtools/qemu/qemu/0007-tests-meson.build-use-relative-path-to-refer-to-file.patch @@ -1,7 +1,7 @@ -From 2bf9388b801d4389e2d57e95a7897bfc1c42786e Mon Sep 17 00:00:00 2001 +From 77ebf67d0c96f51da91c8499200ebd13f4dcdd68 Mon Sep 17 00:00:00 2001 From: Changqing Li <changqing.li@windriver.com> Date: Thu, 14 Jan 2021 06:33:04 +0000 -Subject: [PATCH 08/12] tests/meson.build: use relative path to refer to files +Subject: [PATCH 07/11] tests/meson.build: use relative path to refer to files Fix error like: Fatal error: can't create tests/ptimer-test.p/..._qemu-5.2.0_hw_core_ptimer.c.o: File name too long @@ -12,27 +12,32 @@ filename too long. Fixed by using relative path to refer to files Upstream-Status: Submitted [send to qemu-devel] Signed-off-by: Changqing Li <changqing.li@windriver.com> - --- tests/unit/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/meson.build b/tests/unit/meson.build -index 96b295263..e4c3246dc 100644 +index 228a21d03c..272fb4c6ca 100644 --- a/tests/unit/meson.build +++ b/tests/unit/meson.build -@@ -44,9 +44,9 @@ tests = { +@@ -47,7 +47,7 @@ tests = { 'test-keyval': [testqapi], 'test-logging': [], 'test-uuid': [], - 'ptimer-test': ['ptimer-test-stubs.c', meson.project_source_root() / 'hw/core/ptimer.c'], + 'ptimer-test': ['ptimer-test-stubs.c', '../../hw/core/ptimer.c'], 'test-qapi-util': [], -- 'test-smp-parse': [qom, meson.project_source_root() / 'hw/core/machine-smp.c'], -+ 'test-smp-parse': [qom, '../../hw/core/machine-smp.c'], - } - - if have_system or have_tools + 'test-interval-tree': [], + 'test-xs-node': [qom], +@@ -138,7 +138,7 @@ if have_system + 'test-util-sockets': ['socket-helpers.c'], + 'test-base64': [], + 'test-bufferiszero': [], +- 'test-smp-parse': [qom, meson.project_source_root() / 'hw/core/machine-smp.c'], ++ 'test-smp-parse': [qom, '../../hw/core/machine-smp.c'], + 'test-vmstate': [migration, io], + 'test-yank': ['socket-helpers.c', qom, io, chardev] + } -- -2.30.2 +2.44.0 diff --git a/meta/recipes-devtools/qemu/qemu/0009-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch b/meta/recipes-devtools/qemu/qemu/0008-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch index 23d0a69802..2e28590e11 100644 --- a/meta/recipes-devtools/qemu/qemu/0009-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch +++ b/meta/recipes-devtools/qemu/qemu/0008-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch @@ -1,7 +1,7 @@ -From ebf4bb2f51da83af0c61480414cfa156f7308b34 Mon Sep 17 00:00:00 2001 +From 21b159a11bbcb1eeb26f12456e4c3fd62a06cbec Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Mon, 21 Mar 2022 10:09:38 -0700 -Subject: [PATCH 09/12] Define MAP_SYNC and MAP_SHARED_VALIDATE on needed linux +Subject: [PATCH 08/11] Define MAP_SYNC and MAP_SHARED_VALIDATE on needed linux systems linux only wires MAP_SYNC and MAP_SHARED_VALIDATE for architectures @@ -13,13 +13,12 @@ Upstream-Status: Submitted [https://lists.nongnu.org/archive/html/qemu-devel/202 Signed-off-by: Khem Raj <raj.khem@gmail.com> Cc: Zhang Yi <yi.z.zhang@linux.intel.com> Cc: Michael S. Tsirkin <mst@redhat.com> - --- util/mmap-alloc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c -index 893d86435..86d3cda24 100644 +index ed14f9c64d..038f5b4b55 100644 --- a/util/mmap-alloc.c +++ b/util/mmap-alloc.c @@ -10,14 +10,18 @@ @@ -45,5 +44,5 @@ index 893d86435..86d3cda24 100644 #include "qemu/host-utils.h" #include "qemu/cutils.h" -- -2.30.2 +2.44.0 diff --git a/meta/recipes-devtools/qemu/qemu/0009-linux-user-Replace-use-of-lfs64-related-functions-an.patch b/meta/recipes-devtools/qemu/qemu/0009-linux-user-Replace-use-of-lfs64-related-functions-an.patch new file mode 100644 index 0000000000..7577249d39 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/0009-linux-user-Replace-use-of-lfs64-related-functions-an.patch @@ -0,0 +1,358 @@ +From 23de30079dbf47a8026faddd550a9e181d609c8f Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Sat, 17 Dec 2022 08:37:46 -0800 +Subject: [PATCH 09/11] linux-user: Replace use of lfs64 related functions and + macros + +Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions +anf macros behave same as their 64 suffixed counterparts. This also +helps in compiling with latest musl C library, where these macros and +functions are no more available under _GNU_SOURCE feature macro + +Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2022-12/msg02841.html] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +Cc: Laurent Vivier <laurent@vivier.eu> +--- + linux-user/syscall.c | 153 +++++++++++-------------------------------- + 1 file changed, 39 insertions(+), 114 deletions(-) + +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index 18f09f1f07..1b7c50a2a7 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -761,8 +761,8 @@ safe_syscall6(ssize_t, copy_file_range, int, infd, loff_t *, pinoff, + */ + #define safe_ioctl(...) safe_syscall(__NR_ioctl, __VA_ARGS__) + /* Similarly for fcntl. Note that callers must always: +- * pass the F_GETLK64 etc constants rather than the unsuffixed F_GETLK +- * use the flock64 struct rather than unsuffixed flock ++ * pass the F_GETLK etc constants rather than the unsuffixed F_GETLK ++ * use the flock struct rather than unsuffixed flock + * This will then work and use a 64-bit offset for both 32-bit and 64-bit hosts. + */ + #ifdef __NR_fcntl64 +@@ -6739,13 +6739,13 @@ static int target_to_host_fcntl_cmd(int cmd) + ret = cmd; + break; + case TARGET_F_GETLK: +- ret = F_GETLK64; ++ ret = F_GETLK; + break; + case TARGET_F_SETLK: +- ret = F_SETLK64; ++ ret = F_SETLK; + break; + case TARGET_F_SETLKW: +- ret = F_SETLKW64; ++ ret = F_SETLKW; + break; + case TARGET_F_GETOWN: + ret = F_GETOWN; +@@ -6759,17 +6759,6 @@ static int target_to_host_fcntl_cmd(int cmd) + case TARGET_F_SETSIG: + ret = F_SETSIG; + break; +-#if TARGET_ABI_BITS == 32 +- case TARGET_F_GETLK64: +- ret = F_GETLK64; +- break; +- case TARGET_F_SETLK64: +- ret = F_SETLK64; +- break; +- case TARGET_F_SETLKW64: +- ret = F_SETLKW64; +- break; +-#endif + case TARGET_F_SETLEASE: + ret = F_SETLEASE; + break; +@@ -6821,8 +6810,8 @@ static int target_to_host_fcntl_cmd(int cmd) + * them to 5, 6 and 7 before making the syscall(). Since we make the + * syscall directly, adjust to what is supported by the kernel. + */ +- if (ret >= F_GETLK64 && ret <= F_SETLKW64) { +- ret -= F_GETLK64 - 5; ++ if (ret >= F_GETLK && ret <= F_SETLKW) { ++ ret -= F_GETLK - 5; + } + #endif + +@@ -6855,55 +6844,11 @@ static int host_to_target_flock(int type) + return type; + } + +-static inline abi_long copy_from_user_flock(struct flock64 *fl, +- abi_ulong target_flock_addr) +-{ +- struct target_flock *target_fl; +- int l_type; +- +- if (!lock_user_struct(VERIFY_READ, target_fl, target_flock_addr, 1)) { +- return -TARGET_EFAULT; +- } +- +- __get_user(l_type, &target_fl->l_type); +- l_type = target_to_host_flock(l_type); +- if (l_type < 0) { +- return l_type; +- } +- fl->l_type = l_type; +- __get_user(fl->l_whence, &target_fl->l_whence); +- __get_user(fl->l_start, &target_fl->l_start); +- __get_user(fl->l_len, &target_fl->l_len); +- __get_user(fl->l_pid, &target_fl->l_pid); +- unlock_user_struct(target_fl, target_flock_addr, 0); +- return 0; +-} +- +-static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr, +- const struct flock64 *fl) +-{ +- struct target_flock *target_fl; +- short l_type; +- +- if (!lock_user_struct(VERIFY_WRITE, target_fl, target_flock_addr, 0)) { +- return -TARGET_EFAULT; +- } +- +- l_type = host_to_target_flock(fl->l_type); +- __put_user(l_type, &target_fl->l_type); +- __put_user(fl->l_whence, &target_fl->l_whence); +- __put_user(fl->l_start, &target_fl->l_start); +- __put_user(fl->l_len, &target_fl->l_len); +- __put_user(fl->l_pid, &target_fl->l_pid); +- unlock_user_struct(target_fl, target_flock_addr, 1); +- return 0; +-} +- +-typedef abi_long from_flock64_fn(struct flock64 *fl, abi_ulong target_addr); +-typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock64 *fl); ++typedef abi_long from_flock_fn(struct flock *fl, abi_ulong target_addr); ++typedef abi_long to_flock_fn(abi_ulong target_addr, const struct flock *fl); + + #if defined(TARGET_ARM) && TARGET_ABI_BITS == 32 +-struct target_oabi_flock64 { ++struct target_oabi_flock { + abi_short l_type; + abi_short l_whence; + abi_llong l_start; +@@ -6911,10 +6856,10 @@ struct target_oabi_flock64 { + abi_int l_pid; + } QEMU_PACKED; + +-static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl, ++static inline abi_long copy_from_user_oabi_flock(struct flock *fl, + abi_ulong target_flock_addr) + { +- struct target_oabi_flock64 *target_fl; ++ struct target_oabi_flock *target_fl; + int l_type; + + if (!lock_user_struct(VERIFY_READ, target_fl, target_flock_addr, 1)) { +@@ -6935,10 +6880,10 @@ static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl, + return 0; + } + +-static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr, +- const struct flock64 *fl) ++static inline abi_long copy_to_user_oabi_flock(abi_ulong target_flock_addr, ++ const struct flock *fl) + { +- struct target_oabi_flock64 *target_fl; ++ struct target_oabi_flock *target_fl; + short l_type; + + if (!lock_user_struct(VERIFY_WRITE, target_fl, target_flock_addr, 0)) { +@@ -6956,10 +6901,10 @@ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr, + } + #endif + +-static inline abi_long copy_from_user_flock64(struct flock64 *fl, ++static inline abi_long copy_from_user_flock(struct flock *fl, + abi_ulong target_flock_addr) + { +- struct target_flock64 *target_fl; ++ struct target_flock *target_fl; + int l_type; + + if (!lock_user_struct(VERIFY_READ, target_fl, target_flock_addr, 1)) { +@@ -6980,10 +6925,10 @@ static inline abi_long copy_from_user_flock64(struct flock64 *fl, + return 0; + } + +-static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr, +- const struct flock64 *fl) ++static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr, ++ const struct flock *fl) + { +- struct target_flock64 *target_fl; ++ struct target_flock *target_fl; + short l_type; + + if (!lock_user_struct(VERIFY_WRITE, target_fl, target_flock_addr, 0)) { +@@ -7002,7 +6947,7 @@ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr, + + static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) + { +- struct flock64 fl64; ++ struct flock fl64; + #ifdef F_GETOWN_EX + struct f_owner_ex fox; + struct target_f_owner_ex *target_fox; +@@ -7015,6 +6960,7 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) + + switch(cmd) { + case TARGET_F_GETLK: ++ case TARGET_F_OFD_GETLK: + ret = copy_from_user_flock(&fl64, arg); + if (ret) { + return ret; +@@ -7024,32 +6970,11 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) + ret = copy_to_user_flock(arg, &fl64); + } + break; +- + case TARGET_F_SETLK: + case TARGET_F_SETLKW: +- ret = copy_from_user_flock(&fl64, arg); +- if (ret) { +- return ret; +- } +- ret = get_errno(safe_fcntl(fd, host_cmd, &fl64)); +- break; +- +- case TARGET_F_GETLK64: +- case TARGET_F_OFD_GETLK: +- ret = copy_from_user_flock64(&fl64, arg); +- if (ret) { +- return ret; +- } +- ret = get_errno(safe_fcntl(fd, host_cmd, &fl64)); +- if (ret == 0) { +- ret = copy_to_user_flock64(arg, &fl64); +- } +- break; +- case TARGET_F_SETLK64: +- case TARGET_F_SETLKW64: + case TARGET_F_OFD_SETLK: + case TARGET_F_OFD_SETLKW: +- ret = copy_from_user_flock64(&fl64, arg); ++ ret = copy_from_user_flock(&fl64, arg); + if (ret) { + return ret; + } +@@ -7278,7 +7203,7 @@ static inline abi_long target_truncate64(CPUArchState *cpu_env, const char *arg1 + arg2 = arg3; + arg3 = arg4; + } +- return get_errno(truncate64(arg1, target_offset64(arg2, arg3))); ++ return get_errno(truncate(arg1, target_offset64(arg2, arg3))); + } + #endif + +@@ -7292,7 +7217,7 @@ static inline abi_long target_ftruncate64(CPUArchState *cpu_env, abi_long arg1, + arg2 = arg3; + arg3 = arg4; + } +- return get_errno(ftruncate64(arg1, target_offset64(arg2, arg3))); ++ return get_errno(ftruncate(arg1, target_offset64(arg2, arg3))); + } + #endif + +@@ -8667,7 +8592,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count) + void *tdirp; + int hlen, hoff, toff; + int hreclen, treclen; +- off64_t prev_diroff = 0; ++ off_t prev_diroff = 0; + + hdirp = g_try_malloc(count); + if (!hdirp) { +@@ -8720,7 +8645,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count) + * Return what we have, resetting the file pointer to the + * location of the first record not returned. + */ +- lseek64(dirfd, prev_diroff, SEEK_SET); ++ lseek(dirfd, prev_diroff, SEEK_SET); + break; + } + +@@ -8754,7 +8679,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count) + void *tdirp; + int hlen, hoff, toff; + int hreclen, treclen; +- off64_t prev_diroff = 0; ++ off_t prev_diroff = 0; + + hdirp = g_try_malloc(count); + if (!hdirp) { +@@ -8796,7 +8721,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count) + * Return what we have, resetting the file pointer to the + * location of the first record not returned. + */ +- lseek64(dirfd, prev_diroff, SEEK_SET); ++ lseek(dirfd, prev_diroff, SEEK_SET); + break; + } + +@@ -11527,7 +11452,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, + return -TARGET_EFAULT; + } + } +- ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5))); ++ ret = get_errno(pread(arg1, p, arg3, target_offset64(arg4, arg5))); + unlock_user(p, arg2, ret); + return ret; + case TARGET_NR_pwrite64: +@@ -11544,7 +11469,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, + return -TARGET_EFAULT; + } + } +- ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5))); ++ ret = get_errno(pwrite(arg1, p, arg3, target_offset64(arg4, arg5))); + unlock_user(p, arg2, 0); + return ret; + #endif +@@ -12404,14 +12329,14 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, + case TARGET_NR_fcntl64: + { + int cmd; +- struct flock64 fl; +- from_flock64_fn *copyfrom = copy_from_user_flock64; +- to_flock64_fn *copyto = copy_to_user_flock64; ++ struct flock fl; ++ from_flock_fn *copyfrom = copy_from_user_flock; ++ to_flock_fn *copyto = copy_to_user_flock; + + #ifdef TARGET_ARM + if (!cpu_env->eabi) { +- copyfrom = copy_from_user_oabi_flock64; +- copyto = copy_to_user_oabi_flock64; ++ copyfrom = copy_from_user_oabi_flock; ++ copyto = copy_to_user_oabi_flock; + } + #endif + +@@ -12421,7 +12346,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, + } + + switch(arg2) { +- case TARGET_F_GETLK64: ++ case TARGET_F_GETLK: + ret = copyfrom(&fl, arg3); + if (ret) { + break; +@@ -12432,8 +12357,8 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, + } + break; + +- case TARGET_F_SETLK64: +- case TARGET_F_SETLKW64: ++ case TARGET_F_SETLK: ++ case TARGET_F_SETLKW: + ret = copyfrom(&fl, arg3); + if (ret) { + break; +-- +2.44.0 + diff --git a/meta/recipes-devtools/qemu/qemu/0010-configure-lookup-meson-exutable-from-PATH.patch b/meta/recipes-devtools/qemu/qemu/0010-configure-lookup-meson-exutable-from-PATH.patch new file mode 100644 index 0000000000..98ce85a8cf --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/0010-configure-lookup-meson-exutable-from-PATH.patch @@ -0,0 +1,31 @@ +From e12a93174f9b652604dda8d8464b9559b62b29d5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= <martin@geanix.com> +Date: Wed, 22 May 2024 14:02:55 +0200 +Subject: [PATCH 10/11] configure: lookup meson exutable from PATH + +Upstream-Status: Inappropriate [workaround, would need a real fix for upstream] +--- + configure | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/configure b/configure +index 3cd736b139..482a1f8ef3 100755 +--- a/configure ++++ b/configure +@@ -956,12 +956,7 @@ fi + $mkvenv ensuregroup --dir "${source_path}/python/wheels" \ + ${source_path}/pythondeps.toml meson || exit 1 + +-# At this point, we expect Meson to be installed and available. +-# We expect mkvenv or pip to have created pyvenv/bin/meson for us. +-# We ignore PATH completely here: we want to use the venv's Meson +-# *exclusively*. +- +-meson="$(cd pyvenv/bin; pwd)/meson" ++meson=`which meson` + + # Conditionally ensure Sphinx is installed. + +-- +2.44.0 + diff --git a/meta/recipes-devtools/qemu/qemu/0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch b/meta/recipes-devtools/qemu/qemu/0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch deleted file mode 100644 index 826d42fc20..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 52c38fa9f3a790a7c2805e7d8cce3ea9262d6ae2 Mon Sep 17 00:00:00 2001 -From: Yuval Shaia <yuval.shaia.ml@gmail.com> -Date: Tue, 12 Apr 2022 11:01:51 +0100 -Subject: [PATCH 10/12] hw/pvrdma: Protect against buggy or malicious guest - driver - -Guest driver might execute HW commands when shared buffers are not yet -allocated. -This might happen on purpose (malicious guest) or because some other -guest/host address mapping. -We need to protect againts such case. - -Reported-by: Mauro Matteo Cascella <mcascell@redhat.com> -Signed-off-by: Yuval Shaia <yuval.shaia.ml@gmail.com> - -CVE: CVE-2022-1050 -Upstream-Status: Submitted [https://lists.nongnu.org/archive/html/qemu-devel/2022-03/msg05197.html] - ---- - hw/rdma/vmw/pvrdma_cmd.c | 6 ++++++ - hw/rdma/vmw/pvrdma_main.c | 3 ++- - 2 files changed, 8 insertions(+), 1 deletion(-) - -diff --git a/hw/rdma/vmw/pvrdma_cmd.c b/hw/rdma/vmw/pvrdma_cmd.c -index da7ddfa54..89db963c4 100644 ---- a/hw/rdma/vmw/pvrdma_cmd.c -+++ b/hw/rdma/vmw/pvrdma_cmd.c -@@ -796,6 +796,12 @@ int pvrdma_exec_cmd(PVRDMADev *dev) - - dsr_info = &dev->dsr_info; - -+ if (!dsr_info->dsr) { -+ /* Buggy or malicious guest driver */ -+ rdma_error_report("Exec command without dsr, req or rsp buffers"); -+ goto out; -+ } -+ - if (dsr_info->req->hdr.cmd >= sizeof(cmd_handlers) / - sizeof(struct cmd_handler)) { - rdma_error_report("Unsupported command"); -diff --git a/hw/rdma/vmw/pvrdma_main.c b/hw/rdma/vmw/pvrdma_main.c -index 91206dbb8..0b7d908e2 100644 ---- a/hw/rdma/vmw/pvrdma_main.c -+++ b/hw/rdma/vmw/pvrdma_main.c -@@ -249,7 +249,8 @@ static void init_dsr_dev_caps(PVRDMADev *dev) - { - struct pvrdma_device_shared_region *dsr; - -- if (dev->dsr_info.dsr == NULL) { -+ if (!dev->dsr_info.dsr) { -+ /* Buggy or malicious guest driver */ - rdma_error_report("Can't initialized DSR"); - return; - } --- -2.30.2 - diff --git a/meta/recipes-devtools/qemu/qemu/0011-qemu-Ensure-pip-and-the-python-venv-aren-t-used-for-.patch b/meta/recipes-devtools/qemu/qemu/0011-qemu-Ensure-pip-and-the-python-venv-aren-t-used-for-.patch new file mode 100644 index 0000000000..c7bb9b1b47 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/0011-qemu-Ensure-pip-and-the-python-venv-aren-t-used-for-.patch @@ -0,0 +1,55 @@ +From a93c2a6b2c9db9c4bd30298da43c37c5e5c6236e Mon Sep 17 00:00:00 2001 +From: Richard Purdie <richard.purdie@linuxfoundation.org> +Date: Wed, 22 May 2024 13:58:23 +0200 +Subject: [PATCH 11/11] qemu: Ensure pip and the python venv aren't used for + meson + +Qemu wants to use a supported python version and a specific meson version +to "help" users and uses pip and creates a venv to do this. This is a nightmare +for us. Our versions stay up to date and should be supported so we don't +really need/want this wrapping. Tweak things to disable it. + +There was breakage from the wrapper shown by: + +bitbake qemu-system-native +<add DISTRO_FEATURES:remove = "opengl" to local.conf> +bitbake qemu-system-native -c configure + +which would crash. The issue is the change in configuration removes pieces +from the sysroot but pyc files remainm as do pieces of pip which causes +problems. + +Ideally we'd convince upstream to allow some way to disable the venv on +the understanding that if/when it breaks, we keep the pieces. The patch +as it stands is a workaround. + +Upstream-Status: Inappropriate [oe specific] +Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> +--- + configure | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/configure b/configure +index 482a1f8ef3..0da4bf3e4d 100755 +--- a/configure ++++ b/configure +@@ -938,14 +938,14 @@ python="$(command -v "$python")" + echo "python determined to be '$python'" + echo "python version: $($python --version)" + +-python="$($python -B "${source_path}/python/scripts/mkvenv.py" create pyvenv)" ++python=python3 + if test "$?" -ne 0 ; then + error_exit "python venv creation failed" + fi + + # Suppress writing compiled files + python="$python -B" +-mkvenv="$python ${source_path}/python/scripts/mkvenv.py" ++mkvenv=true + + # Finish preparing the virtual environment using vendored .whl files + +-- +2.44.0 + diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2022-35414.patch b/meta/recipes-devtools/qemu/qemu/CVE-2022-35414.patch deleted file mode 100644 index fe79a749ae..0000000000 --- a/meta/recipes-devtools/qemu/qemu/CVE-2022-35414.patch +++ /dev/null @@ -1,53 +0,0 @@ -From a10c33942dc8cb31b3762b9dd4adde4c490eed9c Mon Sep 17 00:00:00 2001 -From: Hitendra Prajapati <hprajapati@mvista.com> -Date: Wed, 3 Aug 2022 10:11:11 +0530 -Subject: [PATCH] CVE-2022-35414 - -Upstream-Status: Backport [https://github.com/qemu/qemu/commit/418ade7849ce7641c0f7333718caf5091a02fd4c] -CVE: CVE-2022-35414 -Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com> ---- - softmmu/physmem.c | 13 ++++++++++++- - 1 file changed, 12 insertions(+), 1 deletion(-) - -diff --git a/softmmu/physmem.c b/softmmu/physmem.c -index 4e1b27a20..ad8a90dec 100644 ---- a/softmmu/physmem.c -+++ b/softmmu/physmem.c -@@ -669,7 +669,7 @@ void tcg_iommu_init_notifier_list(CPUState *cpu) - - /* Called from RCU critical section */ - MemoryRegionSection * --address_space_translate_for_iotlb(CPUState *cpu, int asidx, hwaddr addr, -+address_space_translate_for_iotlb(CPUState *cpu, int asidx, hwaddr orig_addr, - hwaddr *xlat, hwaddr *plen, - MemTxAttrs attrs, int *prot) - { -@@ -678,6 +678,7 @@ address_space_translate_for_iotlb(CPUState *cpu, int asidx, hwaddr addr, - IOMMUMemoryRegionClass *imrc; - IOMMUTLBEntry iotlb; - int iommu_idx; -+ hwaddr addr = orig_addr; - AddressSpaceDispatch *d = - qatomic_rcu_read(&cpu->cpu_ases[asidx].memory_dispatch); - -@@ -722,6 +723,16 @@ address_space_translate_for_iotlb(CPUState *cpu, int asidx, hwaddr addr, - return section; - - translate_fail: -+ /* -+ * We should be given a page-aligned address -- certainly -+ * tlb_set_page_with_attrs() does so. The page offset of xlat -+ * is used to index sections[], and PHYS_SECTION_UNASSIGNED = 0. -+ * The page portion of xlat will be logged by memory_region_access_valid() -+ * when this memory access is rejected, so use the original untranslated -+ * physical address. -+ */ -+ assert((orig_addr & ~TARGET_PAGE_MASK) == 0); -+ *xlat = orig_addr; - return &d->map.sections[PHYS_SECTION_UNASSIGNED]; - } - --- -2.25.1 - diff --git a/meta/recipes-devtools/qemu/qemu/cross.patch b/meta/recipes-devtools/qemu/qemu/cross.patch deleted file mode 100644 index d1256a1229..0000000000 --- a/meta/recipes-devtools/qemu/qemu/cross.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 76c3fc4c87231bed32974ebbbdb5079cff45a6b7 Mon Sep 17 00:00:00 2001 -From: Richard Purdie <richard.purdie@linuxfoundation.org> -Date: Tue, 5 Jan 2021 23:00:14 +0000 -Subject: [PATCH 12/12] qemu: Upgrade 5.1.0->5.2.0 - -We need to be able to trigger configure's cross code but we don't want -to set cross_prefix as it does other things we don't want. Patch things -so we can do what we need in the target config case. - -Upstream-Status: Inappropriate [may be rewritten in a way upstream may accept?] -Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> - ---- - configure | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/configure b/configure -index 7c08c1835..0613279f9 100755 ---- a/configure -+++ b/configure -@@ -3118,7 +3118,6 @@ if test "$skip_meson" = no; then - fi - echo "strip = [$(meson_quote $strip)]" >> $cross - echo "windres = [$(meson_quote $windres)]" >> $cross -- if test "$cross_compile" = "yes"; then - cross_arg="--cross-file config-meson.cross" - echo "[host_machine]" >> $cross - echo "system = '$targetos'" >> $cross -@@ -3136,9 +3135,6 @@ if test "$skip_meson" = no; then - else - echo "endian = 'little'" >> $cross - fi -- else -- cross_arg="--native-file config-meson.cross" -- fi - mv $cross config-meson.cross - - rm -rf meson-private meson-info meson-logs --- -2.30.2 - diff --git a/meta/recipes-devtools/qemu/qemu/qemu-7.0.0-glibc-2.36.patch b/meta/recipes-devtools/qemu/qemu/qemu-7.0.0-glibc-2.36.patch deleted file mode 100644 index abad1cfeeb..0000000000 --- a/meta/recipes-devtools/qemu/qemu/qemu-7.0.0-glibc-2.36.patch +++ /dev/null @@ -1,46 +0,0 @@ -Avoid conflicts between sys/mount.h and linux/mount.h that are seen -with glibc 2.36 - -Source: https://github.com/archlinux/svntogit-packages/blob/packages/qemu/trunk/qemu-7.0.0-glibc-2.36.patch - -Upstream-Status: Pending -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- a/linux-user/syscall.c -+++ b/linux-user/syscall.c -@@ -95,7 +95,25 @@ - #include <linux/soundcard.h> - #include <linux/kd.h> - #include <linux/mtio.h> -+ -+#ifdef HAVE_SYS_MOUNT_FSCONFIG -+/* -+ * glibc >= 2.36 linux/mount.h conflicts with sys/mount.h, -+ * which in turn prevents use of linux/fs.h. So we have to -+ * define the constants ourselves for now. -+ */ -+#define FS_IOC_GETFLAGS _IOR('f', 1, long) -+#define FS_IOC_SETFLAGS _IOW('f', 2, long) -+#define FS_IOC_GETVERSION _IOR('v', 1, long) -+#define FS_IOC_SETVERSION _IOW('v', 2, long) -+#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap) -+#define FS_IOC32_GETFLAGS _IOR('f', 1, int) -+#define FS_IOC32_SETFLAGS _IOW('f', 2, int) -+#define FS_IOC32_GETVERSION _IOR('v', 1, int) -+#define FS_IOC32_SETVERSION _IOW('v', 2, int) -+#else - #include <linux/fs.h> -+#endif - #include <linux/fd.h> - #if defined(CONFIG_FIEMAP) - #include <linux/fiemap.h> ---- a/meson.build -+++ b/meson.build -@@ -1686,6 +1686,8 @@ config_host_data.set('HAVE_OPTRESET', - cc.has_header_symbol('getopt.h', 'optreset')) - config_host_data.set('HAVE_IPPROTO_MPTCP', - cc.has_header_symbol('netinet/in.h', 'IPPROTO_MPTCP')) -+config_host_data.set('HAVE_SYS_MOUNT_FSCONFIG', -+ cc.has_header_symbol('sys/mount.h', 'FSCONFIG_SET_FLAG')) - - # has_member - config_host_data.set('HAVE_SIGEV_NOTIFY_THREAD_ID', diff --git a/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init b/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init new file mode 100644 index 0000000000..5ebaaddeae --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init @@ -0,0 +1,75 @@ +# SPDX-License-Identifier: GPL-2.0-only +# Initially written by: Michael Tokarev <mjt@tls.msk.ru> +# For QEMU Debian downstream package + +set -e + +. /etc/init.d/functions + +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="QEMU Guest Agent" +NAME=qemu-ga +DAEMON=@bindir@/$NAME +PIDFILE=/var/run/$NAME.pid + +# config +DAEMON_ARGS="" +# default transport +TRANSPORT=virtio-serial:/dev/virtio-ports/org.qemu.guest_agent.0 +NO_START=0 + +test ! -r /etc/default/qemu-guest-agent || . /etc/default/qemu-guest-agent +test "$NO_START" = "0" || exit 0 +test -x "$DAEMON" || exit 0 + +# +# Function that checks whenever system has necessary environment +# It also splits $TRANSPORT into $method and $path +# +do_check_transport() { + method=${TRANSPORT%%:*}; + path=${TRANSPORT#*:} + case "$method" in + virtio-serial | isa-serial) + if [ ! -e "$path" ]; then + echo "$NAME: transport endpoint not found, not starting" + return 1 + fi + ;; + esac +} + +case "$1" in + start) + do_check_transport || exit 0 + echo -n "Starting $DESC: " + start-stop-daemon -S -p $PIDFILE -x "$DAEMON" -- \ + $DAEMON_ARGS -d -m "$method" -p "$path" + echo "$NAME." + ;; + stop) + echo -n "Stopping $DESC: " + start-stop-daemon -K -x "$DAEMON" -p $PIDFILE + echo "$NAME." + ;; + status) + status "$DAEMON" + exit $? + ;; + restart|force-reload) + do_check_transport || exit 0 + echo -n "Restarting $DESC: " + start-stop-daemon -K -x "$DAEMON" -p $PIDFILE + sleep 1 + start-stop-daemon -S -p $PIDFILE -x "$DAEMON" -- \ + $DAEMON_ARGS -d -m "$method" -p "$path" + echo "$NAME." + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|status|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.udev b/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.udev new file mode 100644 index 0000000000..47097057e3 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.udev @@ -0,0 +1,2 @@ +SUBSYSTEM=="virtio-ports", ATTR{name}=="org.qemu.guest_agent.0", \ + TAG+="systemd", ENV{SYSTEMD_WANTS}="qemu-guest-agent.service" diff --git a/meta/recipes-devtools/qemu/qemu_7.0.0.bb b/meta/recipes-devtools/qemu/qemu_9.0.0.bb index 42e133967e..dc1352232e 100644 --- a/meta/recipes-devtools/qemu/qemu_7.0.0.bb +++ b/meta/recipes-devtools/qemu/qemu_9.0.0.bb @@ -2,13 +2,13 @@ BBCLASSEXTEND = "nativesdk" require qemu.inc -DEPENDS = "glib-2.0 zlib pixman bison-native ninja-native meson-native" +DEPENDS += "glib-2.0 zlib pixman" DEPENDS:append:libc-musl = " libucontext" CFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '', '-DEGL_NO_X11=1', d)}" -RDEPENDS:${PN}:class-target += "bash" +RDEPENDS:${PN}-common:class-target += "bash" EXTRA_OECONF:append:class-target = " --target-list=${@get_qemu_target_list(d)}" EXTRA_OECONF:append:class-target:mipsarcho32 = "${@bb.utils.contains('BBEXTENDCURR', 'multilib', ' --disable-capstone', '', d)}" @@ -16,7 +16,7 @@ EXTRA_OECONF:append:class-nativesdk = " --target-list=${@get_qemu_target_list(d) PACKAGECONFIG ??= " \ fdt sdl kvm pie slirp \ - ${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \ + ${@bb.utils.filter('DISTRO_FEATURES', 'alsa pulseaudio xen', d)} \ ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'virglrenderer epoxy', '', d)} \ ${@bb.utils.filter('DISTRO_FEATURES', 'seccomp', d)} \ " diff --git a/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb b/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb index 97b44ad2e5..6d0e7883ad 100644 --- a/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb +++ b/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb @@ -2,7 +2,8 @@ SUMMARY = "QEMU wrapper script" HOMEPAGE = "http://qemu.org" LICENSE = "MIT" -S = "${WORKDIR}" +S = "${WORKDIR}/sources" +UNPACKDIR = "${S}" DEPENDS += "qemu-native" |