commit 5c6fa086145b95bb5801c51fc3a6805e946f8e11
parent 85754cf9d8a7dd434bb2f041e0f3e0ef036a9bc1
Author: parazyd <parazyd@dyne.org>
Date: Sat, 21 Nov 2020 01:47:59 +0100
Add qemu-wrapper source code.
Diffstat:
1 file changed, 20 insertions(+), 0 deletions(-)
diff --git a/qemu-wrapper.c.in b/qemu-wrapper.c.in
@@ -0,0 +1,20 @@
+/*
+ * pass arguments to qemu binary
+ * fetched from Gentoo wiki
+ */
+
+#include <string.h>
+#include <unistd.h>
+
+int main(int argc, char **argv, char **envp)
+{
+ char *newargv[argc+3];
+
+ newargv[0] = argv[0];
+ newargv[1] = "-cpu";
+ newargv[2] = "cortex-a8"; /* here you can set the cpu you are building for */
+
+ memcpy(&newargv[3], &argv[1], sizeof(*argv) * (argc-1));
+ newargv[argc+2] = NULL;
+ return execve("@QEMU_ARM@", newargv, envp);
+}