tcode and info - qemu-wrapper - qemu wrapper used for specifying args to qemu-user in chroots
 (HTM) git clone git://parazyd.org/qemu-wrapper.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
 (DIR) commit 5186626b75daaa8eb62087015b348ff45c457ae1
 (DIR) parent 07db6d6b70d6a885c7b2722c95f336e08c327c4a
 (HTM) Author: parazyd <parazyd@dyne.org>
       Date:   Fri,  8 Apr 2016 04:33:55 +0200
       
       code and info
       
       Diffstat:
         M README.md                           |      11 ++++++++++-
         A qemu-wrapper.c                      |      20 ++++++++++++++++++++
       
       2 files changed, 30 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/README.md b/README.md
       t@@ -1,2 +1,11 @@
        # qemu-wrapper
       -wrapper for executing qemu in build chroots
       +
       +A simple wrapper for executing qemu in chroot builds.
       +With this, it is possible to pass arguments to qemu on chrooting, for example:
       +the cpu we wish to emulate.
       +
       +# Usage
       +Compile qemu wrapper with the below command and place it in `chroot/usr/bin/`
       +```
       +gcc -static qemu-wrapper.c -Os -s -o qemu-wrapper
       +```
 (DIR) diff --git a/qemu-wrapper.c b/qemu-wrapper.c
       t@@ -0,0 +1,20 @@
       +/* qemu wrapper
       + * wrapper for executing qemu in build chroots
       + * pass arguments to qemu binary
       + *
       + * ~ parazyd */
       +
       +#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("/usr/bin/qemu-arm", newargv, envp);
       +}