- qemu-user: add host binary support for binfmt
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=44
This commit is contained in:
parent
40867f434d
commit
46f9889b99
53
0052-linux-user-binfmt-support-host-binaries.patch
Normal file
53
0052-linux-user-binfmt-support-host-binaries.patch
Normal file
@ -0,0 +1,53 @@
|
||||
From 8bee58e4c32a1962ae0107fc3db6bafb4ba3f20a Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Graf <agraf@suse.de>
|
||||
Date: Thu, 2 Feb 2012 18:02:33 +0100
|
||||
Subject: [PATCH] linux-user: binfmt: support host binaries
|
||||
|
||||
When we have a working host binary equivalent for the guest binary we're
|
||||
trying to run, let's just use that instead as it will be a lot faster.
|
||||
|
||||
Signed-off-by: Alexander Graf <agraf@suse.de>
|
||||
---
|
||||
linux-user/binfmt.c | 19 +++++++++++++++++++
|
||||
1 files changed, 19 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/linux-user/binfmt.c b/linux-user/binfmt.c
|
||||
index cd1f513..8c294da 100644
|
||||
--- a/linux-user/binfmt.c
|
||||
+++ b/linux-user/binfmt.c
|
||||
@@ -5,6 +5,10 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
+#define GNEMUL_PATH "/usr/bin/gnemul/qemu-"
|
||||
+#ifdef __x86_64__
|
||||
+#define ARCH_NAME "x86_64"
|
||||
+#endif
|
||||
|
||||
int main(int argc, char **argv, char **envp)
|
||||
{
|
||||
@@ -25,6 +29,21 @@ int main(int argc, char **argv, char **envp)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
+#ifdef ARCH_NAME
|
||||
+ {
|
||||
+ char *hostbin;
|
||||
+ hostbin = malloc(strlen(argv[1] + strlen(GNEMUL_PATH) + 1));
|
||||
+ sprintf(hostbin, GNEMUL_PATH ARCH_NAME "%s", argv[1]);
|
||||
+ if (!access(hostbin, X_OK)) {
|
||||
+ /*
|
||||
+ * We found a host binary replacement for the non-host binary. Let's
|
||||
+ * use that instead!
|
||||
+ */
|
||||
+ return execve(hostbin, &argv[2], envp);
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
binfmt[0] = '\0';
|
||||
/* Now argv[0] is the real qemu binary name */
|
||||
|
||||
--
|
||||
1.6.0.2
|
||||
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Feb 2 15:28:42 UTC 2012 - agraf@suse.de
|
||||
|
||||
- qemu-user: add host binary support for binfmt
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Feb 2 00:41:21 UTC 2012 - agraf@suse.de
|
||||
|
||||
|
@ -77,6 +77,7 @@ Patch0048: 0048-linux-user-fix-BLK-ioctl-arguments.patch
|
||||
Patch0049: 0049-linux-user-add-BLKSSZGET-ioctl-wrapper.patch
|
||||
Patch0050: 0050-linux-user-Add-ioctl-for-BLKBSZGET.patch
|
||||
Patch0051: 0051-linux-user-take-RESERVED_VA-into-account-for-g2h_va.patch
|
||||
Patch0052: 0052-linux-user-binfmt-support-host-binaries.patch
|
||||
# this is to make lint happy
|
||||
Source300: rpmlintrc
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
@ -187,6 +188,7 @@ run cross architectures builds
|
||||
%patch0049 -p1
|
||||
%patch0050 -p1
|
||||
%patch0051 -p1
|
||||
%patch0052 -p1
|
||||
|
||||
%build
|
||||
# build QEMU
|
||||
|
Loading…
Reference in New Issue
Block a user