scripts/build: reduce riscv64 cross-compilation template

duplication

Move the riscv64-specific APT repository setup (GPG keys, custom
source lists) from the template into the header file. This allows
the riscv64 template to be a symlink to the shared
Dockerfile.stable-cross.tmpl, like all other cross-compilation
targets. Skip amdgpu_plugin for riscv64 as it is not supported.

Assisted-by: Claude Code (claude-opus-4-6)
Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
Adrian Reber 2026-07-09 08:35:09 +00:00 committed by Radostin Stoyanov
parent 74cbf9e2e7
commit 4e93a9802d
3 changed files with 14 additions and 35 deletions

View file

@ -3,3 +3,14 @@ FROM docker.io/library/ubuntu:jammy
ENV ARCH=riscv64
ENV DEBIAN_ARCH=riscv64
ENV CROSS_TRIPLET=riscv64-linux-gnu
RUN apt-get clean -y && apt-get update -y && apt-get install -y --no-install-recommends gnupg2
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93C 8D69674688B6CB36 B523E5F3FC4E5F2C
COPY scripts/ci/riscv64-cross/amd64-sources.list /etc/apt/sources.list
COPY scripts/ci/riscv64-cross/riscv64-sources.list /etc/apt/sources.list.d/
RUN dpkg --add-architecture ${DEBIAN_ARCH} && \
apt-get update -y

View file

@ -1,33 +0,0 @@
# Add the cross compiler sources
RUN apt-get clean -y && apt-get update -y && apt-get install -y --no-install-recommends gnupg2
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93C 8D69674688B6CB36 B523E5F3FC4E5F2C
COPY scripts/ci/riscv64-cross/amd64-sources.list /etc/apt/sources.list
COPY scripts/ci/riscv64-cross/riscv64-sources.list /etc/apt/sources.list.d/
RUN dpkg --add-architecture ${DEBIAN_ARCH} && \
apt-get update -y
ENV CROSS_COMPILE=${CROSS_TRIPLET}- \
CROSS_ROOT=/usr/${CROSS_TRIPLET} \
AS=/usr/bin/${CROSS_TRIPLET}-as \
AR=/usr/bin/${CROSS_TRIPLET}-ar \
CC=/usr/bin/${CROSS_TRIPLET}-gcc \
CPP=/usr/bin/${CROSS_TRIPLET}-cpp \
CXX=/usr/bin/${CROSS_TRIPLET}-g++ \
LD=/usr/bin/${CROSS_TRIPLET}-ld \
FC=/usr/bin/${CROSS_TRIPLET}-gfortran
ENV PATH="${PATH}:${CROSS_ROOT}/bin" \
PKG_CONFIG_PATH=/usr/lib/${CROSS_TRIPLET}/pkgconfig
COPY contrib/dependencies/apt-cross-packages.sh /criu/contrib/dependencies/apt-cross-packages.sh
COPY contrib/apt-install /criu/contrib/apt-install
WORKDIR /criu
RUN /criu/contrib/dependencies/apt-cross-packages.sh
COPY . /criu
RUN make mrproper && date && make -j $(nproc) zdtm && date

View file

@ -0,0 +1 @@
Dockerfile.stable-cross.tmpl

View file

@ -22,10 +22,10 @@ RUN /criu/contrib/dependencies/apt-cross-packages.sh
COPY . /criu
# amdgpu_plugin with armv7 is not supported
# amdgpu_plugin is not supported on armv7 and riscv64
RUN make mrproper && date && \
make -j $(nproc) && \
if [ "$SUBARCH" != "armv7" ]; then \
if [ "$SUBARCH" != "armv7" ] && [ "$ARCH" != "riscv64" ]; then \
make -j $(nproc) amdgpu_plugin; \
fi && \
make -j $(nproc) zdtm && date