[packages/qemu] switch to qemu-binfmt-conf.sh for binfmt configs

atler atler at pld-linux.org
Fri May 1 20:44:55 CEST 2020


commit e02a00f954b4f87a2d96e95a6eb22edf448f2cc6
Author: Jan Palus <atler at pld-linux.org>
Date:   Fri May 1 20:41:35 2020 +0200

    switch to qemu-binfmt-conf.sh for binfmt configs
    
    - added aarch64 cpu support
    - force bash -- mksh always performs backslash expansion and magic ends
      up binary instead of ascii

 qemu.binfmt | 22 ----------------------
 qemu.spec   | 58 ++++++++++++++++++++++++++++++++++------------------------
 2 files changed, 34 insertions(+), 46 deletions(-)
---
diff --git a/qemu.spec b/qemu.spec
index 2c9ff9f..5885035 100644
--- a/qemu.spec
+++ b/qemu.spec
@@ -40,7 +40,6 @@ License:	GPL v2, BSD (edk2 firmware files)
 Group:		Applications/Emulators
 Source0:	http://wiki.qemu-project.org/download/%{name}-%{version}.tar.xz
 # Source0-md5:	278eeb294e4b497e79af7a57e660cb9a
-Source2:	%{name}.binfmt
 # Loads kvm kernel modules at boot
 Source3:	kvm-modules-load.conf
 # Creates /dev/kvm
@@ -989,56 +988,67 @@ install -p %{SOURCE13} $RPM_BUILD_ROOT/etc/rc.d/init.d/qemu-ga
 install -p %{SOURCE14} $RPM_BUILD_ROOT/etc/logrotate.d/qemu-ga
 
 # Install binfmt
-for i in dummy \
+BINFMT_CPUS=" \
 %ifnarch %{ix86} %{x8664} x32
-	qemu-i386 \
+	i386 x86_64 \
+%endif
+%ifnarch aarch64
+	aarch64 \
 %endif
 %ifnarch alpha
-	qemu-alpha \
+	alpha \
 %endif
 %ifnarch %{arm}
-	qemu-arm \
+	arm \
 %endif
-	qemu-armeb \
-	qemu-cris \
-	qemu-microblaze qemu-microblazeel \
+	aarch64_be \
+	armeb \
+	microblaze microblazeel \
 %ifnarch mips64
-	qemu-mips64 \
+	mips64 \
 %ifnarch mips
-	qemu-mips \
+	mips \
 %endif
 %endif
 %ifnarch mips64el
-	qemu-mips64el \
+	mips64el \
 %ifnarch mipsel
-	qemu-mipsel \
+	mipsel \
 %endif
 %endif
 %ifnarch m68k
-	qemu-m68k \
+	m68k \
 %endif
 %ifnarch ppc ppc64 ppc64le
-	qemu-ppc qemu-ppc64abi32 qemu-ppc64 \
+	ppc ppc64 ppc64le \
 %endif
 %ifnarch sparc sparc64
-	qemu-sparc qemu-sparc32plus qemu-sparc64 \
+	sparc sparc32plus sparc64 \
 %endif
 %ifnarch s390 s390x
-	qemu-s390x \
+	s390x \
 %endif
 %ifnarch sh4
-	qemu-sh4 \
+	sh4 \
 %endif
-	qemu-sh4eb \
-; do
-	test $i = dummy && continue
-	grep /$i:\$ %{SOURCE2} > $RPM_BUILD_ROOT/usr/lib/binfmt.d/$i-dynamic.conf
+	sh4eb \
+"
+
+if [ -n "$BINFMT_CPUS" ]; then
+	for cpu in $BINFMT_CPUS; do
+		bash ./scripts/qemu-binfmt-conf.sh --systemd "$cpu" --exportdir $RPM_BUILD_ROOT/usr/lib/binfmt.d --qemu-path %{_bindir}
+	done
+	for i in /$RPM_BUILD_ROOT/usr/lib/binfmt.d/*.conf; do
+		mv $i ${i%.conf}-dynamic.conf
+	done
 
 	%if %{with user_static}
-	grep /$i:\$ %{SOURCE2} > $RPM_BUILD_ROOT/usr/lib/binfmt.d/$i-static.conf
-	%{__sed} -i -e "s/$i/$i-static/" $RPM_BUILD_ROOT/usr/lib/binfmt.d/$i-static.conf
+	for regularfmt in $RPM_BUILD_ROOT/usr/lib/binfmt.d/*; do
+		staticfmt="${regularfmt%\-dynamic.conf}-static.conf"
+		cat $regularfmt | tr -d '\n' | sed "s/:$/-static:F/" > $staticfmt
+	done
 	%endif
-done < %{SOURCE2}
+fi
 
 # packaged as %doc
 %{__rm} $RPM_BUILD_ROOT%{_docdir}/qemu/qemu-doc.html
diff --git a/qemu.binfmt b/qemu.binfmt
deleted file mode 100644
index 92aa4df..0000000
--- a/qemu.binfmt
+++ /dev/null
@@ -1,22 +0,0 @@
-:qemu-alpha:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x26\x90:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-alpha:
-:qemu-armeb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-armeb:
-:qemu-arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm:
-:qemu-cris:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x4c\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-cris:
-:qemu-i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-i386:
-:qemu-i486:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-i386:
-:qemu-m68k:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x04:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-m68k:
-:qemu-microblazeel:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xab\xba:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-microblazeel:
-:qemu-microblaze:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xba\xab:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-microblaze:
-:qemu-mips64el:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xfe\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mips64el:
-:qemu-mips64:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mips64:
-:qemu-mipsel:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xfe\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mipsel:
-:qemu-mips:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mips:
-:qemu-ppc64abi32:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-ppc64abi32:
-:qemu-ppc64:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-ppc64:
-:qemu-ppc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-ppc:
-:qemu-s390x:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-s390x:
-:qemu-sh4eb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sh4eb:
-:qemu-sh4:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-sh4:
-:qemu-sparc32plus:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x12:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sparc32plus:
-:qemu-sparc64:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2b:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sparc64:
-:qemu-sparc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sparc:
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/qemu.git/commitdiff/e02a00f954b4f87a2d96e95a6eb22edf448f2cc6



More information about the pld-cvs-commit mailing list