aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Hughes <davidhughes205@gmail.com>2021-03-13 02:06:22 -0500
committerSam James <sam@gentoo.org>2021-03-13 21:02:39 +0000
commit2236edd2e6ce716eed195228db35047f5c7dd3d8 (patch)
tree78e5ed87b33bbe416664f94b4bf701b9cb5b7c22 /app-emulation
parentnet-firewall/ebtables: remove from overlay (diff)
downloadmusl-2236edd2e6ce716eed195228db35047f5c7dd3d8.tar.gz
musl-2236edd2e6ce716eed195228db35047f5c7dd3d8.tar.bz2
musl-2236edd2e6ce716eed195228db35047f5c7dd3d8.zip
app-emulation/qemu: sync with ::gentoo
Package-Manager: Portage-3.0.17, Repoman-3.0.2 Manifest-Sign-Key: 0xA1919C830E9498E0 Signed-off-by: Dave Hughes <davidhughes205@gmail.com> Closes: https://github.com/gentoo/musl/pull/404 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'app-emulation')
-rw-r--r--app-emulation/qemu/Manifest3
-rw-r--r--app-emulation/qemu/files/65-kvm.rules-r23
-rw-r--r--app-emulation/qemu/files/musl-patches/0001-linux-user-fix-build-with-musl-on-aarch64.patch31
-rw-r--r--app-emulation/qemu/files/musl-patches/0001-linux-user-fix-build-with-musl-on-ppc64le.patch67
-rw-r--r--app-emulation/qemu/files/musl-patches/0001-virtio-host-input-use-safe-64-bit-time-accessors-for.patch40
-rw-r--r--app-emulation/qemu/files/musl-patches/0002-virtio-user-input-use-safe-64-bit-time-accessors-for.patch40
-rw-r--r--app-emulation/qemu/files/musl-patches/0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch37
-rw-r--r--app-emulation/qemu/files/musl-patches/MAP_SYNC-fix.patch22
-rw-r--r--app-emulation/qemu/files/musl-patches/fix-segevent-and-sigval_t.patch24
-rw-r--r--app-emulation/qemu/files/musl-patches/fix-sendmsg.patch13
-rw-r--r--app-emulation/qemu/files/musl-patches/fix-sockios-header.patch13
-rw-r--r--app-emulation/qemu/files/musl-patches/guest-agent-shutdown.patch34
-rw-r--r--app-emulation/qemu/files/musl-patches/ignore-signals-33-and-64-to-allow-golang-emulation.patch56
-rw-r--r--app-emulation/qemu/files/musl-patches/mips-softfloat.patch32
-rw-r--r--app-emulation/qemu/files/musl-patches/musl-F_SHLCK-and-F_EXLCK.patch19
-rw-r--r--app-emulation/qemu/files/musl-patches/xattr_size_max.patch15
-rw-r--r--app-emulation/qemu/files/qemu-2.5.0-cflags.patch13
-rw-r--r--app-emulation/qemu/files/qemu-2.5.0-sysmacros.patch15
-rw-r--r--app-emulation/qemu/files/qemu-4.0.0-sanitize-interp_info.patch32
-rw-r--r--app-emulation/qemu/files/qemu-4.0.0-xkbcommon.patch38
-rw-r--r--app-emulation/qemu/files/qemu-4.2.0-r2-musl.patch19
-rw-r--r--app-emulation/qemu/files/qemu-5.1.0-pixman-for-vhost-user-gpu.patch62
-rw-r--r--app-emulation/qemu/files/qemu-5.1.0-usb-host-workaround-libusb-bug.patch82
-rw-r--r--app-emulation/qemu/files/qemu-5.1.0-usb-oob-CVE-2020-14364.patch90
-rw-r--r--app-emulation/qemu/files/qemu-5.2.0-cleaner-werror.patch40
-rw-r--r--app-emulation/qemu/files/qemu-5.2.0-disable-keymap.patch25
-rw-r--r--app-emulation/qemu/files/qemu-5.2.0-fix-firmware-path.patch16
-rw-r--r--app-emulation/qemu/files/qemu-5.2.0-no-pie-ld.patch73
-rw-r--r--app-emulation/qemu/files/qemu-5.2.0-strings.patch23
-rw-r--r--app-emulation/qemu/files/qemu-9999-fix-firmware-path.patch17
-rw-r--r--app-emulation/qemu/files/qemu-binfmt.initd.head2
-rw-r--r--app-emulation/qemu/metadata.xml11
-rw-r--r--app-emulation/qemu/qemu-5.2.0-r2.ebuild (renamed from app-emulation/qemu/qemu-4.2.0-r2.ebuild)187
33 files changed, 997 insertions, 197 deletions
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
index 911250c..2157b27 100644
--- a/app-emulation/qemu/Manifest
+++ b/app-emulation/qemu/Manifest
@@ -1,2 +1 @@
-DIST qemu-4.2.0-patches-r1.tar.xz 14552 BLAKE2B e8832ce5b7ccda02dcd63fa60a458322a36ba754c8bc682839de4ee33cf21a83cde434bdc062916d3c83e81026b68ebf2fbe099dc6c54c191875f830d95c63ae SHA512 7495e4c9ca80fd25a1bc8244b384f88f3bc6d7190e2840b1614e3bc6fd51938e42792c6a4dbdb2d400a45532e558814462647f35d5ab21e175bec84868a4161d
-DIST qemu-4.2.0.tar.xz 62222068 BLAKE2B 27c9fbcd5093af425764674817ab9299224bd03f37b5983786f6f437fff1fab3b7da247c55c4ca8b8c42726b9867005944a2f7f04f2d0d94d753961615f901ef SHA512 2a79973c2b07c53e8c57a808ea8add7b6b2cbca96488ed5d4b669ead8c9318907dec2b6109f180fc8ca8f04c0f73a56e82b3a527b5626b799d7e849f2474ec56
+DIST qemu-5.2.0.tar.xz 106902800 BLAKE2B 4413d5591cbabf80faba5b0b7347ee7749ff0a71af44bdf7f64b1995e17ecf1f3df539fa8e63959e0d50cd0502a41a2921e60cc6d078ed8ab5b09ab4b86d4ed7 SHA512 bddd633ce111471ebc651e03080251515178808556b49a308a724909e55dac0be0cc0c79c536ac12d239678ae94c60100dc124be9b9d9538340c03a2f27177f3
diff --git a/app-emulation/qemu/files/65-kvm.rules-r2 b/app-emulation/qemu/files/65-kvm.rules-r2
new file mode 100644
index 0000000..15c89b2
--- /dev/null
+++ b/app-emulation/qemu/files/65-kvm.rules-r2
@@ -0,0 +1,3 @@
+KERNEL=="kvm", GROUP="kvm", MODE="0660"
+KERNEL=="vhost-net", GROUP="kvm", MODE="0660", OPTIONS+="static_node=vhost-net"
+KERNEL=="vhost-vsock", GROUP="kvm", MODE="0660", OPTIONS+="static_node=vhost-vsock"
diff --git a/app-emulation/qemu/files/musl-patches/0001-linux-user-fix-build-with-musl-on-aarch64.patch b/app-emulation/qemu/files/musl-patches/0001-linux-user-fix-build-with-musl-on-aarch64.patch
new file mode 100644
index 0000000..1bbae7d
--- /dev/null
+++ b/app-emulation/qemu/files/musl-patches/0001-linux-user-fix-build-with-musl-on-aarch64.patch
@@ -0,0 +1,31 @@
+From 806cb2ed28a16cf2894fabef034347f426f1d04e Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Thu, 15 Dec 2016 11:53:07 +0100
+Subject: [PATCH] linux-user: fix build with musl on aarch64
+
+Use the standard uint64_t instead of internal __u64.
+
+This fixes compiler error with musl libc on aarch64:
+.../qemu-2.7.0/linux-user/host/aarch64/hostdep.h:28:5:
+error: unknown type name '__u64'
+ __u64 *pcreg = &uc->uc_mcontext.pc;
+ ^~~~~
+
+Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
+---
+ linux-user/host/aarch64/hostdep.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/linux-user/host/aarch64/hostdep.h b/linux-user/host/aarch64/hostdep.h
+index 64f75cef49..6fd6e36b2a 100644
+--- a/linux-user/host/aarch64/hostdep.h
++++ b/linux-user/host/aarch64/hostdep.h
+@@ -25,7 +25,7 @@ extern char safe_syscall_end[];
+ static inline void rewind_if_in_safe_syscall(void *puc)
+ {
+ ucontext_t *uc = puc;
+- __u64 *pcreg = &uc->uc_mcontext.pc;
++ uint64_t *pcreg = &uc->uc_mcontext.pc;
+
+ if (*pcreg > (uintptr_t)safe_syscall_start
+ && *pcreg < (uintptr_t)safe_syscall_end) {
diff --git a/app-emulation/qemu/files/musl-patches/0001-linux-user-fix-build-with-musl-on-ppc64le.patch b/app-emulation/qemu/files/musl-patches/0001-linux-user-fix-build-with-musl-on-ppc64le.patch
new file mode 100644
index 0000000..c3a9187
--- /dev/null
+++ b/app-emulation/qemu/files/musl-patches/0001-linux-user-fix-build-with-musl-on-ppc64le.patch
@@ -0,0 +1,67 @@
+--- a/linux-user/host/ppc64/hostdep.h
++++ b/linux-user/host/ppc64/hostdep.h
+@@ -25,7 +25,11 @@
+ static inline void rewind_if_in_safe_syscall(void *puc)
+ {
+ ucontext_t *uc = puc;
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ unsigned long *pcreg = &uc->uc_mcontext.gp_regs[PT_NIP];
++#else // Musl
++ unsigned long *pcreg = &uc->uc_mcontext.gp_regs[32];
++#endif
+
+ if (*pcreg > (uintptr_t)safe_syscall_start
+ && *pcreg < (uintptr_t)safe_syscall_end) {
+--- a/accel/tcg/user-exec.c
++++ a/accel/tcg/user-exec.c
+@@ -228,6 +228,7 @@
+ */
+ #ifdef linux
+ /* All Registers access - only for local access */
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ #define REG_sig(reg_name, context) \
+ ((context)->uc_mcontext.regs->reg_name)
+ /* Gpr Registers access */
+@@ -245,15 +246,42 @@
+ /* Condition register */
+ #define CR_sig(context) REG_sig(ccr, context)
+
++#else // Musl
++#define REG_sig(reg_num, context) \
++ ((context)->uc_mcontext.gp_regs[reg_num])
++/* Gpr Registers access */
++#define GPR_sig(reg_num, context) REG_sig(gpr[reg_num], context)
++/* Program counter */
++#define IAR_sig(context) REG_sig(32, context)
++/* Machine State Register (Supervisor) */
++#define MSR_sig(context) REG_sig(33, context)
++/* Count register */
++#define CTR_sig(context) REG_sig(35, context)
++/* User's integer exception register */
++#define XER_sig(context) REG_sig(37, context)
++/* Link register */
++#define LR_sig(context) REG_sig(36, context)
++/* Condition register */
++#define CR_sig(context) REG_sig(38, context)
++#endif
++
++
+ /* Float Registers access */
+ #define FLOAT_sig(reg_num, context) \
+ (((double *)((char *)((context)->uc_mcontext.regs + 48 * 4)))[reg_num])
+ #define FPSCR_sig(context) \
+ (*(int *)((char *)((context)->uc_mcontext.regs + (48 + 32 * 2) * 4)))
+ /* Exception Registers access */
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ #define DAR_sig(context) REG_sig(dar, context)
+ #define DSISR_sig(context) REG_sig(dsisr, context)
+ #define TRAP_sig(context) REG_sig(trap, context)
++#else // Musl
++#define DAR_sig(context) REG_sig(41, context)
++#define DSISR_sig(context) REG_sig(42, context)
++#define TRAP_sig(context) REG_sig(40, context)
++#endif
++
+ #endif /* linux */
+
+ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
diff --git a/app-emulation/qemu/files/musl-patches/0001-virtio-host-input-use-safe-64-bit-time-accessors-for.patch b/app-emulation/qemu/files/musl-patches/0001-virtio-host-input-use-safe-64-bit-time-accessors-for.patch
new file mode 100644
index 0000000..ba66aae
--- /dev/null
+++ b/app-emulation/qemu/files/musl-patches/0001-virtio-host-input-use-safe-64-bit-time-accessors-for.patch
@@ -0,0 +1,40 @@
+From 388ef67707f01fe4ad337642325ae974dd81c242 Mon Sep 17 00:00:00 2001
+From: Ariadne Conill <ariadne@dereferenced.org>
+Date: Wed, 22 Jul 2020 02:45:00 -0600
+Subject: [PATCH 1/2] virtio host input: use safe 64-bit time accessors for
+ input_event
+
+On 32-bit systems with 64-bit time_t, input_event.time is not
+directly accessible. Instead, we must use input_event_sec and
+input_event_usec accessors to set the time values.
+
+Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
+---
+ hw/input/virtio-input-host.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/hw/input/virtio-input-host.c b/hw/input/virtio-input-host.c
+index 85daf73f1a..7b81bf09f5 100644
+--- a/hw/input/virtio-input-host.c
++++ b/hw/input/virtio-input-host.c
+@@ -193,13 +193,16 @@ static void virtio_input_host_handle_status(VirtIOInput *vinput,
+ {
+ VirtIOInputHost *vih = VIRTIO_INPUT_HOST(vinput);
+ struct input_event evdev;
++ struct timeval tv;
+ int rc;
+
+- if (gettimeofday(&evdev.time, NULL)) {
++ if (gettimeofday(&tv, NULL)) {
+ perror("virtio_input_host_handle_status: gettimeofday");
+ return;
+ }
+
++ evdev.input_event_sec = tv.tv_sec;
++ evdev.input_event_usec = tv.tv_usec;
+ evdev.type = le16_to_cpu(event->type);
+ evdev.code = le16_to_cpu(event->code);
+ evdev.value = le32_to_cpu(event->value);
+--
+2.27.0
+
diff --git a/app-emulation/qemu/files/musl-patches/0002-virtio-user-input-use-safe-64-bit-time-accessors-for.patch b/app-emulation/qemu/files/musl-patches/0002-virtio-user-input-use-safe-64-bit-time-accessors-for.patch
new file mode 100644
index 0000000..b965f66
--- /dev/null
+++ b/app-emulation/qemu/files/musl-patches/0002-virtio-user-input-use-safe-64-bit-time-accessors-for.patch
@@ -0,0 +1,40 @@
+From de7cf9878a216143db677820c23407c3b032d12c Mon Sep 17 00:00:00 2001
+From: Ariadne Conill <ariadne@dereferenced.org>
+Date: Wed, 22 Jul 2020 02:51:30 -0600
+Subject: [PATCH 2/2] virtio user input: use safe 64-bit time accessors for
+ input_event
+
+On 32-bit systems with 64-bit time_t, input_event.time is not
+directly accessible. Instead, we must use input_event_sec and
+input_event_usec accessors to set the time values.
+
+Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
+---
+ contrib/vhost-user-input/main.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/contrib/vhost-user-input/main.c b/contrib/vhost-user-input/main.c
+index 6020c6f33a..4887a6cb44 100644
+--- a/contrib/vhost-user-input/main.c
++++ b/contrib/vhost-user-input/main.c
+@@ -115,13 +115,16 @@ vi_evdev_watch(VuDev *dev, int condition, void *data)
+ static void vi_handle_status(VuInput *vi, virtio_input_event *event)
+ {
+ struct input_event evdev;
++ struct timeval tv;
+ int rc;
+
+- if (gettimeofday(&evdev.time, NULL)) {
++ if (gettimeofday(&tv, NULL)) {
+ perror("vi_handle_status: gettimeofday");
+ return;
+ }
+
++ evdev.input_event_sec = tv.tv_sec;
++ evdev.input_event_usec = tv.tv_usec;
+ evdev.type = le16toh(event->type);
+ evdev.code = le16toh(event->code);
+ evdev.value = le32toh(event->value);
+--
+2.27.0
+
diff --git a/app-emulation/qemu/files/musl-patches/0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch b/app-emulation/qemu/files/musl-patches/0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch
new file mode 100644
index 0000000..528b5d5
--- /dev/null
+++ b/app-emulation/qemu/files/musl-patches/0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch
@@ -0,0 +1,37 @@
+From 8fbb4e6797ed67310b74cbaaa061269db45a5b71 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Tue, 29 Apr 2014 15:51:31 +0200
+Subject: [PATCH] linux-user/signal.c: define __SIGRTMIN/MAX for non-GNU
+ platforms
+
+The __SIGRTMIN and __SIGRTMAX are glibc internals and are not available
+on all platforms, so we define those if they are missing.
+
+This is needed for musl libc.
+
+Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
+---
+ linux-user/signal.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/linux-user/signal.c b/linux-user/signal.c
+index 5ca6d62b15..e917c16d91 100644
+--- a/linux-user/signal.c
++++ b/linux-user/signal.c
+@@ -25,6 +25,13 @@
+ #include "trace.h"
+ #include "signal-common.h"
+
++#ifndef __SIGRTMIN
++#define __SIGRTMIN 32
++#endif
++#ifndef __SIGRTMAX
++#define __SIGRTMAX (NSIG-1)
++#endif
++
+ static struct target_sigaction sigact_table[TARGET_NSIG];
+
+ static void host_signal_handler(int host_signum, siginfo_t *info,
+--
+2.23.0
+
diff --git a/app-emulation/qemu/files/musl-patches/MAP_SYNC-fix.patch b/app-emulation/qemu/files/musl-patches/MAP_SYNC-fix.patch
new file mode 100644
index 0000000..e13609d
--- /dev/null
+++ b/app-emulation/qemu/files/musl-patches/MAP_SYNC-fix.patch
@@ -0,0 +1,22 @@
+diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c
+index f7f177d..7598960 100644
+--- a/util/mmap-alloc.c
++++ b/util/mmap-alloc.c
+@@ -10,14 +10,16 @@
+ * later. See the COPYING file in the top-level directory.
+ */
+
++#include "qemu/osdep.h"
++
+ #ifdef CONFIG_LINUX
+ #include <linux/mman.h>
++#include <asm-generic/mman.h> /* for ppc64le */
+ #else /* !CONFIG_LINUX */
+ #define MAP_SYNC 0x0
+ #define MAP_SHARED_VALIDATE 0x0
+ #endif /* CONFIG_LINUX */
+
+-#include "qemu/osdep.h"
+ #include "qemu/mmap-alloc.h"
+ #include "qemu/host-utils.h"
+
diff --git a/app-emulation/qemu/files/musl-patches/fix-segevent-and-sigval_t.patch b/app-emulation/qemu/files/musl-patches/fix-segevent-and-sigval_t.patch
new file mode 100644
index 0000000..1f99eac
--- /dev/null
+++ b/app-emulation/qemu/files/musl-patches/fix-segevent-and-sigval_t.patch
@@ -0,0 +1,24 @@
+--- qemu-2.2.1/linux-user/syscall.c.orig 2015-04-10 07:10:06.305662505 +0000
++++ qemu-2.2.1/linux-user/syscall.c 2015-04-10 07:36:53.801871968 +0000
+@@ -5020,9 +5020,20 @@
+ return 0;
+ }
+
+-static inline abi_long target_to_host_sigevent(struct sigevent *host_sevp,
++struct host_sigevent {
++ union sigval sigev_value;
++ int sigev_signo;
++ int sigev_notify;
++ union {
++ int _pad[64-sizeof(int) * 2 + sizeof(union sigval)];
++ int _tid;
++ } _sigev_un;
++};
++
++static inline abi_long target_to_host_sigevent(struct sigevent *sevp,
+ abi_ulong target_addr)
+ {
++ struct host_sigevent *host_sevp = (struct host_sigevent *) sevp;
+ struct target_sigevent *target_sevp;
+
+ if (!lock_user_struct(VERIFY_READ, target_sevp, target_addr, 1)) {
diff --git a/app-emulation/qemu/files/musl-patches/fix-sendmsg.patch b/app-emulation/qemu/files/musl-patches/fix-sendmsg.patch
new file mode 100644
index 0000000..dc9c4bc
--- /dev/null
+++ b/app-emulation/qemu/files/musl-patches/fix-sendmsg.patch
@@ -0,0 +1,13 @@
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index 389ec09764..116d5eaff5 100644
+--- a/linux-user/syscall.c
++++ b/linux-user/syscall.c
+@@ -3337,7 +3337,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
+ int flags, int send)
+ {
+ abi_long ret, len;
+- struct msghdr msg;
++ struct msghdr msg = {};
+ abi_ulong count;
+ struct iovec *vec;
+ abi_ulong target_vec;
diff --git a/app-emulation/qemu/files/musl-patches/fix-sockios-header.patch b/app-emulation/qemu/files/musl-patches/fix-sockios-header.patch
new file mode 100644
index 0000000..1f3cd76
--- /dev/null
+++ b/app-emulation/qemu/files/musl-patches/fix-sockios-header.patch
@@ -0,0 +1,13 @@
+diff --git a/linux-user/syscall.c b/linux-user/syscall.c
+index 43d0562..afa0ac4 100644
+--- a/linux-user/syscall.c
++++ b/linux-user/syscall.c
+@@ -59,6 +59,7 @@ int __clone2(int (*fn)(void *), void *child_stack_base,
+ #include <linux/icmp.h>
+ #include <linux/icmpv6.h>
+ #include <linux/errqueue.h>
++#include <linux/sockios.h>
+ #include <linux/random.h>
+ #include "qemu-common.h"
+ #ifdef CONFIG_TIMERFD
+ #include <sys/timerfd.h>
diff --git a/app-emulation/qemu/files/musl-patches/guest-agent-shutdown.patch b/app-emulation/qemu/files/musl-patches/guest-agent-shutdown.patch
new file mode 100644
index 0000000..742f281
--- /dev/null
+++ b/app-emulation/qemu/files/musl-patches/guest-agent-shutdown.patch
@@ -0,0 +1,34 @@
+diff --git a/qga/commands-posix.c b/qga/commands-posix.c
+index 1877976..7915aab 100644
+--- a/qga/commands-posix.c
++++ b/qga/commands-posix.c
+@@ -82,6 +82,7 @@ static void ga_wait_child(pid_t pid, int *status, Error **errp)
+ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp)
+ {
+ const char *shutdown_flag;
++ const char *fallback_cmd = NULL;
+ Error *local_err = NULL;
+ pid_t pid;
+ int status;
+@@ -89,10 +90,13 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp)
+ slog("guest-shutdown called, mode: %s", mode);
+ if (!has_mode || strcmp(mode, "powerdown") == 0) {
+ shutdown_flag = "-P";
++ fallback_cmd = "/sbin/poweroff";
+ } else if (strcmp(mode, "halt") == 0) {
+ shutdown_flag = "-H";
++ fallback_cmd = "/sbin/halt";
+ } else if (strcmp(mode, "reboot") == 0) {
+ shutdown_flag = "-r";
++ fallback_cmd = "/sbin/reboot";
+ } else {
+ error_setg(errp,
+ "mode is invalid (valid values are: halt|powerdown|reboot");
+@@ -109,6 +113,7 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp)
+
+ execle("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0",
+ "hypervisor initiated shutdown", (char*)NULL, environ);
++ execle(fallback_cmd, fallback_cmd, (char*)NULL, environ);
+ _exit(EXIT_FAILURE);
+ } else if (pid < 0) {
+ error_setg_errno(errp, errno, "failed to create child process");
diff --git a/app-emulation/qemu/files/musl-patches/ignore-signals-33-and-64-to-allow-golang-emulation.patch b/app-emulation/qemu/files/musl-patches/ignore-signals-33-and-64-to-allow-golang-emulation.patch
new file mode 100644
index 0000000..1162542
--- /dev/null
+++ b/app-emulation/qemu/files/musl-patches/ignore-signals-33-and-64-to-allow-golang-emulation.patch
@@ -0,0 +1,56 @@
+From db186a3f83454268c43fc793a48bc28c41368a6c Mon Sep 17 00:00:00 2001
+From: Petros Angelatos <petrosagg@gmail.com>
+Date: Thu, 3 Mar 2016 23:58:53 -0800
+Subject: [PATCH] linux-user: ignore signals 33 and 64 to allow golang
+ emulation
+
+Signal 33 will always fail. This causes golang crash since
+https://github.com/golang/go/commit/675eb72c285cd0dd44a5f280bb3fa456ddf6de16
+
+As explained in that commit, these signals are very rarely used in a
+way that causes problems, so it's ok-ish to ignore one of them.
+
+Signal 64 will fail because QEMU uses SIGRTMAX for itself. This causes
+golang to crash for versions earlier than
+https://github.com/golang/go/commit/d10675089d74db0408f2432eae3bd89a8e1c2d6a
+
+Since after that commit golang ignores that signal, we also ignore it here to
+allow earlier versions to run as well.
+
+Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
+---
+ linux-user/signal.c | 21 +++++++++++++++++++++
+ 1 file changed, 21 insertions(+)
+
+diff --git a/linux-user/signal.c b/linux-user/signal.c
+index 9a4d894..90aca55 100644
+--- a/linux-user/signal.c
++++ b/linux-user/signal.c
+@@ -744,6 +744,27 @@ int do_sigaction(int sig, const struct target_sigaction *act,
+ }
+
+ k = &sigact_table[sig - 1];
++
++ /* This signal will always fail. This causes golang crash since
++ * https://github.com/golang/go/commit/675eb72c285cd0dd44a5f280bb3fa456ddf6de16
++ *
++ * As explained in that commit, these signals are very rarely used in a
++ * way that causes problems, so it's ok-ish to ignore one of them here.
++ */
++ if (sig == 33) {
++ return 0;
++ }
++ /* This signal will fail because QEMU uses SIGRTMAX for itself. This causes
++ * golang to crash for versions earlier than
++ * https://github.com/golang/go/commit/d10675089d74db0408f2432eae3bd89a8e1c2d6a
++ *
++ * Since after that commit golang ignores that signal, we also ignore it here to
++ * allow earlier versions to run as well.
++ */
++ if (sig == 64) {
++ return 0;
++ }
++
+ if (oact) {
+ __put_user(k->_sa_handler, &oact->_sa_handler);
+ __put_user(k->sa_flags, &oact->sa_flags);
diff --git a/app-emulation/qemu/files/musl-patches/mips-softfloat.patch b/app-emulation/qemu/files/musl-patches/mips-softfloat.patch
new file mode 100644
index 0000000..4d9b489
--- /dev/null
+++ b/app-emulation/qemu/files/musl-patches/mips-softfloat.patch
@@ -0,0 +1,32 @@
+diff --git a/tests/fp/fp-bench.c b/tests/fp/fp-bench.c
+index 4ba5e1d..313256c 100644
+--- a/tests/fp/fp-bench.c
++++ b/tests/fp/fp-bench.c
+@@ -479,6 +479,7 @@ static void QEMU_NORETURN die_host_rounding(enum rounding rounding)
+ exit(EXIT_FAILURE);
+ }
+
++#ifndef __mips_soft_float
+ static void set_host_precision(enum rounding rounding)
+ {
+ int rhost;
+@@ -507,6 +508,7 @@ static void set_host_precision(enum rounding rounding)
+ die_host_rounding(rounding);
+ }
+ }
++#endif
+
+ static void set_soft_precision(enum rounding rounding)
+ {
+@@ -596,9 +598,11 @@ static void parse_args(int argc, char *argv[])
+
+ /* set precision and rounding mode based on the tester */
+ switch (tester) {
++#ifndef __mips_soft_float
+ case TESTER_HOST:
+ set_host_precision(rounding);
+ break;
++#endif
+ case TESTER_SOFT:
+ set_soft_precision(rounding);
+ switch (precision) {
diff --git a/app-emulation/qemu/files/musl-patches/musl-F_SHLCK-and-F_EXLCK.patch b/app-emulation/qemu/files/musl-patches/musl-F_SHLCK-and-F_EXLCK.patch
new file mode 100644
index 0000000..316819a
--- /dev/null
+++ b/app-emulation/qemu/files/musl-patches/musl-F_SHLCK-and-F_EXLCK.patch
@@ -0,0 +1,19 @@
+This patch was not upstreamed to qemu as those should probably be
+defined in musl libc.
+
+--- ./linux-user/syscall.c.orig
++++ ./linux-user/syscall.c
+@@ -114,6 +114,13 @@
+
+ #include "qemu.h"
+
++#ifndef F_SHLCK
++#define F_SHLCK 8
++#endif
++#ifndef F_EXLCK
++#define F_EXLCK 4
++#endif
++
+ #ifndef CLONE_IO
+ #define CLONE_IO 0x80000000 /* Clone io context */
+ #endif
diff --git a/app-emulation/qemu/files/musl-patches/xattr_size_max.patch b/app-emulation/qemu/files/musl-patches/xattr_size_max.patch
new file mode 100644
index 0000000..1a33cbf
--- /dev/null
+++ b/app-emulation/qemu/files/musl-patches/xattr_size_max.patch
@@ -0,0 +1,15 @@
+diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
+index faebd91..a0f15b6 100644
+--- a/hw/9pfs/9p.c
++++ b/hw/9pfs/9p.c
+@@ -25,6 +25,10 @@
+ #include "trace.h"
+ #include "migration/migration.h"
+
++#ifdef __linux__
++#include <linux/limits.h> /* for XATTR_SIZE_MAX */
++#endif
++
+ int open_fd_hw;
+ int total_open_fd;
+ static int open_fd_rc;
diff --git a/app-emulation/qemu/files/qemu-2.5.0-cflags.patch b/app-emulation/qemu/files/qemu-2.5.0-cflags.patch
deleted file mode 100644
index 173394f..0000000
--- a/app-emulation/qemu/files/qemu-2.5.0-cflags.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/configure
-+++ b/configure
-@@ -4468,10 +4468,6 @@ fi
- if test "$gcov" = "yes" ; then
- CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
- LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
--elif test "$fortify_source" = "yes" ; then
-- CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
--elif test "$debug" = "no"; then
-- CFLAGS="-O2 $CFLAGS"
- fi
-
- ##########################################
diff --git a/app-emulation/qemu/files/qemu-2.5.0-sysmacros.patch b/app-emulation/qemu/files/qemu-2.5.0-sysmacros.patch
deleted file mode 100644
index f2e766d..0000000
--- a/app-emulation/qemu/files/qemu-2.5.0-sysmacros.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Linux C libs are moving away from implicit header pollution with sys/types.h
-
---- a/include/qemu/osdep.h
-+++ b/include/qemu/osdep.h
-@@ -78,6 +78,10 @@ extern int daemon(int, int);
- #include <assert.h>
- #include <signal.h>
-
-+#ifdef __linux__
-+#include <sys/sysmacros.h>
-+#endif
-+
- #ifdef __OpenBSD__
- #include <sys/signal.h>
- #endif
diff --git a/app-emulation/qemu/files/qemu-4.0.0-sanitize-interp_info.patch b/app-emulation/qemu/files/qemu-4.0.0-sanitize-interp_info.patch
deleted file mode 100644
index 58ff0c7..0000000
--- a/app-emulation/qemu/files/qemu-4.0.0-sanitize-interp_info.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-linux-user: Sanitize interp_info and, for mips
-
-Sanitize interp_info structure in load_elf_binary() and, for mips only,
-init its field fp_abi. This fixes appearances of "Unexpected FPU mode"
-message in some MIPS use cases.
-
-Signed-off-by: Daniel Santos <address@hidden>
-Signed-off-by: Aleksandar Markovic <address@hidden>
----
- linux-user/elfload.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/linux-user/elfload.c b/linux-user/elfload.c
-index c1a2602..7f09d57 100644
---- a/linux-user/elfload.c
-+++ b/linux-user/elfload.c
-@@ -2698,6 +2698,11 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info)
- char *elf_interpreter = NULL;
- char *scratch;
-
-+ memset(&interp_info, 0, sizeof(interp_info));
-+#ifdef TARGET_MIPS
-+ interp_info.fp_abi = MIPS_ABI_FP_UNKNOWN;
-+#endif
-+
- info->start_mmap = (abi_ulong)ELF_START_MMAP;
-
- load_elf_image(bprm->filename, bprm->fd, info,
---
-2.7.4
-
-
diff --git a/app-emulation/qemu/files/qemu-4.0.0-xkbcommon.patch b/app-emulation/qemu/files/qemu-4.0.0-xkbcommon.patch
deleted file mode 100644
index 3d9a516..0000000
--- a/app-emulation/qemu/files/qemu-4.0.0-xkbcommon.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From cef396dc0b11a09ede85b275ed1ceee71b60a4b3 Mon Sep 17 00:00:00 2001
-From: James Le Cuirot <chewi@gentoo.org>
-Date: Sat, 14 Sep 2019 15:47:20 +0100
-Subject: [PATCH] configure: Add xkbcommon configure options
-
-This dependency is currently "automagic", which is bad for distributions.
-
-Signed-off-by: James Le Cuirot <chewi@gentoo.org>
----
- configure | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/configure b/configure
-index 30aad233d1..30544f52e6 100755
---- a/configure
-+++ b/configure
-@@ -1521,6 +1521,10 @@ for opt do
- ;;
- --disable-libpmem) libpmem=no
- ;;
-+ --enable-xkbcommon) xkbcommon=yes
-+ ;;
-+ --disable-xkbcommon) xkbcommon=no
-+ ;;
- *)
- echo "ERROR: unknown option $opt"
- echo "Try '$0 --help' for more information"
-@@ -1804,6 +1808,7 @@ disabled with --disable-FEATURE, default is enabled if available:
- capstone capstone disassembler support
- debug-mutex mutex debugging support
- libpmem libpmem support
-+ xkbcommon xkbcommon support
-
- NOTE: The object files are built at the place where configure is launched
- EOF
---
-2.23.0
-
diff --git a/app-emulation/qemu/files/qemu-4.2.0-r2-musl.patch b/app-emulation/qemu/files/qemu-4.2.0-r2-musl.patch
deleted file mode 100644
index 70332da..0000000
--- a/app-emulation/qemu/files/qemu-4.2.0-r2-musl.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-Build of qemu 4.2.0-r2 with virtfs on musl fail :
-
-qemu-4.2.0-r2/work/qemu-4.2.0/hw/9pfs/9p.c:3821:16: error: ‘XATTR_SIZE_MAX’ undeclared (first use in this function)
-3821 | if (size > XATTR_SIZE_MAX)
-
-Fix : Add limits.h header
-
----
-
---- a/hw/9pfs/9p.c
-+++ b/hw/9pfs/9p.c
-@@ -13,6 +13,7 @@
-
- #include "qemu/osdep.h"
- #include <glib/gprintf.h>
-+#include <linux/limits.h>
- #include "hw/virtio/virtio.h"
- #include "qapi/error.h"
- #include "qemu/error-report.h"
diff --git a/app-emulation/qemu/files/qemu-5.1.0-pixman-for-vhost-user-gpu.patch b/app-emulation/qemu/files/qemu-5.1.0-pixman-for-vhost-user-gpu.patch
new file mode 100644
index 0000000..4eb644f
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-5.1.0-pixman-for-vhost-user-gpu.patch
@@ -0,0 +1,62 @@
+https://bugs.gentoo.org/735146
+
+From 4fd46e6cdd976f4aecdc3fbbad728e00a7bc4ee0 Mon Sep 17 00:00:00 2001
+From: Rafael Kitover <rkitover@gmail.com>
+Date: Thu, 13 Aug 2020 20:19:24 +0000
+Subject: [PATCH] configure: Require pixman for vhost-user-gpu.
+
+Use the test from Makefile to check if vhost-user-gpu is being built,
+and if so require pixman.
+
+Signed-off-by: Rafael Kitover <rkitover@gmail.com>
+---
+ configure | 28 ++++++++++++++--------------
+ 1 file changed, 14 insertions(+), 14 deletions(-)
+
+--- a/configure
++++ b/configure
+@@ -4062,20 +4062,6 @@ if test "$modules" = yes; then
+ fi
+ fi
+
+-##########################################
+-# pixman support probe
+-
+-if test "$softmmu" = "no"; then
+- pixman_cflags=
+- pixman_libs=
+-elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
+- pixman_cflags=$($pkg_config --cflags pixman-1)
+- pixman_libs=$($pkg_config --libs pixman-1)
+-else
+- error_exit "pixman >= 0.21.8 not present." \
+- "Please install the pixman devel package."
+-fi
+-
+ ##########################################
+ # libmpathpersist probe
+
+@@ -4491,6 +4477,20 @@ if test "$opengl" = "yes" && test "$have_x11" = "yes"; then
+ done
+ fi
+
++##########################################
++# pixman support probe
++
++if test "$softmmu" = "no" && ! test "${linux} ${virglrenderer} ${gbm} ${want_tools}" = "yes yes yes yes"; then
++ pixman_cflags=
++ pixman_libs=
++elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
++ pixman_cflags=$($pkg_config --cflags pixman-1)
++ pixman_libs=$($pkg_config --libs pixman-1)
++else
++ error_exit "pixman >= 0.21.8 not present." \
++ "Please install the pixman devel package."
++fi
++
+ ##########################################
+ # libxml2 probe
+ if test "$libxml2" != "no" ; then
+--
+2.28.0
+
diff --git a/app-emulation/qemu/files/qemu-5.1.0-usb-host-workaround-libusb-bug.patch b/app-emulation/qemu/files/qemu-5.1.0-usb-host-workaround-libusb-bug.patch
new file mode 100644
index 0000000..34a50a9
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-5.1.0-usb-host-workaround-libusb-bug.patch
@@ -0,0 +1,82 @@
+From 202d69a715a4b1824dcd7ec1683d027ed2bae6d3 Mon Sep 17 00:00:00 2001
+Message-Id: <202d69a715a4b1824dcd7ec1683d027ed2bae6d3.1606202550.git.mprivozn@redhat.com>
+From: Gerd Hoffmann <kraxel@redhat.com>
+Date: Mon, 24 Aug 2020 13:00:57 +0200
+Subject: [PATCH] usb-host: workaround libusb bug
+
+libusb_get_device_speed() does not work for
+libusb_wrap_sys_device() devices in v1.0.23.
+
+Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1871090
+Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
+Message-id: 20200824110057.32089-1-kraxel@redhat.com
+Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
+---
+ hw/usb/host-libusb.c | 37 ++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 36 insertions(+), 1 deletion(-)
+
+diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
+index c474551d84..08604f787f 100644
+--- a/hw/usb/host-libusb.c
++++ b/hw/usb/host-libusb.c
+@@ -39,6 +39,11 @@
+ #endif
+ #include <libusb.h>
+
++#ifdef CONFIG_LINUX
++#include <sys/ioctl.h>
++#include <linux/usbdevice_fs.h>
++#endif
++
+ #include "qapi/error.h"
+ #include "migration/vmstate.h"
+ #include "monitor/monitor.h"
+@@ -885,6 +890,7 @@ static void usb_host_ep_update(USBHostDevice *s)
+ static int usb_host_open(USBHostDevice *s, libusb_device *dev, int hostfd)
+ {
+ USBDevice *udev = USB_DEVICE(s);
++ int libusb_speed;
+ int bus_num = 0;
+ int addr = 0;
+ int rc;
+@@ -935,7 +941,36 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev, int hostfd)
+ usb_ep_init(udev);
+ usb_host_ep_update(s);
+
+- udev->speed = speed_map[libusb_get_device_speed(dev)];
++ libusb_speed = libusb_get_device_speed(dev);
++#ifdef CONFIG_LINUX
++ if (hostfd && libusb_speed == 0) {
++ /*
++ * Workaround libusb bug: libusb_get_device_speed() does not
++ * work for libusb_wrap_sys_device() devices in v1.0.23.
++ *
++ * Speeds are defined in linux/usb/ch9.h, file not included
++ * due to name conflicts.
++ */
++ int rc = ioctl(hostfd, USBDEVFS_GET_SPEED, NULL);
++ switch (rc) {
++ case 1: /* low */
++ libusb_speed = LIBUSB_SPEED_LOW;
++ break;
++ case 2: /* full */
++ libusb_speed = LIBUSB_SPEED_FULL;
++ break;
++ case 3: /* high */
++ case 4: /* wireless */
++ libusb_speed = LIBUSB_SPEED_HIGH;
++ break;
++ case 5: /* super */
++ case 6: /* super plus */
++ libusb_speed = LIBUSB_SPEED_SUPER;
++ break;
++ }
++ }
++#endif
++ udev->speed = speed_map[libusb_speed];
+ usb_host_speed_compat(s);
+
+ if (s->ddesc.iProduct) {
+--
+2.26.2
+
diff --git a/app-emulation/qemu/files/qemu-5.1.0-usb-oob-CVE-2020-14364.patch b/app-emulation/qemu/files/qemu-5.1.0-usb-oob-CVE-2020-14364.patch
new file mode 100644
index 0000000..d1d23ec
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-5.1.0-usb-oob-CVE-2020-14364.patch
@@ -0,0 +1,90 @@
+https://bugs.gentoo.org/743649
+
+From b946434f2659a182afc17e155be6791ebfb302eb Mon Sep 17 00:00:00 2001
+From: Gerd Hoffmann <kraxel@redhat.com>
+Date: Tue, 25 Aug 2020 07:36:36 +0200
+Subject: [PATCH] usb: fix setup_len init (CVE-2020-14364)
+
+Store calculated setup_len in a local variable, verify it, and only
+write it to the struct (USBDevice->setup_len) in case it passed the
+sanity checks.
+
+This prevents other code (do_token_{in,out} functions specifically)
+from working with invalid USBDevice->setup_len values and overrunning
+the USBDevice->setup_buf[] buffer.
+
+Fixes: CVE-2020-14364
+Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
+Tested-by: Gonglei <arei.gonglei@huawei.com>
+Reviewed-by: Li Qiang <liq3ea@gmail.com>
+Message-id: 20200825053636.29648-1-kraxel@redhat.com
+---
+ hw/usb/core.c | 16 ++++++++++------
+ 1 file changed, 10 insertions(+), 6 deletions(-)
+
+diff --git a/hw/usb/core.c b/hw/usb/core.c
+index 5abd128b6b..5234dcc73f 100644
+--- a/hw/usb/core.c
++++ b/hw/usb/core.c
+@@ -129,6 +129,7 @@ void usb_wakeup(USBEndpoint *ep, unsigned int stream)
+ static void do_token_setup(USBDevice *s, USBPacket *p)
+ {
+ int request, value, index;
++ unsigned int setup_len;
+
+ if (p->iov.size != 8) {
+ p->status = USB_RET_STALL;
+@@ -138,14 +139,15 @@ static void do_token_setup(USBDevice *s, USBPacket *p)
+ usb_packet_copy(p, s->setup_buf, p->iov.size);
+ s->setup_index = 0;
+ p->actual_length = 0;
+- s->setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+- if (s->setup_len > sizeof(s->data_buf)) {
++ setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
++ if (setup_len > sizeof(s->data_buf)) {
+ fprintf(stderr,
+ "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
+- s->setup_len, sizeof(s->data_buf));
++ setup_len, sizeof(s->data_buf));
+ p->status = USB_RET_STALL;
+ return;
+ }
++ s->setup_len = setup_len;
+
+ request = (s->setup_buf[0] << 8) | s->setup_buf[1];
+ value = (s->setup_buf[3] << 8) | s->setup_buf[2];
+@@ -259,26 +261,28 @@ static void do_token_out(USBDevice *s, USBPacket *p)
+ static void do_parameter(USBDevice *s, USBPacket *p)
+ {
+ int i, request, value, index;
++ unsigned int setup_len;
+
+ for (i = 0; i < 8; i++) {
+ s->setup_buf[i] = p->parameter >> (i*8);
+ }
+
+ s->setup_state = SETUP_STATE_PARAM;
+- s->setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+ s->setup_index = 0;
+
+ request = (s->setup_buf[0] << 8) | s->setup_buf[1];
+ value = (s->setup_buf[3] << 8) | s->setup_buf[2];
+ index = (s->setup_buf[5] << 8) | s->setup_buf[4];
+
+- if (s->setup_len > sizeof(s->data_buf)) {
++ setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
++ if (setup_len > sizeof(s->data_buf)) {
+ fprintf(stderr,
+ "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
+- s->setup_len, sizeof(s->data_buf));
++ setup_len, sizeof(s->data_buf));
+ p->status = USB_RET_STALL;
+ return;
+ }
++ s->setup_len = setup_len;
+
+ if (p->pid == USB_TOKEN_OUT) {
+ usb_packet_copy(p, s->data_buf, s->setup_len);
+--
+2.28.0
+
diff --git a/app-emulation/qemu/files/qemu-5.2.0-cleaner-werror.patch b/app-emulation/qemu/files/qemu-5.2.0-cleaner-werror.patch
new file mode 100644
index 0000000..33115f1
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-5.2.0-cleaner-werror.patch
@@ -0,0 +1,40 @@
+-Wall -Wextra compains about unused arguments,
+causes safe-stack to be mis-detected.
+--- a/configure
++++ b/configure
+@@ -2293,7 +2293,7 @@ fi
+ cat > $TMPC << EOF
+ #include <stdint.h>
+ #include <stdio.h>
+-int main(int argc, char *argv[]) {
++int main(void) {
+ return printf("%zu", SIZE_MAX);
+ }
+ EOF
+@@ -4911,7 +4911,7 @@ fi
+
+ if test "$safe_stack" = "yes"; then
+ cat > $TMPC << EOF
+-int main(int argc, char *argv[])
++int main(void)
+ {
+ #if ! __has_feature(safe_stack)
+ #error SafeStack Disabled
+@@ -4933,7 +4933,7 @@ EOF
+ fi
+ else
+ cat > $TMPC << EOF
+-int main(int argc, char *argv[])
++int main(void)
+ {
+ #if defined(__has_feature)
+ #if __has_feature(safe_stack)
+@@ -5283,7 +5283,7 @@ static const int Z = 1;
+ #define TAUT(X) ((X) == Z)
+ #define PAREN(X, Y) (X == Y)
+ #define ID(X) (X)
+-int main(int argc, char *argv[])
++int main(void)
+ {
+ int x = 0, y = 0;
+ x = ID(x);
diff --git a/app-emulation/qemu/files/qemu-5.2.0-disable-keymap.patch b/app-emulation/qemu/files/qemu-5.2.0-disable-keymap.patch
new file mode 100644
index 0000000..4b5676b
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-5.2.0-disable-keymap.patch
@@ -0,0 +1,25 @@
+Do not use system's 'qemu-keymap' in native case.
+--- a/meson.build
++++ b/meson.build
+@@ -337,6 +337,8 @@ if 'CONFIG_LIBCAP_NG' in config_host
+ endif
+ if get_option('xkbcommon').auto() and not have_system and not have_tools
+ xkbcommon = not_found
++elif get_option('xkbcommon').disabled()
++ xkbcommon = not_found
+ else
+ xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'),
+ method: 'pkg-config', static: enable_static)
+--- a/pc-bios/keymaps/meson.build
++++ b/pc-bios/keymaps/meson.build
+@@ -33,7 +33,9 @@ keymaps = {
+ 'tr': '-l tr',
+ }
+
+-if meson.is_cross_build() or 'CONFIG_XKBCOMMON' not in config_host
++if meson.is_cross_build()
+ native_qemu_keymap = find_program('qemu-keymap', required: false, disabler: true)
++elif get_option('xkbcommon').disabled()
++ native_qemu_keymap = not_found
+ else
+ native_qemu_keymap = qemu_keymap
diff --git a/app-emulation/qemu/files/qemu-5.2.0-fix-firmware-path.patch b/app-emulation/qemu/files/qemu-5.2.0-fix-firmware-path.patch
new file mode 100644
index 0000000..5396983
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-5.2.0-fix-firmware-path.patch
@@ -0,0 +1,16 @@
+Se absolute filename in files like
+ /usr/share/qemu/firmware/50-edk2-x86_64-secure.json
+
+Bug: https://bugs.gentoo.org/766743
+Patch-by: Jannik Glückert
+--- a/pc-bios/descriptors/meson.build
++++ b/pc-bios/descriptors/meson.build
+@@ -8,7 +8,7 @@ foreach f: [
+ ]
+ configure_file(input: files(f),
+ output: f,
+- configuration: {'DATADIR': qemu_datadir},
++ configuration: {'DATADIR': get_option('prefix') / qemu_datadir},
+ install: get_option('install_blobs'),
+ install_dir: qemu_datadir / 'firmware')
+ endforeach
diff --git a/app-emulation/qemu/files/qemu-5.2.0-no-pie-ld.patch b/app-emulation/qemu/files/qemu-5.2.0-no-pie-ld.patch
new file mode 100644
index 0000000..f47a587
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-5.2.0-no-pie-ld.patch
@@ -0,0 +1,73 @@
+From bbd2d5a8120771ec59b86a80a1f51884e0a26e53 Mon Sep 17 00:00:00 2001
+From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
+Date: Mon, 14 Dec 2020 16:09:38 +0100
+Subject: [PATCH] build: -no-pie is no functional linker flag
+
+Recent binutils changes dropping unsupported options [1] caused a build
+issue in regard to the optionroms.
+
+ ld -m elf_i386 -T /<<PKGBUILDDIR>>/pc-bios/optionrom//flat.lds -no-pie \
+ -s -o multiboot.img multiboot.o
+ ld.bfd: Error: unable to disambiguate: -no-pie (did you mean --no-pie ?)
+
+This isn't really a regression in ld.bfd, filing the bug upstream
+revealed that this never worked as a ld flag [2] - in fact it seems we
+were by accident setting --nmagic).
+
+Since it never had the wanted effect this usage of LDFLAGS_NOPIE, should be
+droppable without any effect. This also is the only use-case of LDFLAGS_NOPIE
+in .mak, therefore we can also remove it from being added there.
+
+[1]: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=983d925d
+[2]: https://sourceware.org/bugzilla/show_bug.cgi?id=27050#c5
+
+Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
+Message-Id: <20201214150938.1297512-1-christian.ehrhardt@canonical.com>
+Cc: qemu-stable@nongnu.org
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+---
+ configure | 3 ---
+ pc-bios/optionrom/Makefile | 1 -
+ 2 files changed, 4 deletions(-)
+
+--- a/configure
++++ b/configure
+@@ -2137,7 +2137,6 @@ EOF
+ # Check we support --no-pie first; we will need this for building ROMs.
+ if compile_prog "-Werror -fno-pie" "-no-pie"; then
+ CFLAGS_NOPIE="-fno-pie"
+- LDFLAGS_NOPIE="-no-pie"
+ fi
+
+ if test "$static" = "yes"; then
+@@ -2153,7 +2152,6 @@ if test "$static" = "yes"; then
+ fi
+ elif test "$pie" = "no"; then
+ CONFIGURE_CFLAGS="$CFLAGS_NOPIE $CONFIGURE_CFLAGS"
+- CONFIGURE_LDFLAGS="$LDFLAGS_NOPIE $CONFIGURE_LDFLAGS"
+ elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
+ CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS"
+ CONFIGURE_LDFLAGS="-pie $CONFIGURE_LDFLAGS"
+@@ -6714,7 +6712,6 @@ echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
+ echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
+ echo "GLIB_LIBS=$glib_libs" >> $config_host_mak
+ echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
+-echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
+ echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
+ echo "EXESUF=$EXESUF" >> $config_host_mak
+ echo "HOST_DSOSUF=$HOST_DSOSUF" >> $config_host_mak
+diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
+index 084fc10f05..30771f8d17 100644
+--- a/pc-bios/optionrom/Makefile
++++ b/pc-bios/optionrom/Makefile
+@@ -41,7 +41,6 @@ override CFLAGS += $(call cc-option, $(Wa)-32)
+
+ LD_I386_EMULATION ?= elf_i386
+ override LDFLAGS = -m $(LD_I386_EMULATION) -T $(SRC_DIR)/flat.lds
+-override LDFLAGS += $(LDFLAGS_NOPIE)
+
+ all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin
+
+--
+2.30.0
+
diff --git a/app-emulation/qemu/files/qemu-5.2.0-strings.patch b/app-emulation/qemu/files/qemu-5.2.0-strings.patch
new file mode 100644
index 0000000..0b3dcdc
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-5.2.0-strings.patch
@@ -0,0 +1,23 @@
+https://bugs.gentoo.org/759310
+--- a/configure
++++ b/configure
+@@ -521,6 +521,7 @@ ld="${LD-${cross_prefix}ld}"
+ ranlib="${RANLIB-${cross_prefix}ranlib}"
+ nm="${NM-${cross_prefix}nm}"
+ strip="${STRIP-${cross_prefix}strip}"
++strings="${STRINGS-${cross_prefix}strings}"
+ windres="${WINDRES-${cross_prefix}windres}"
+ pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
+ query_pkg_config() {
+@@ -2265,9 +2266,9 @@ int main(int argc, char *argv[]) {
+ EOF
+
+ if compile_object ; then
+- if strings -a $TMPO | grep -q BiGeNdIaN ; then
++ if $strings -a $TMPO | grep -q BiGeNdIaN ; then
+ bigendian="yes"
+- elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then
++ elif $strings -a $TMPO | grep -q LiTtLeEnDiAn ; then
+ bigendian="no"
+ else
+ echo big/little test failed
diff --git a/app-emulation/qemu/files/qemu-9999-fix-firmware-path.patch b/app-emulation/qemu/files/qemu-9999-fix-firmware-path.patch
new file mode 100644
index 0000000..ffff314
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-9999-fix-firmware-path.patch
@@ -0,0 +1,17 @@
+Set absolute filename in files like
+ /usr/share/qemu/firmware/50-edk2-x86_64-secure.json
+
+Bug: https://bugs.gentoo.org/766743
+Bug: https://bugs.launchpad.net/qemu/+bug/1913012
+Patch-by: Jannik Glückert
+--- a/pc-bios/descriptors/meson.build
++++ b/pc-bios/descriptors/meson.build
+@@ -9,7 +9,7 @@ if install_edk2_blobs
+ ]
+ configure_file(input: files(f),
+ output: f,
+- configuration: {'DATADIR': qemu_datadir},
++ configuration: {'DATADIR': get_option('prefix') / qemu_datadir},
+ install: get_option('install_blobs'),
+ install_dir: qemu_datadir / 'firmware')
+ endforeach
diff --git a/app-emulation/qemu/files/qemu-binfmt.initd.head b/app-emulation/qemu/files/qemu-binfmt.initd.head
index 0dcacef..7bada95 100644
--- a/app-emulation/qemu/files/qemu-binfmt.initd.head
+++ b/app-emulation/qemu/files/qemu-binfmt.initd.head
@@ -1,5 +1,5 @@
#!/sbin/openrc-run
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# Enable automatic non-native program execution by the kernel.
diff --git a/app-emulation/qemu/metadata.xml b/app-emulation/qemu/metadata.xml
index 07244b5..ec3f45a 100644
--- a/app-emulation/qemu/metadata.xml
+++ b/app-emulation/qemu/metadata.xml
@@ -18,7 +18,7 @@
<flag name="aio">Enables support for Linux's Async IO</flag>
<flag name="alsa">Enable alsa output for sound emulation</flag>
<flag name="capstone">Enable disassembly support with <pkg>dev-libs/capstone</pkg></flag>
- <flag name="curl">Support ISOs / -cdrom directives vis HTTP or HTTPS.</flag>
+ <flag name="curl">Support ISOs / -cdrom directives via HTTP or HTTPS.</flag>
<flag name="fdt">Enables firmware device tree support</flag>
<flag name="glusterfs">Enables GlusterFS cluster fileystem via
<pkg>sys-cluster/glusterfs</pkg></flag>
@@ -28,6 +28,9 @@
<flag name="iscsi">Enable direct iSCSI support via
<pkg>net-libs/libiscsi</pkg> instead of indirectly via the Linux
block layer that <pkg>sys-block/open-iscsi</pkg> does.</flag>
+ <flag name="io-uring">Enable efficient I/O via <pkg>sys-libs/liburing</pkg>.</flag>
+ <flag name="multipath">Enable multipath persistent reservation passthrough via
+ <pkg>sys-fs/multipath-tools</pkg>.</flag>
<flag name="ncurses">Enable the ncurses-based console</flag>
<flag name="nfs">Enable NFS support</flag>
<flag name="numa">Enable NUMA support</flag>
@@ -39,12 +42,12 @@
<flag name="rbd">Enable rados block device backend support, see http://ceph.newdream.net/wiki/QEMU-RBD</flag>
<flag name="sdl">Enable the SDL-based console</flag>
<flag name="sdl-image">SDL Image support for icons</flag>
+ <flag name="slirp">Enable TCP/IP in hypervisor via <pkg>net-libs/libslirp</pkg></flag>
<flag name="spice">Enable Spice protocol support via <pkg>app-emulation/spice</pkg></flag>
<flag name="ssh">Enable SSH based block device support via <pkg>net-libs/libssh2</pkg></flag>
<flag name="static-user">Build the User targets as static binaries</flag>
<flag name="static">Build the User and Software MMU (system) targets as well as tools as static binaries</flag>
<flag name="systemtap">Enable SystemTAP/DTrace tracing</flag>
- <flag name="tci">Enable the TCG Interpreter which can speed up or slowdown workloads depending on the host and guest CPUs being emulated. In the future it will be a runtime option but for now its compile time.</flag>
<flag name="jemalloc">Enable jemalloc allocator support</flag>
<flag name="jpeg">Enable jpeg image support for the VNC console server</flag>
<flag name="png">Enable png image support for the VNC console server</flag>
@@ -57,11 +60,9 @@
<flag name="virtfs">Enable VirtFS via virtio-9p-pci / fsdev. See http://wiki.qemu.org/Documentation/9psetup</flag>
<flag name="vte">Enable terminal support (<pkg>x11-libs/vte</pkg>) in the GTK+ interface</flag>
<flag name="xattr">Add support for getting and setting POSIX extended attributes, through
- <pkg>sys-apps/attr</pkg>. Requisite for the virtfs backend.
- </flag>
+ <pkg>sys-apps/attr</pkg>. Requisite for the virtfs backend.</flag>
<flag name="xen">Enables support for Xen backends</flag>
<flag name="xfs">Support xfsctl() notification and syncing for XFS backed
virtual disks.</flag>
- <flag name="xkb">Depend on x11-libs/libxkbcommon to build qemu-keymap tool for converting xkb keymaps</flag>
</use>
</pkgmetadata>
diff --git a/app-emulation/qemu/qemu-4.2.0-r2.ebuild b/app-emulation/qemu/qemu-5.2.0-r2.ebuild
index 21b7710..549e0c7 100644
--- a/app-emulation/qemu/qemu-4.2.0-r2.ebuild
+++ b/app-emulation/qemu/qemu-5.2.0-r2.ebuild
@@ -1,13 +1,11 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI="7"
-PYTHON_COMPAT=( python3_7 )
+PYTHON_COMPAT=( python3_{7,8,9} )
PYTHON_REQ_USE="ncurses,readline"
-PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
-
FIRMWARE_ABI_VERSION="4.0.0-r50"
inherit eutils linux-info toolchain-funcs multilib python-r1 \
@@ -16,16 +14,16 @@ inherit eutils linux-info toolchain-funcs multilib python-r1 \
if [[ ${PV} = *9999* ]]; then
EGIT_REPO_URI="https://git.qemu.org/git/qemu.git"
EGIT_SUBMODULES=(
- slirp
- tests/fp/berkeley-{test,soft}float-3
+ meson
+ tests/fp/berkeley-softfloat-3
+ tests/fp/berkeley-testfloat-3
ui/keycodemapdb
)
inherit git-r3
SRC_URI=""
else
- SRC_URI="https://download.qemu.org/${P}.tar.xz
- https://dev.gentoo.org/~tamiko/distfiles/${P}-patches-r1.tar.xz"
- KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86"
+ SRC_URI="https://download.qemu.org/${P}.tar.xz"
+ KEYWORDS="amd64 arm64 ~ppc ~ppc64 x86"
fi
DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
@@ -35,18 +33,21 @@ LICENSE="GPL-2 LGPL-2 BSD-2"
SLOT="0"
IUSE="accessibility +aio alsa bzip2 capstone +caps +curl debug doc
- +fdt glusterfs gnutls gtk infiniband iscsi jemalloc +jpeg kernel_linux
- kernel_FreeBSD lzo ncurses nfs nls numa opengl +oss +pin-upstream-blobs
+ +fdt glusterfs gnutls gtk infiniband iscsi io-uring
+ jack jemalloc +jpeg kernel_linux
+ kernel_FreeBSD lzo multipath
+ ncurses nfs nls numa opengl +oss +pin-upstream-blobs
plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux
- smartcard snappy spice ssh static static-user systemtap tci test usb
+ +slirp
+ smartcard snappy spice ssh static static-user systemtap test udev usb
usbredir vde +vhost-net vhost-user-fs virgl virtfs +vnc vte xattr xen
- xfs +xkb"
+ xfs zstd"
COMMON_TARGETS="aarch64 alpha arm cris hppa i386 m68k microblaze microblazeel
mips mips64 mips64el mipsel nios2 or1k ppc ppc64 riscv32 riscv64 s390x
sh4 sh4eb sparc sparc64 x86_64 xtensa xtensaeb"
IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS}
- lm32 moxie tricore unicore32"
+ avr lm32 moxie rx tricore unicore32"
IUSE_USER_TARGETS="${COMMON_TARGETS}
aarch64_be armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus
tilegx"
@@ -66,10 +67,12 @@ REQUIRED_USE="${PYTHON_REQUIRED_USE}
qemu_softmmu_targets_ppc? ( fdt )
qemu_softmmu_targets_riscv32? ( fdt )
qemu_softmmu_targets_riscv64? ( fdt )
- static? ( static-user !alsa !gtk !opengl !pulseaudio !plugins !rbd !snappy )
+ static? ( static-user !alsa !gtk !jack !opengl !pulseaudio !plugins !rbd !snappy )
static-user? ( !plugins )
- virtfs? ( xattr )
+ vhost-user-fs? ( caps seccomp )
+ virtfs? ( caps xattr )
vte? ( gtk )
+ multipath? ( udev )
plugins? ( !static !static-user )
"
@@ -92,7 +95,6 @@ ALL_DEPEND="
# softmmu targets (qemu-system-*).
SOFTMMU_TOOLS_DEPEND="
dev-libs/libxml2[static-libs(+)]
- xkb? ( x11-libs/libxkbcommon[static-libs(+)] )
>=x11-libs/pixman-0.28.0[static-libs(+)]
accessibility? (
app-accessibility/brltty[api]
@@ -120,9 +122,12 @@ SOFTMMU_TOOLS_DEPEND="
sys-fabric/librdmacm:=[static-libs(+)]
)
iscsi? ( net-libs/libiscsi )
+ io-uring? ( sys-libs/liburing:=[static-libs(+)] )
+ jack? ( virtual/jack )
jemalloc? ( dev-libs/jemalloc )
jpeg? ( virtual/jpeg:0=[static-libs(+)] )
lzo? ( dev-libs/lzo:2[static-libs(+)] )
+ multipath? ( sys-fs/multipath-tools )
ncurses? (
sys-libs/ncurses:0=[unicode]
sys-libs/ncurses:0=[static-libs(+)]
@@ -140,11 +145,12 @@ SOFTMMU_TOOLS_DEPEND="
rbd? ( sys-cluster/ceph )
sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
sdl? (
- media-libs/libsdl2[X]
+ media-libs/libsdl2[video]
media-libs/libsdl2[static-libs(+)]
)
sdl-image? ( media-libs/sdl2-image[static-libs(+)] )
seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+ slirp? ( net-libs/libslirp[static-libs(+)] )
smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
snappy? ( app-arch/snappy:= )
spice? (
@@ -152,28 +158,31 @@ SOFTMMU_TOOLS_DEPEND="
>=app-emulation/spice-0.12.0[static-libs(+)]
)
ssh? ( >=net-libs/libssh-0.8.6[static-libs(+)] )
+ udev? ( virtual/libudev[static-libs(+)] )
usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
vde? ( net-misc/vde[static-libs(+)] )
virgl? ( media-libs/virglrenderer[static-libs(+)] )
virtfs? ( sys-libs/libcap )
xen? ( app-emulation/xen-tools:= )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )
+ zstd? ( >=app-arch/zstd-1.4.0[static-libs(+)] )
+"
X86_FIRMWARE_DEPEND="
pin-upstream-blobs? (
~sys-firmware/edk2-ovmf-201905[binary]
- ~sys-firmware/ipxe-1.0.0_p20190728[binary]
+ ~sys-firmware/ipxe-1.0.0_p20190728[binary,qemu]
~sys-firmware/seabios-1.12.0[binary,seavgabios]
~sys-firmware/sgabios-0.1_pre8[binary]
)
!pin-upstream-blobs? (
sys-firmware/edk2-ovmf
- sys-firmware/ipxe
+ sys-firmware/ipxe[qemu]
>=sys-firmware/seabios-1.10.2[seavgabios]
sys-firmware/sgabios
)"
-PPC64_FIRMWARE_DEPEND="
+PPC_FIRMWARE_DEPEND="
pin-upstream-blobs? (
~sys-firmware/seabios-1.12.0[binary,seavgabios]
)
@@ -201,7 +210,8 @@ CDEPEND="
)
qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_ppc64? ( ${PPC64_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_ppc? ( ${PPC_FIRMWARE_DEPEND} )
+ qemu_softmmu_targets_ppc64? ( ${PPC_FIRMWARE_DEPEND} )
"
DEPEND="${CDEPEND}
kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
@@ -215,13 +225,12 @@ RDEPEND="${CDEPEND}
selinux? ( sec-policy/selinux-qemu )"
PATCHES=(
- "${FILESDIR}"/${PN}-2.5.0-cflags.patch
- "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
"${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
- "${FILESDIR}"/${PN}-4.0.0-sanitize-interp_info.patch
- "${FILESDIR}"/${PN}-4.0.0-mkdir_systemtap.patch #684902
- "${WORKDIR}"/patches
- "${FILESDIR}"/${PN}-4.2.0-r2-musl.patch
+ "${FILESDIR}"/${PN}-5.2.0-cleaner-werror.patch
+ "${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
+ "${FILESDIR}"/${PN}-5.2.0-strings.patch
+ "${FILESDIR}"/${PN}-5.2.0-fix-firmware-path.patch
+ "${FILESDIR}"/${PN}-5.2.0-no-pie-ld.patch
)
QA_PREBUILT="
@@ -229,10 +238,13 @@ QA_PREBUILT="
usr/share/qemu/openbios-ppc
usr/share/qemu/openbios-sparc64
usr/share/qemu/openbios-sparc32
+ usr/share/qemu/opensbi-riscv64-generic-fw_dynamic.elf
+ usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.elf
usr/share/qemu/palcode-clipper
usr/share/qemu/s390-ccw.img
usr/share/qemu/s390-netboot.img
- usr/share/qemu/u-boot.e500"
+ usr/share/qemu/u-boot.e500
+"
QA_WX_LOAD="usr/bin/qemu-i386
usr/bin/qemu-x86_64
@@ -255,7 +267,8 @@ QA_WX_LOAD="usr/bin/qemu-i386
usr/bin/qemu-armeb
usr/bin/qemu-sparc32plus
usr/bin/qemu-s390x
- usr/bin/qemu-unicore32"
+ usr/bin/qemu-unicore32
+"
DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
kernel module loaded before running kvm. The easiest way to ensure that the
@@ -280,7 +293,7 @@ For systemd:
pkg_pretend() {
if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
+ eerror "This version of KVM requires a host kernel of 2.6.25 or higher."
elif use kernel_linux; then
if ! linux_config_exists; then
eerror "Unable to check your kernel for KVM support"
@@ -330,7 +343,7 @@ check_targets() {
local var=$1 mak=$2
local detected sorted
- pushd "${S}"/default-configs >/dev/null || die
+ pushd "${S}"/default-configs/targets/ >/dev/null || die
# Force C locale until glibc is updated. #564936
detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
@@ -345,29 +358,6 @@ check_targets() {
popd >/dev/null
}
-handle_locales() {
- # Make sure locale list is kept up-to-date.
- local detected sorted
- detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
- sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "PLOCALES: ${sorted}"
- eerror " po/*.po: ${detected}"
- die "sync PLOCALES"
- fi
-
- # Deal with selective install of locales.
- if use nls ; then
- # Delete locales the user does not want. #577814
- rm_loc() { rm po/$1.po || die; }
- l10n_for_each_disabled_locale_do rm_loc
- else
- # Cheap hack to disable gettext .mo generation.
- rm -f po/*.po
- fi
-}
-
src_prepare() {
check_targets IUSE_SOFTMMU_TARGETS softmmu
check_targets IUSE_USER_TARGETS linux-user
@@ -375,17 +365,32 @@ src_prepare() {
default
# Use correct toolchain to fix cross-compiling
- tc-export AR LD NM OBJCOPY PKG_CONFIG
+ tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB STRINGS
export WINDRES=${CHOST}-windres
# Verbose builds
MAKEOPTS+=" V=1"
- # Run after we've applied all patches.
- handle_locales
-
# Remove bundled copy of libfdt
rm -r dtc || die
+
+ # conditionally apply patches for musl support
+ if use elibc_musl ; then
+ eapply "${FILESDIR}"/musl-patches/0001-linux-user-fix-build-with-musl-on-aarch64.patch
+ eapply "${FILESDIR}"/musl-patches/0001-linux-user-fix-build-with-musl-on-ppc64le.patch
+ eapply "${FILESDIR}"/musl-patches/0001-virtio-host-input-use-safe-64-bit-time-accessors-for.patch
+ eapply "${FILESDIR}"/musl-patches/0002-virtio-user-input-use-safe-64-bit-time-accessors-for.patch
+ eapply "${FILESDIR}"/musl-patches/0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch
+ eapply "${FILESDIR}"/musl-patches/MAP_SYNC-fix.patch
+ eapply "${FILESDIR}"/musl-patches/fix-segevent-and-sigval_t.patch
+ eapply "${FILESDIR}"/musl-patches/fix-sendmsg.patch
+ eapply "${FILESDIR}"/musl-patches/fix-sockios-header.patch
+ eapply "${FILESDIR}"/musl-patches/guest-agent-shutdown.patch
+ eapply "${FILESDIR}"/musl-patches/ignore-signals-33-and-64-to-allow-golang-emulation.patch
+ eapply "${FILESDIR}"/musl-patches/mips-softfloat.patch
+ eapply "${FILESDIR}"/musl-patches/musl-F_SHLCK-and-F_EXLCK.patch
+ eapply "${FILESDIR}"/musl-patches/xattr_size_max.patch
+ fi
}
##
@@ -408,11 +413,21 @@ qemu_src_configure() {
--datadir=/usr/share
--docdir=/usr/share/doc/${PF}/html
--mandir=/usr/share/man
- --with-confsuffix=/qemu
--localstatedir=/var
--disable-bsd-user
+ --disable-containers # bug #732972
--disable-guest-agent
--disable-strip
+
+ # bug #746752: TCG interpreter has a few limitations:
+ # - it does not support FPU
+ # - it's generally slower on non-self-modifying code
+ # It's advantage is support for host architectures
+ # where native codegeneration is not implemented.
+ # Gentoo has qemu keyworded only on targets with
+ # native code generation available. Avoid the interpreter.
+ --disable-tcg-interpreter
+
--disable-werror
# We support gnutls/nettle for crypto operations. It is possible
# to use gcrypt when gnutls/nettle are disabled (but not when they
@@ -426,8 +441,8 @@ qemu_src_configure() {
$(use_enable debug debug-info)
$(use_enable debug debug-tcg)
$(use_enable doc docs)
+ $(use_enable nls gettext)
$(use_enable plugins)
- $(use_enable tci tcg-interpreter)
$(use_enable xattr attr)
)
@@ -440,8 +455,23 @@ qemu_src_configure() {
use_enable "$@"
fi
}
+ # Enable option only for softmmu build, but not 'user' or 'tools'
+ conf_softmmu() {
+ if [[ ${buildtype} == "softmmu" ]] ; then
+ use_enable "$@"
+ else
+ echo "--disable-${2:-$1}"
+ fi
+ }
+ # Enable option only for tools build, but not 'user' or 'softmmu'
+ conf_tools() {
+ if [[ ${buildtype} == "tools" ]] ; then
+ use_enable "$@"
+ else
+ echo "--disable-${2:-$1}"
+ fi
+ }
conf_opts+=(
- --disable-bluez
$(conf_notuser accessibility brlapi)
$(conf_notuser aio linux-aio)
$(conf_notuser bzip2)
@@ -455,10 +485,12 @@ qemu_src_configure() {
$(conf_notuser gtk)
$(conf_notuser infiniband rdma)
$(conf_notuser iscsi libiscsi)
+ $(conf_notuser io-uring linux-io-uring)
$(conf_notuser jemalloc jemalloc)
$(conf_notuser jpeg vnc-jpeg)
$(conf_notuser kernel_linux kvm)
$(conf_notuser lzo)
+ $(conf_notuser multipath mpath)
$(conf_notuser ncurses curses)
$(conf_notuser nfs libnfs)
$(conf_notuser numa)
@@ -467,17 +499,20 @@ qemu_src_configure() {
$(conf_notuser rbd)
$(conf_notuser sasl vnc-sasl)
$(conf_notuser sdl)
- $(conf_notuser sdl-image)
+ $(conf_softmmu sdl-image)
$(conf_notuser seccomp)
+ $(conf_notuser slirp slirp system)
$(conf_notuser smartcard)
$(conf_notuser snappy)
$(conf_notuser spice)
$(conf_notuser ssh libssh)
+ $(conf_notuser udev libudev)
$(conf_notuser usb libusb)
$(conf_notuser usbredir usb-redir)
$(conf_notuser vde)
$(conf_notuser vhost-net)
$(conf_notuser vhost-user-fs)
+ $(conf_tools vhost-user-fs virtiofsd)
$(conf_notuser virgl virglrenderer)
$(conf_notuser virtfs)
$(conf_notuser vnc)
@@ -485,7 +520,9 @@ qemu_src_configure() {
$(conf_notuser xen)
$(conf_notuser xen xen-pci-passthrough)
$(conf_notuser xfs xfsctl)
- $(conf_notuser xkb xkbcommon)
+ # use prebuilt keymaps, bug #759604
+ --disable-xkbcommon
+ $(conf_notuser zstd)
)
if [[ ${buildtype} == "user" ]] ; then
@@ -497,10 +534,13 @@ qemu_src_configure() {
if [[ ! ${buildtype} == "user" ]] ; then
# audio options
local audio_opts=(
+ # Note: backend order matters here: #716202
+ # We iterate from higher-level to lower level.
+ $(usex pulseaudio pa "")
+ $(usev jack)
+ $(usev sdl)
$(usev alsa)
$(usev oss)
- $(usev sdl)
- $(usex pulseaudio pa "")
)
conf_opts+=(
--audio-drv-list=$(printf "%s," "${audio_opts[@]}")
@@ -551,6 +591,10 @@ qemu_src_configure() {
tc-enables-pie && conf_opts+=( --enable-pie )
fi
+ # Plumb through equivalent of EXTRA_ECONF to allow experiments
+ # like bug #747928.
+ conf_opts+=( ${EXTRA_CONF_QEMU} )
+
echo "../configure ${conf_opts[*]}"
cd "${builddir}"
../configure "${conf_opts[@]}" || die "configure failed"
@@ -610,8 +654,7 @@ src_test() {
if [[ -n ${softmmu_targets} ]]; then
cd "${S}/softmmu-build"
pax-mark m */qemu-system-* #515550
- emake -j1 check
- emake -j1 check-report.html
+ emake check
fi
}
@@ -719,7 +762,7 @@ src_install() {
doins "${FILESDIR}/bridge.conf"
cd "${S}"
- dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
+ dodoc MAINTAINERS docs/specs/pci-ids.txt
newdoc pc-bios/README README.pc-bios
# Disallow stripping of prebuilt firmware files.
@@ -741,8 +784,8 @@ src_install() {
rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- # PPC64 loads vgabios-stdvga
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc64; then
+ # PPC/PPC64 loads vgabios-stdvga
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64; then
dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin