summaryrefslogtreecommitdiff
path: root/pcr/qemu-user-static-git
diff options
context:
space:
mode:
authorAndreas Grapentin <andreas@grapentin.org>2018-03-20 22:14:06 +0100
committerAndreas Grapentin <andreas@grapentin.org>2018-03-20 22:14:06 +0100
commit8897bf11ff6d220568bc24aedd7e868d86f3f0f4 (patch)
tree417a8091fd6ad94b253f088fb8579fb0dc5bc2f7 /pcr/qemu-user-static-git
parent35c3c72ff08066ea391aeac4aeb9f3e6fba33009 (diff)
downloadabslibre-8897bf11ff6d220568bc24aedd7e868d86f3f0f4.tar.gz
abslibre-8897bf11ff6d220568bc24aedd7e868d86f3f0f4.tar.bz2
abslibre-8897bf11ff6d220568bc24aedd7e868d86f3f0f4.zip
pcr/qemu-user-static-git: updated to v2.12.0.rc0.r0.gf1a63fcfcd
Diffstat (limited to 'pcr/qemu-user-static-git')
-rw-r--r--pcr/qemu-user-static-git/0001-add-binfmt-wrapper.patch146
-rw-r--r--pcr/qemu-user-static-git/0001-fix-program-invocation-name.patch75
-rw-r--r--pcr/qemu-user-static-git/PKGBUILD15
3 files changed, 153 insertions, 83 deletions
diff --git a/pcr/qemu-user-static-git/0001-add-binfmt-wrapper.patch b/pcr/qemu-user-static-git/0001-add-binfmt-wrapper.patch
new file mode 100644
index 000000000..5ba90937d
--- /dev/null
+++ b/pcr/qemu-user-static-git/0001-add-binfmt-wrapper.patch
@@ -0,0 +1,146 @@
+From 29fa1af29768c3d069a4b96dc5719a0214a9ed03 Mon Sep 17 00:00:00 2001
+From: Andreas Grapentin <andreas@grapentin.org>
+Date: Tue, 20 Mar 2018 20:54:00 +0100
+Subject: [PATCH] add binfmt wrapper
+
+---
+ Makefile.target | 9 ++++++++
+ binfmt.c | 55 +++++++++++++++++++++++++++++++++++++++++++++
+ scripts/qemu-binfmt-conf.sh | 10 ++++-----
+ 3 files changed, 68 insertions(+), 6 deletions(-)
+ create mode 100644 binfmt.c
+
+diff --git a/Makefile.target b/Makefile.target
+index 6549481096..3edb4cc832 100644
+--- a/Makefile.target
++++ b/Makefile.target
+@@ -36,6 +36,10 @@ endif
+ PROGS=$(QEMU_PROG) $(QEMU_PROGW)
+ STPFILES=
+
++ifdef CONFIG_LINUX_USER
++PROGS+=$(QEMU_PROG)-binfmt
++endif
++
+ config-target.h: config-target.h-timestamp
+ config-target.h-timestamp: config-target.mak
+
+@@ -114,6 +118,8 @@ QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) \
+ obj-y += linux-user/
+ obj-y += gdbstub.o thunk.o
+
++obj-binfmt-y += binfmt.o
++
+ endif #CONFIG_LINUX_USER
+
+ #########################################################
+@@ -196,6 +202,9 @@ ifdef CONFIG_DARWIN
+ $(call quiet-command,SetFile -a C $@,"SETFILE","$(TARGET_DIR)$@")
+ endif
+
++$(QEMU_PROG)-binfmt: $(obj-binfmt-y)
++ $(call LINK,$^)
++
+ gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
+ $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES),"GEN","$(TARGET_DIR)$@")
+
+diff --git a/binfmt.c b/binfmt.c
+new file mode 100644
+index 0000000000..9b19436ee5
+--- /dev/null
++++ b/binfmt.c
+@@ -0,0 +1,55 @@
++
++#include <stdio.h>
++#include <stdarg.h>
++#include <unistd.h>
++#include <libgen.h>
++#include <string.h>
++#include <stdlib.h>
++
++int
++main (int argc, char **argv)
++{
++ if (argc < 3) {
++ fprintf(stderr, "%s: please use me through binfmt\n", argv[0]);
++ return 1;
++ }
++
++ char **nargv = malloc(sizeof(*argv) * (argc + 2));
++ if (NULL == nargv)
++ {
++ perror("malloc");
++ return 1;
++ }
++
++ nargv[0] = strdup(argv[0]);
++ if (NULL == nargv[0])
++ {
++ perror("strdup");
++ return 1;
++ }
++
++ // argv0 is qemu-$cpu-binfmt, and we want to change that to qemu-$cpu-static
++ char *dest = strstr(nargv[0], "-binfmt");
++ if (NULL == dest)
++ {
++ fprintf(stderr, "%s: -binfmt not found in invocation name\n", argv[0]);
++ return 1;
++ }
++ strncpy(dest, "-static", 7);
++
++ nargv[1] = strdup("-0");
++ if (NULL == nargv[1])
++ {
++ perror("strdup");
++ return 1;
++ }
++
++ nargv[2] = argv[2];
++ nargv[3] = argv[1];
++
++ memcpy(&nargv[4], &argv[3], (argc - 3 + 1) * sizeof(*argv));
++
++ int ret = execv(nargv[0], nargv);
++ perror("exec");
++ return ret;
++}
+diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
+index f39ad344fc..c36b1abd43 100755
+--- a/scripts/qemu-binfmt-conf.sh
++++ b/scripts/qemu-binfmt-conf.sh
+@@ -274,9 +274,9 @@ qemu_set_binfmts() {
+ continue
+ fi
+
+- qemu="$QEMU_PATH/qemu-$cpu"
++ qemu="$QEMU_PATH/qemu-$cpu-binfmt"
+ if [ "$cpu" = "i486" ] ; then
+- qemu="$QEMU_PATH/qemu-i386"
++ qemu="$QEMU_PATH/qemu-i386-binfmt"
+ fi
+
+ if [ "$host_family" != "$family" ] ; then
+@@ -292,7 +292,7 @@ SYSTEMDDIR="/etc/binfmt.d"
+ DEBIANDIR="/usr/share/binfmts"
+
+ QEMU_PATH=/usr/local/bin
+-FLAGS=""
++FLAGS="P"
+
+ options=$(getopt -o ds:Q:e:hc: -l debian,systemd:,qemu-path:,exportdir:,help,credential: -- "$@")
+ eval set -- "$options"
+@@ -341,9 +341,7 @@ while true ; do
+ -c|--credential)
+ shift
+ if [ "$1" = "yes" ] ; then
+- FLAGS="OC"
+- else
+- FLAGS=""
++ FLAGS+="OC"
+ fi
+ ;;
+ *)
+--
+2.16.2
+
diff --git a/pcr/qemu-user-static-git/0001-fix-program-invocation-name.patch b/pcr/qemu-user-static-git/0001-fix-program-invocation-name.patch
deleted file mode 100644
index f2b915b67..000000000
--- a/pcr/qemu-user-static-git/0001-fix-program-invocation-name.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-diff --git a/linux-user/main.c b/linux-user/main.c
-index 108e1f202c..30cbb73496 100644
---- a/linux-user/main.c
-+++ b/linux-user/main.c
-@@ -4450,7 +4450,7 @@ static void usage(int exitcode)
- exit(exitcode);
- }
-
--static int parse_args(int argc, char **argv)
-+static int parse_args(int argc, char **argv, int assume_P_flag)
- {
- const char *r;
- int optind;
-@@ -4467,6 +4467,19 @@ static int parse_args(int argc, char **argv)
- }
- }
-
-+ if (assume_P_flag) {
-+ /* Assume started by binmisc and binfmt P flag is set */
-+ if (argc < 3) {
-+ fprintf(stderr, "%s: Please use me through binfmt with P flag\n",
-+ argv[0]);
-+ exit(1);
-+ }
-+ filename = argv[1];
-+ exec_path = argv[1];
-+ /* Next argv must be argv0 for the app */
-+ return 2;
-+ }
-+
- optind = 1;
- for (;;) {
- if (optind >= argc) {
-@@ -4565,7 +4578,8 @@ int main(int argc, char **argv, char **envp)
-
- qemu_add_opts(&qemu_trace_opts);
-
-- optind = parse_args(argc, argv);
-+ execfd = qemu_getauxval(AT_EXECFD);
-+ optind = parse_args(argc, argv, execfd > 0);
-
- if (!trace_init_backends()) {
- exit(1);
-@@ -4585,7 +4599,6 @@ int main(int argc, char **argv, char **envp)
-
- init_qemu_uname_release();
-
-- execfd = qemu_getauxval(AT_EXECFD);
- if (execfd == 0) {
- execfd = open(filename, O_RDONLY);
- if (execfd < 0) {
-diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
-index f39ad344fc..d070c33a74 100755
---- a/scripts/qemu-binfmt-conf.sh
-+++ b/scripts/qemu-binfmt-conf.sh
-@@ -292,7 +292,7 @@ SYSTEMDDIR="/etc/binfmt.d"
- DEBIANDIR="/usr/share/binfmts"
-
- QEMU_PATH=/usr/local/bin
--FLAGS=""
-+FLAGS="P"
-
- options=$(getopt -o ds:Q:e:hc: -l debian,systemd:,qemu-path:,exportdir:,help,credential: -- "$@")
- eval set -- "$options"
-@@ -341,9 +341,7 @@ while true ; do
- -c|--credential)
- shift
- if [ "$1" = "yes" ] ; then
-- FLAGS="OC"
-- else
-- FLAGS=""
-+ FLAGS+="OC"
- fi
- ;;
- *)
diff --git a/pcr/qemu-user-static-git/PKGBUILD b/pcr/qemu-user-static-git/PKGBUILD
index 7761b79c9..53d71a05f 100644
--- a/pcr/qemu-user-static-git/PKGBUILD
+++ b/pcr/qemu-user-static-git/PKGBUILD
@@ -7,16 +7,16 @@ _pkgbase=qemu-git
_gitname=qemu
pkgname=(qemu-user-static-git qemu-user-static-binfmt-git)
pkgdesc="A generic and open source machine emulator and virtualizer. Git version."
-pkgver=v2.11.0.r2577.gc26ef39204
+pkgver=v2.12.0.rc0.r0.gf1a63fcfcd
pkgrel=1
arch=(x86_64)
license=(GPL2 LGPL2.1)
url="http://wiki.qemu.org/"
makedepends=(git pixman-static glib2-static pcre-static python2)
source=(git://git.qemu.org/qemu.git
- 0001-fix-program-invocation-name.patch)
+ 0001-add-binfmt-wrapper.patch)
sha256sums=('SKIP'
- '85a1554cd9ce73f8f7eb8e9dd3cdb884466b4cfed7d28ede62246b46bea932cb')
+ '3fc4f49a43adc22e91c485fa13f3690ed2cfc847751032e4215e6da8ec124a27')
validpgpkeys=('CEACC9E15534EBABB82D3FA03353C9CEF108B584')
case $CARCH in
@@ -36,7 +36,7 @@ prepare() {
cd "${srcdir}/${_gitname}"
sed -i 's/vte-2\.90/vte-2.91/g' configure
- patch -Np1 -i "$srcdir"/0001-fix-program-invocation-name.patch
+ patch -Np1 -i "$srcdir"/0001-add-binfmt-wrapper.patch
# update git submodules
scripts/git-submodule.sh update ui/keycodemapdb dtc
@@ -112,7 +112,9 @@ package_qemu-user-static-git() {
local prog
for prog in "$pkgdir"/usr/bin/*; do
- mv -nT -- "$prog" "${prog%-static}-static"
+ if [[ $prog != *-binfmt ]]; then
+ mv -nT -- "$prog" "${prog%-static}-static"
+ fi
done
}
@@ -143,7 +145,4 @@ package_qemu-user-static-binfmt-git() {
--qemu-path /usr/bin \
--exportdir "$pkgdir"/usr/lib/binfmt.d \
--credential yes
-
- # add the "-static" suffix
- sed -i 's/:[^:]*$/-static&/' -- "$pkgdir"/usr/lib/binfmt.d/*.conf
}