linuxkit/kernel/Dockerfile.kconfigx
Avi Deitcher 18e7eea86f
riscv64 kernel (#4106)
* add riscv64 kernels to kernel/Makefile and kernel/Dockerfile.*, riscv64 kernel config, bump alpine version for kernel builds

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* update bcc to v0.32.0 to include needed fixes

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* bump kernel builder alpine base to version including llvm19

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* in kernel-bcc, automatically determine python path

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* in kernel-perf, suppress newer gcc errors

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* riscv path in kernel build was incorrect

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* remove bcc compilation from kernel

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* update usages of kernel/6.6.13 to kernel/6.6.71

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* next run of updating kernel config

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* update test dependencies on kernel hash version

Signed-off-by: Avi Deitcher <avi@deitcher.net>

---------

Signed-off-by: Avi Deitcher <avi@deitcher.net>
2025-02-21 11:10:35 +02:00

75 lines
1.7 KiB
Docker

# syntax=docker/dockerfile:1.3-labs
ARG BUILD_IMAGE
FROM ${BUILD_IMAGE} AS kernel-build
ARG KERNEL_VERSIONS
ARG TARGETARCH
RUN apk add \
argp-standalone \
bison \
build-base \
curl \
diffutils \
flex \
gmp-dev \
libarchive-tools \
mpc1-dev \
mpfr-dev \
ncurses-dev \
patch \
xz
COPY / /
# Unpack kernels (download if not present)
RUN <<EOF
set -e
for VERSION in ${KERNEL_VERSIONS}; do
MAJOR=$(echo ${VERSION} | cut -d . -f 1)
MAJOR=v${MAJOR}.x
echo "Downloading/Unpacking $VERSION"
KERNEL_SOURCE=https://www.kernel.org/pub/linux/kernel/${MAJOR}/linux-${VERSION}.tar.xz
if [ ! -f sources/linux-${VERSION}.tar.xz ] ; then
curl -fSLo sources/linux-${VERSION}.tar.xz --create-dirs ${KERNEL_SOURCE}
fi
bsdtar xf sources/linux-${VERSION}.tar.xz
done
EOF
# Apply patches to all kernels and move config files into place
RUN <<EOF
set -e
for VERSION in ${KERNEL_VERSIONS}; do
SERIES=${VERSION%.*}.x
echo "Patching $VERSION $SERIES"
cd /linux-${VERSION}
if [ -d /patches-${SERIES} ]; then
for patch in /patches-${SERIES}/*.patch; do
echo "Applying $patch"
patch -t -F0 -N -u -p1 < "$patch"
done
fi
if [ ${TARGETARCH} = "amd64" ] ; then
cp /config-${SERIES}-x86_64 .config
ARCH=x86 make oldconfig
ls
elif [ ${TARGETARCH} = "arm64" ] ; then
cp /config-${SERIES}-aarch64 .config
ARCH=arm64 make oldconfig
elif [ ${TARGETARCH} = "riscv64" ] ; then
cp /config-${SERIES}-riscv64 .config
ARCH=riscv64 make oldconfig
fi
done
EOF
ENTRYPOINT ["/bin/sh"]
FROM scratch
ARG KERNEL_VERSIONS
ARG TARGETARCH
WORKDIR /
COPY --from=kernel-build /linux-${KERNEL_VERSIONS}/.config config-${KERNEL_VERSIONS}-$TARGETARCH