summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Becker <stefanb2@users.noreply.github.com>2023-05-09 16:27:36 +0300
committerGitHub <noreply@github.com>2023-05-09 14:27:36 +0100
commita86d732f58c901c80a5422d43e24ce37037e2665 (patch)
tree7ab01819754ca70920f66fa9747d1a2f66b3a705
parent7c750947a959fb626a70c09fd17c65815df192ac (diff)
Register aarch64 in binfmt misc (#694)
This modifies commit 6dc45a80e764eacd6e311c32164b623bbe7f8e08 for the arm64 branch. For 64-bit builds we need to register qemu-aarch64-static instead. Improves on #685
-rwxr-xr-xbuild-docker.sh20
1 files changed, 11 insertions, 9 deletions
diff --git a/build-docker.sh b/build-docker.sh
index d28b687..38ae9ca 100755
--- a/build-docker.sh
+++ b/build-docker.sh
@@ -109,10 +109,10 @@ case $(uname -m) in
;;
esac
-# Check if qemu-arm-static and /proc/sys/fs/binfmt_misc are present
+# Check if qemu-aarch64-static and /proc/sys/fs/binfmt_misc are present
if [[ "${binfmt_misc_required}" == "1" ]]; then
- if ! qemu_arm=$(which qemu-arm-static) ; then
- echo "qemu-arm-static not found (please install qemu-user-static)"
+ if ! qemu_arm=$(which qemu-aarch64-static) ; then
+ echo "qemu-aarch64-static not found (please install qemu-user-static)"
exit 1
fi
if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then
@@ -123,13 +123,15 @@ if [[ "${binfmt_misc_required}" == "1" ]]; then
fi
echo "binfmt_misc mounted"
fi
- # Register qemu-arm for binfmt_misc (binfmt_misc won't care duplicate entries unless they have common names)
- reg="echo ':qemu-arm-rpi:M::"\
-"\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:"\
+ if ! grep -q "^interpreter ${qemu_arm}" /proc/sys/fs/binfmt_misc/qemu-aarch64* ; then
+ # Register qemu-aarch64 for binfmt_misc
+ reg="echo ':qemu-aarch64-rpi:M::"\
+"\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00:"\
"\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:"\
-"$qemu_arm:F' > /proc/sys/fs/binfmt_misc/register"
- echo "Registering qemu-arm for binfmt_misc..."
- sudo bash -c "$reg" 2>/dev/null || true
+"${qemu_arm}:F' > /proc/sys/fs/binfmt_misc/register"
+ echo "Registering qemu-aarch64 for binfmt_misc..."
+ sudo bash -c "${reg}" 2>/dev/null || true
+ fi
fi
trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${DOCKER_CMDLINE_NAME}' SIGINT SIGTERM