commit b7b635558d1fd40748df65ac6d40eebfa69c5b6b
parent e2876ea69f31cfd150cf7577e30fb1953de53159
Author: parazyd <parazyd@dyne.org>
Date: Thu, 28 Jan 2021 23:51:40 +0100
Compile qemu-wrapper if running on Gentoo.
Diffstat:
1 file changed, 18 insertions(+), 0 deletions(-)
diff --git a/zlibs/bootstrap b/zlibs/bootstrap
@@ -178,6 +178,24 @@ qemu_install_user()
esac
notice "Installing qemu-user-static"
+
+ if [[ -f "/etc/gentoo-release" ]] && [[ "$arch" = armhf ]]; then
+ cat <<EOF | gcc -O3 -static -o /tmp/qemu-wrapper -x c -
+#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";
+ memcpy(&newargv[3], &argv[1], sizeof(*argv) * (argc-1));
+ newargv[argc+2] = NULL;
+ return execve("${armhf_qemu_bin}", newargv, envp);
+}
+EOF
+ sudo mv /tmp/qemu-wrapper "$_target" || { zerr; return 1 ; }
+ fi
+
case "$arch" in
armel)
sudo cp -a "$armel_qemu_bin" "$_target/usr/bin/" || { zerr; return 1; }