qemu: fix building on mips arch
authorYousong Zhou <redacted>
Mon, 30 Mar 2020 05:15:38 +0000 (13:15 +0800)
committerYousong Zhou <redacted>
Mon, 30 Mar 2020 05:23:39 +0000 (13:23 +0800)
Add fallback zero value definition for MAP_SYNC etc. even when building
for CONFIG_LINUX.

Fixes openwrt/packages#11067

Reported-by: Rosen Penev <redacted>
Signed-off-by: Yousong Zhou <redacted>
utils/qemu/Makefile
utils/qemu/patches/0001-configure-allow-disable-fortify_source.patch
utils/qemu/patches/0002-configure-allow-enabling-disabling-libudev-from-comm.patch
utils/qemu/patches/0003-configure-enable-guest_agent-no-matter-whether-softm.patch
utils/qemu/patches/0004-disas-fix-compilation-failure-when-isnan-is-a-macro.patch
utils/qemu/patches/0005-pc-bios-fix-compilation-when-AS-is-actually-gcc-driv.patch
utils/qemu/patches/0006-util-mmap-alloc-fix-missing-MAP_SYNC.patch [new file with mode: 0644]

index bffc10b54479d5e33b02aee25db2a09db6829372..82bf64e1d2375a181171ab2b0e8257583f39c234 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=qemu
 PKG_VERSION:=4.2.0
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_HASH:=d3481d4108ce211a053ef15be69af1bdd9dde1510fda80d92be0f6c3e98768f0
 PKG_SOURCE_URL:=http://download.qemu.org/
index d2e9823c4f36670aee147e5c269dcb3ce2f39455..e3c29dc12557ae36d937479255156e31c9d4d67d 100644 (file)
@@ -1,7 +1,7 @@
 From d4fcdea769a4629c874ebe1801d83e854c94d5e4 Mon Sep 17 00:00:00 2001
 From: Yousong Zhou <yszhou4tech@gmail.com>
 Date: Sat, 24 Feb 2018 13:43:19 +0800
-Subject: [PATCH 1/5] configure: allow disable fortify_source
+Subject: [PATCH] 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
index cdd8b3d01caaa0b8c304e72514116e9b9b8bbe48..2bc6446bf1ae4009434c180716010848990a2a93 100644 (file)
@@ -1,8 +1,7 @@
 From 2a6ab8342245c8dc2a09478d8eb0292e2dbcecf2 Mon Sep 17 00:00:00 2001
 From: Yousong Zhou <yszhou4tech@gmail.com>
 Date: Tue, 2 Apr 2019 06:31:31 +0000
-Subject: [PATCH 2/5] configure: allow enabling/disabling libudev from command
- line
+Subject: [PATCH] configure: allow enabling/disabling libudev from command line
 
 ---
  configure | 4 ++++
index 8ac16c6a70c1ac02592c86869fdb4b78e934efba..bedf363c5dabe2a2acc7b4589cff103bbb7f7d88 100644 (file)
@@ -1,8 +1,8 @@
 From 296215421441b73bc6eb487f1d4e7e15e0510a77 Mon Sep 17 00:00:00 2001
 From: Yousong Zhou <yszhou4tech@gmail.com>
 Date: Fri, 7 Feb 2020 03:02:44 +0800
-Subject: [PATCH 3/5] configure: enable guest_agent no matter whether softmmu
is enabled
+Subject: [PATCH] configure: enable guest_agent no matter whether softmmu is
+ enabled
 
 guest_agent as a tool to be run on guest machines does not depend on
 whether there is a softmmu is to be built at this configure/make run
index 8b85b5dde1638cf47ecf567d63054fea048a2f76..c7b2f92ae288a6636b36d85771b151dc6b77d2bd 100644 (file)
@@ -1,7 +1,7 @@
 From 3ac531a6bdeecbe40741a76f1dc2b7fa6c11f8ef Mon Sep 17 00:00:00 2001
 From: Yousong Zhou <yszhou4tech@gmail.com>
 Date: Sat, 24 Feb 2018 13:45:25 +0800
-Subject: [PATCH 4/5] disas: fix compilation failure when isnan is a macro
+Subject: [PATCH] disas: fix compilation failure when isnan is a macro
 
 ---
  disas/libvixl/vixl/utils.h | 16 +++++++++++-----
index 02dca03cf96bfadec47523b286aa161b845904fb..a3846b373af3398b055887b88c2bf391ba1c0aca 100644 (file)
@@ -1,8 +1,7 @@
 From b6223a90ebbb5729e41b4fcb3bc9ac309ec04784 Mon Sep 17 00:00:00 2001
 From: Yousong Zhou <yszhou4tech@gmail.com>
 Date: Sat, 24 Feb 2018 13:46:31 +0800
-Subject: [PATCH 5/5] pc-bios: fix compilation when $(AS) is actually gcc
- driver
+Subject: [PATCH] pc-bios: fix compilation when $(AS) is actually gcc driver
 
 ---
  pc-bios/optionrom/Makefile | 4 ++--
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
new file mode 100644 (file)
index 0000000..53eaf08
--- /dev/null
@@ -0,0 +1,50 @@
+From f385b623c14b5208df88b0be479a9ab30ab68c72 Mon Sep 17 00:00:00 2001
+From: Yousong Zhou <yszhou4tech@gmail.com>
+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 <yszhou4tech@gmail.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 27dcccd8ec..e133e38d21 100644
+--- 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"
+@@ -27,6 +24,13 @@
+ #include <sys/vfs.h>
+ #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
git clone https://git.99rst.org/PROJECT