From 8c39f484bb29dc2b9157e8a2bfb9c78f59be10de Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 30 Jan 2024 09:55:08 +0100 Subject: [PATCH] entrypoint: setup binfmt_misc handling for cross building --- entrypoint.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 3930a16a2..99185c34d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,3 +1,21 @@ #!/bin/bash set -euo pipefail + +if mount -t binfmt_misc none /proc/sys/fs/binfmt_misc; then + case "$(uname -m)" in + "x86_64") + if [ ! -e /proc/sys/fs/binfmt_misc/qemu-aarch64 ]; then + cat /usr/lib/binfmt.d/qemu-aarch64-static.conf > /proc/sys/fs/binfmt_misc/register + fi + ;; + "aarch64") + if [ ! -e /proc/sys/fs/binfmt_misc/qemu-x86_64 ]; then + cat /usr/lib/binfmt.d/qemu-x86_64-static.conf > /proc/sys/fs/binfmt_misc/register + fi + esac +else + echo "WARN: cannot setup binfmt_misc handling" +fi + + /usr/bin/bootc-image-builder build --store /store --rpmmd /rpmmd --output /output "$@"