Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci/ppc64-be-images.env
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Pinned image for the linux-powerpc64-be CI flow (sourced by ppc64-be-build.sh).
#
# QEMU (the ppc64 big-endian emulator) is NOT pinned here: it is installed from
# the Ubuntu runner's apt as qemu-user-static (currently QEMU ~8.2) by
# ppc64-qemu-setup.sh. Rationale:
# the Ubuntu runner's apt (qemu-user-static, or qemu-user + qemu-user-binfmt where
# that package is gone) by ppc64-qemu-setup.sh. Rationale:
# - multiarch/qemu-user-static is abandoned (frozen at QEMU 7.2.0, Jan 2023).
# - tonistiigi/binfmt ships only little-endian ppc64le, not big-endian ppc64.
# The distro package gives us a current big-endian qemu-ppc64 and auto-registers
# its binfmt handler with the F (fix-binary) flag. See ppc64-qemu-setup.sh.
# The distro packages give us a current big-endian qemu-ppc64 and register its
# binfmt handler with the F (fix-binary) flag. See ppc64-qemu-setup.sh.
#
# Runtime rootfs: Debian-ports ppc64 (big-endian) exists only in sid, so there is
# no stable release to track. We currently track the rolling tag and let the
Expand Down
25 changes: 18 additions & 7 deletions .github/workflows/ci/ppc64-qemu-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,39 @@ set -euo pipefail
# `docker run --platform linux/ppc64 ...` (ppc64-be-build.sh) transparently
# executes big-endian binaries under QEMU user-mode.
#
# We install QEMU from the Ubuntu runner's apt (qemu-user-static, currently
# ~8.2) rather than multiarch/qemu-user-static (abandoned at 7.2.0) or
# tonistiigi/binfmt (little-endian ppc64le only). The package's postinst
# registers each handler with the F (fix-binary) flag via update-binfmts, so
# the interpreter fd is preserved into the container and qemu does not need to
# We install QEMU from the Ubuntu runner's apt rather than
# multiarch/qemu-user-static (abandoned at 7.2.0) or tonistiigi/binfmt
# (little-endian ppc64le only). Older images ship qemu-user-static, which
# registers each handler with the F (fix-binary) flag via update-binfmts; newer
# ones replace it with qemu-user (static binaries) plus qemu-user-binfmt, which
# installs binfmt.d entries (also with F) for systemd-binfmt to load. With F
# the interpreter fd is preserved into the container, so qemu does not need to
# exist inside the rootfs. See ppc64-be-images.env for the rationale.

export DEBIAN_FRONTEND=noninteractive
sudo apt-get update -qq
sudo apt-get install -y -qq qemu-user-static binfmt-support
if apt-cache policy qemu-user-static | grep -q 'Candidate: [^(]'; then
sudo apt-get install -y -qq qemu-user-static binfmt-support
else
sudo apt-get install -y -qq qemu-user qemu-user-binfmt binfmt-support
fi

# Idempotent: enable the handler in case it was installed but left disabled.
sudo update-binfmts --enable qemu-ppc64 2>/dev/null || true

BINFMT_FILE=/proc/sys/fs/binfmt_misc/qemu-ppc64
# qemu-user-binfmt only drops binfmt.d entries; load them if nothing registered yet.
if [ ! -e "$BINFMT_FILE" ]; then
sudo systemctl restart systemd-binfmt 2>/dev/null || true
fi
if [ ! -e "$BINFMT_FILE" ]; then
echo "::error::qemu-ppc64 binfmt handler not registered"
ls /proc/sys/fs/binfmt_misc/ || true
exit 1
fi

echo "qemu-ppc64-static: $(qemu-ppc64-static --version 2>/dev/null | head -1 || echo 'unknown')"
QEMU_PPC64="$(command -v qemu-ppc64-static || command -v qemu-ppc64 || true)"
echo "${QEMU_PPC64:-qemu-ppc64}: $("${QEMU_PPC64:-qemu-ppc64}" --version 2>/dev/null | head -1 || echo 'unknown')"
echo "binfmt handler ${BINFMT_FILE}:"
cat "$BINFMT_FILE"

Expand Down
Loading