feat(ci): Add arm64 emulation and multi-arch kernel build support
Some checks failed
Build kernel module / build (1:6.12.93-1+rpt1) (push) Failing after 1m15s
Build kernel module / release (push) Has been skipped

Introduce arm64 emulation setup and enhance the kernel build workflow to
support multi-architecture builds. Updated the process to use Docker
copy commands for compatibility with docker-in-docker environments, ensuring
accurate context access and successful compilation.
This commit is contained in:
Christian Werner 2026-06-19 03:55:26 +02:00
parent 231fdba93d
commit cd0285cc0b

View File

@ -38,7 +38,28 @@ jobs:
env: env:
HEADERS_PKG: ${{ env.HEADERS_PKG }} HEADERS_PKG: ${{ env.HEADERS_PKG }}
KERNEL_VERSION: ${{ matrix.kernel_version }} KERNEL_VERSION: ${{ matrix.kernel_version }}
run: ./build-in-docker.sh run: |
set -eux
# arm64 emulation for the builder image (no-op if already registered).
if [ ! -e /proc/sys/fs/binfmt_misc/qemu-aarch64 ]; then
docker run --privileged --rm tonistiigi/binfmt --install arm64
fi
# Builder image: toolchain + matching raspberrypi kernel headers.
docker build --platform linux/arm64 \
--build-arg HEADERS_PKG="$HEADERS_PKG" \
--build-arg KERNEL_VERSION="$KERNEL_VERSION" \
-t iec-kbuild .
# Compile inside the container. We use `docker cp` instead of the bind
# mount that build-in-docker.sh uses for local builds: under the runner's
# docker-in-docker, /workspace is a volume the host daemon can't see, so
# `-v "$PWD:/build"` mounts an empty dir and make finds no Makefile.
cid=$(docker create --platform linux/arm64 --entrypoint sleep iec-kbuild infinity)
docker start "$cid"
docker cp ./. "$cid:/build"
docker exec "$cid" /usr/local/bin/docker-entrypoint.sh clean
docker exec "$cid" /usr/local/bin/docker-entrypoint.sh
docker cp "$cid:/build/iec_listener.ko" ./iec_listener.ko
docker rm -f "$cid"
- name: Stage build output (modules/iec_listener_<kernel_version>.ko) - name: Stage build output (modules/iec_listener_<kernel_version>.ko)
working-directory: kernel working-directory: kernel