Commit b1fc77d6 authored by Dan Nicholson's avatar Dan Nicholson Committed by Michael Tokarev
Browse files

Use binfmt-support --fix-binary option (#868030)

binfmt-support 2.1.7 added the --fix-binary boolean option that maps to
the kernel's F binfmt flag[1]. This flag instructs the kernel to open
the binfmt handler immediately when registered. This is very helpful in
the case of qemu-user-static where emulation of another architecture can
be handled with no updates to a chroot or container running foreign
architecture binaries.

However, in the case of qemu-user and qemu-update-binfmt, this is less
likely to be helpful since dynamic linking would still require the many
libraries in the alternate root. In that case, continue to run
update-binfmts without --fix-binary.

1. https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.html
parent a2b52e18
...@@ -88,7 +88,7 @@ case "$DPKG_MAINTSCRIPT_NAME:$1" in ...@@ -88,7 +88,7 @@ case "$DPKG_MAINTSCRIPT_NAME:$1" in
eval "case $fmt in $omit) magic= ;; *) magic=\"\$${fmt}_magic\" mask=\"\$${fmt}_mask\" ;; esac" eval "case $fmt in $omit) magic= ;; *) magic=\"\$${fmt}_magic\" mask=\"\$${fmt}_mask\" ;; esac"
if [ -n "$magic" ]; then if [ -n "$magic" ]; then
update-binfmts --package @PACKAGE@ --install qemu-$fmt /usr/bin/qemu-$fmt@SUFFIX@ \ update-binfmts --package @PACKAGE@ --install qemu-$fmt /usr/bin/qemu-$fmt@SUFFIX@ \
--magic "$magic" --mask "$mask" --offset 0 --credential yes --magic "$magic" --mask "$mask" --offset 0 --credential yes @FIX_BINARY@
else else
remove_binfmt $fmt remove_binfmt $fmt
fi fi
......
...@@ -363,7 +363,7 @@ Architecture: amd64 arm arm64 armel armhf hppa i386 ia64 mips mipsel mips64 mips ...@@ -363,7 +363,7 @@ Architecture: amd64 arm arm64 armel armhf hppa i386 ia64 mips mipsel mips64 mips
Built-Using: ${built-using} Built-Using: ${built-using}
Multi-Arch: foreign Multi-Arch: foreign
Depends: ${shlibs:Depends}, ${misc:Depends} Depends: ${shlibs:Depends}, ${misc:Depends}
Recommends: binfmt-support Recommends: binfmt-support (>= 2.1.7)
Provides: qemu-user-binfmt Provides: qemu-user-binfmt
Conflicts: qemu-user-binfmt Conflicts: qemu-user-binfmt
Suggests: sudo Suggests: sudo
......
...@@ -256,9 +256,9 @@ ifeq ($(enable_linux_user),enable) ...@@ -256,9 +256,9 @@ ifeq ($(enable_linux_user),enable)
# binfmt support # binfmt support
for x in postinst prerm; do \ for x in postinst prerm; do \
sed -e s/@SUFFIX@/-static/ -e s/@PACKAGE@/qemu-user-static/ \ sed -e s/@SUFFIX@/-static/ -e s/@PACKAGE@/qemu-user-static/ -e "s/@FIX_BINARY@/--fix-binary yes/" \
debian/binfmt-update-in >> debian/qemu-user-static.$$x.debhelper ; \ debian/binfmt-update-in >> debian/qemu-user-static.$$x.debhelper ; \
sed -e s/@SUFFIX@// -e s/@PACKAGE@/qemu-user-binfmt/ \ sed -e s/@SUFFIX@// -e s/@PACKAGE@/qemu-user-binfmt/ -e s/@FIX_BINARY@// \
debian/binfmt-update-in >> debian/qemu-user-binfmt.$$x.debhelper ; \ debian/binfmt-update-in >> debian/qemu-user-binfmt.$$x.debhelper ; \
done done
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment