qemu: refresh patches to include git headers
authorVladimir Ermakov <[email protected]>
Tue, 27 May 2025 07:59:16 +0000 (09:59 +0200)
committerJosef Schlehofer <[email protected]>
Sun, 22 Jun 2025 07:54:52 +0000 (09:54 +0200)
Use git format-patch to be able to use git am later, to fix openwrt/openwrt#10272 .
Remove patch to skip tests as not needed anymore.
Then apply refresh.

Signed-off-by: Vladimir Ermakov <[email protected]>
utils/qemu/patches/0001-configure-allow-disable-fortify_source.patch
utils/qemu/patches/0002-util-mmap-alloc-fix-missing-MAP_SYNC.patch [new file with mode: 0644]
utils/qemu/patches/0003-qga-invoke-separate-applets-for-guest-shutdown-modes.patch [new file with mode: 0644]
utils/qemu/patches/0004-fix-meson-cross-build-compiler-sanity-check.patch [new file with mode: 0644]
utils/qemu/patches/0006-util-mmap-alloc-fix-missing-MAP_SYNC.patch [deleted file]
utils/qemu/patches/0007-qga-invoke-separate-applets-for-guest-shutdown-modes.patch [deleted file]
utils/qemu/patches/0010-no-tests.patch [deleted file]
utils/qemu/patches/0011-meson-fix.patch [deleted file]

index 5b178eccbb31ef51abda9f0e741356ae2a4de6d7..41770ed88bd42ff22ec407228c8c4f85df3d5ba1 100644 (file)
@@ -1,7 +1,7 @@
-From 871bc03884e8dd4a4b50d05022e347e72f4733d9 Mon Sep 17 00:00:00 2001
+From f0ada26ef03a37aa4b8c97246b93ab3bdf1db580 Mon Sep 17 00:00:00 2001
 From: Yousong Zhou <[email protected]>
 Date: Mon, 11 May 2020 10:46:09 +0800
-Subject: [PATCH] configure: allow disable fortify_source
+Subject: [PATCH 1/4] configure: allow disable fortify_source
 
 Tell build system of qemu to not add _FORTIFY_SOURCE options and let the
 OpenWrt base build system decide flavor of fortify_source to use
diff --git a/utils/qemu/patches/0002-util-mmap-alloc-fix-missing-MAP_SYNC.patch b/utils/qemu/patches/0002-util-mmap-alloc-fix-missing-MAP_SYNC.patch
new file mode 100644 (file)
index 0000000..904a1cd
--- /dev/null
@@ -0,0 +1,48 @@
+From b2cd62027dbf41c3cd5354ed1a5f73c5e26b1811 Mon Sep 17 00:00:00 2001
+From: Yousong Zhou <[email protected]>
+Date: Mon, 30 Mar 2020 12:48:58 +0800
+Subject: [PATCH 2/4] util/mmap-alloc: fix missing MAP_SYNC
+
+Quote musl-libc commit 9b57db3f958 ("add MAP_SYNC and
+MAP_SHARED_VALIDATE from linux v4.15")
+
+ > for synchronous page faults, new in linux commit
+ > 1c9725974074a047f6080eecc62c50a8e840d050 and
+ > b6fb293f2497a9841d94f6b57bd2bb2cd222da43
+ > note that only targets that use asm-generic/mman.h have this new
+ > flag defined, so undef it on other targets (mips*, powerpc*).
+
+Fixes 119906afa5c ("util/mmap-alloc: support MAP_SYNC in
+qemu_ram_mmap()")
+
+Signed-off-by: Yousong Zhou <[email protected]>
+---
+ util/mmap-alloc.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+--- a/util/mmap-alloc.c
++++ b/util/mmap-alloc.c
+@@ -12,9 +12,6 @@
+ #ifdef CONFIG_LINUX
+ #include <linux/mman.h>
+-#else  /* !CONFIG_LINUX */
+-#define MAP_SYNC              0x0
+-#define MAP_SHARED_VALIDATE   0x0
+ #endif /* CONFIG_LINUX */
+ #include "qemu/osdep.h"
+@@ -57,6 +54,13 @@ QemuFsType qemu_fd_getfs(int fd)
+ #endif
+ }
++#ifndef MAP_SYNC
++#define MAP_SYNC              0x0
++#endif
++#ifndef MAP_SHARED_VALIDATE
++#define MAP_SHARED_VALIDATE   0x0
++#endif
++
+ size_t qemu_fd_getpagesize(int fd)
+ {
+ #ifdef CONFIG_LINUX
diff --git a/utils/qemu/patches/0003-qga-invoke-separate-applets-for-guest-shutdown-modes.patch b/utils/qemu/patches/0003-qga-invoke-separate-applets-for-guest-shutdown-modes.patch
new file mode 100644 (file)
index 0000000..68128bf
--- /dev/null
@@ -0,0 +1,61 @@
+From 3e7a53edd1ffc948e1f46b3493e0c0381e437980 Mon Sep 17 00:00:00 2001
+From: Vladimir Ermakov <[email protected]>
+Date: Tue, 27 May 2025 09:53:37 +0200
+Subject: [PATCH 3/4] qga: invoke separate applets for guest shutdown modes
+
+Origin: community/qemu: fix qemu-guest-agent patch
+https://gitlab.alpinelinux.org/alpine/aports/-/blob/b720d51ec844d4754dd5b29084350aa1f5c9a74d/community/qemu/guest-agent-shutdown.patch
+---
+ qga/commands-posix.c | 30 ++++--------------------------
+ 1 file changed, 4 insertions(+), 26 deletions(-)
+
+--- a/qga/commands-posix.c
++++ b/qga/commands-posix.c
+@@ -218,43 +218,21 @@ void qmp_guest_shutdown(const char *mode
+     const char *shutdown_flag;
+     Error *local_err = NULL;
+-#ifdef CONFIG_SOLARIS
+-    const char *powerdown_flag = "-i5";
+-    const char *halt_flag = "-i0";
+-    const char *reboot_flag = "-i6";
+-#elif defined(CONFIG_BSD)
+-    const char *powerdown_flag = "-p";
+-    const char *halt_flag = "-h";
+-    const char *reboot_flag = "-r";
+-#else
+-    const char *powerdown_flag = "-P";
+-    const char *halt_flag = "-H";
+-    const char *reboot_flag = "-r";
+-#endif
++    const char *argv[] = {NULL, NULL};
+     slog("guest-shutdown called, mode: %s", mode);
+     if (!mode || strcmp(mode, "powerdown") == 0) {
+-        shutdown_flag = powerdown_flag;
++        argv[0] = "poweroff";
+     } else if (strcmp(mode, "halt") == 0) {
+-        shutdown_flag = halt_flag;
++        argv[0] = "halt";
+     } else if (strcmp(mode, "reboot") == 0) {
+-        shutdown_flag = reboot_flag;
++        argv[0] = "reboot";
+     } else {
+         error_setg(errp,
+                    "mode is invalid (valid values are: halt|powerdown|reboot");
+         return;
+     }
+-    const char *argv[] = {"/sbin/shutdown",
+-#ifdef CONFIG_SOLARIS
+-                          shutdown_flag, "-g0", "-y",
+-#elif defined(CONFIG_BSD)
+-                          shutdown_flag, "+0",
+-#else
+-                          "-h", shutdown_flag, "+0",
+-#endif
+-                          "hypervisor initiated shutdown", (char *) NULL};
+-
+     ga_run_command(argv, NULL, "shutdown", &local_err);
+     if (local_err) {
+         error_propagate(errp, local_err);
diff --git a/utils/qemu/patches/0004-fix-meson-cross-build-compiler-sanity-check.patch b/utils/qemu/patches/0004-fix-meson-cross-build-compiler-sanity-check.patch
new file mode 100644 (file)
index 0000000..ceee68d
--- /dev/null
@@ -0,0 +1,19 @@
+From a41fe59d9ed66f807f3410408699b0b0b8afea3d Mon Sep 17 00:00:00 2001
+From: Vladimir Ermakov <[email protected]>
+Date: Tue, 27 May 2025 09:57:50 +0200
+Subject: [PATCH 4/4] fix meson cross-build compiler sanity check
+
+---
+ configure | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/configure
++++ b/configure
+@@ -1845,6 +1845,7 @@ if test "$skip_meson" = no; then
+   echo "# Automatically generated by configure - do not modify" > $cross
+   echo "[properties]" >> $cross
++  echo "needs_exe_wrapper = true" >> $cross
+   # unroll any custom device configs
+   for a in $device_archs; do
diff --git a/utils/qemu/patches/0006-util-mmap-alloc-fix-missing-MAP_SYNC.patch b/utils/qemu/patches/0006-util-mmap-alloc-fix-missing-MAP_SYNC.patch
deleted file mode 100644 (file)
index f8bfa67..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-From e1e0a76305927290d75b4aae56f1ed89d83da741 Mon Sep 17 00:00:00 2001
-From: Yousong Zhou <[email protected]>
-Date: Mon, 30 Mar 2020 12:48:58 +0800
-Subject: [PATCH] util/mmap-alloc: fix missing MAP_SYNC
-
-Quote musl-libc commit 9b57db3f958 ("add MAP_SYNC and
-MAP_SHARED_VALIDATE from linux v4.15")
-
- > for synchronous page faults, new in linux commit
- > 1c9725974074a047f6080eecc62c50a8e840d050 and
- > b6fb293f2497a9841d94f6b57bd2bb2cd222da43
- > note that only targets that use asm-generic/mman.h have this new
- > flag defined, so undef it on other targets (mips*, powerpc*).
-
-Fixes 119906afa5c ("util/mmap-alloc: support MAP_SYNC in
-qemu_ram_mmap()")
-
-Signed-off-by: Yousong Zhou <[email protected]>
----
- util/mmap-alloc.c | 10 +++++++---
- 1 file changed, 7 insertions(+), 3 deletions(-)
-
---- a/util/mmap-alloc.c
-+++ b/util/mmap-alloc.c
-@@ -12,9 +12,6 @@
- #ifdef CONFIG_LINUX
- #include <linux/mman.h>
--#else  /* !CONFIG_LINUX */
--#define MAP_SYNC              0x0
--#define MAP_SHARED_VALIDATE   0x0
- #endif /* CONFIG_LINUX */
- #include "qemu/osdep.h"
-@@ -57,6 +54,13 @@ QemuFsType qemu_fd_getfs(int fd)
- #endif
- }
-+#ifndef MAP_SYNC
-+#define MAP_SYNC              0x0
-+#endif
-+#ifndef MAP_SHARED_VALIDATE
-+#define MAP_SHARED_VALIDATE   0x0
-+#endif
-+
- size_t qemu_fd_getpagesize(int fd)
- {
- #ifdef CONFIG_LINUX
diff --git a/utils/qemu/patches/0007-qga-invoke-separate-applets-for-guest-shutdown-modes.patch b/utils/qemu/patches/0007-qga-invoke-separate-applets-for-guest-shutdown-modes.patch
deleted file mode 100644 (file)
index 667bee8..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-Origin: community/qemu: fix qemu-guest-agent patch
-https://gitlab.alpinelinux.org/alpine/aports/-/blob/b720d51ec844d4754dd5b29084350aa1f5c9a74d/community/qemu/guest-agent-shutdown.patch
----
---- a/qga/commands-posix.c
-+++ b/qga/commands-posix.c
-@@ -218,43 +218,21 @@ void qmp_guest_shutdown(const char *mode
-     const char *shutdown_flag;
-     Error *local_err = NULL;
--#ifdef CONFIG_SOLARIS
--    const char *powerdown_flag = "-i5";
--    const char *halt_flag = "-i0";
--    const char *reboot_flag = "-i6";
--#elif defined(CONFIG_BSD)
--    const char *powerdown_flag = "-p";
--    const char *halt_flag = "-h";
--    const char *reboot_flag = "-r";
--#else
--    const char *powerdown_flag = "-P";
--    const char *halt_flag = "-H";
--    const char *reboot_flag = "-r";
--#endif
-+    const char *argv[] = {NULL, NULL};
-     slog("guest-shutdown called, mode: %s", mode);
-     if (!mode || strcmp(mode, "powerdown") == 0) {
--        shutdown_flag = powerdown_flag;
-+        argv[0] = "poweroff";
-     } else if (strcmp(mode, "halt") == 0) {
--        shutdown_flag = halt_flag;
-+        argv[0] = "halt";
-     } else if (strcmp(mode, "reboot") == 0) {
--        shutdown_flag = reboot_flag;
-+        argv[0] = "reboot";
-     } else {
-         error_setg(errp,
-                    "mode is invalid (valid values are: halt|powerdown|reboot");
-         return;
-     }
--    const char *argv[] = {"/sbin/shutdown",
--#ifdef CONFIG_SOLARIS
--                          shutdown_flag, "-g0", "-y",
--#elif defined(CONFIG_BSD)
--                          shutdown_flag, "+0",
--#else
--                          "-h", shutdown_flag, "+0",
--#endif
--                          "hypervisor initiated shutdown", (char *) NULL};
--
-     ga_run_command(argv, NULL, "shutdown", &local_err);
-     if (local_err) {
-         error_propagate(errp, local_err);
diff --git a/utils/qemu/patches/0010-no-tests.patch b/utils/qemu/patches/0010-no-tests.patch
deleted file mode 100644 (file)
index c72bbda..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
---- a/meson.build
-+++ b/meson.build
-@@ -3828,10 +3828,6 @@ subdir('common-user')
- subdir('bsd-user')
- subdir('linux-user')
--# needed for fuzzing binaries
--subdir('tests/qtest/libqos')
--subdir('tests/qtest/fuzz')
--
- # accel modules
- target_modules += { 'accel' : { 'qtest': qtest_module_ss }}
-@@ -4456,10 +4452,6 @@ subdir('scripts')
- subdir('tools')
- subdir('pc-bios')
- subdir('docs')
--subdir('tests')
--if gtk.found()
--  subdir('po')
--endif
- if host_machine.system() == 'windows'
-   nsis_cmd = [
diff --git a/utils/qemu/patches/0011-meson-fix.patch b/utils/qemu/patches/0011-meson-fix.patch
deleted file mode 100644 (file)
index ab09e2a..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/configure
-+++ b/configure
-@@ -1845,6 +1845,7 @@ if test "$skip_meson" = no; then
-   echo "# Automatically generated by configure - do not modify" > $cross
-   echo "[properties]" >> $cross
-+  echo "needs_exe_wrapper = true" >> $cross
-   # unroll any custom device configs
-   for a in $device_archs; do