mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-11-13 09:44:43 +00:00
Since we have to recompile kernels, might as well. Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
39 lines
1.3 KiB
Docker
39 lines
1.3 KiB
Docker
FROM linuxkit/alpine:349a817bdd6b293ca623ab97acf5377ccdeac7d2 AS kernel-build
|
|
RUN apk add \
|
|
argp-standalone \
|
|
build-base \
|
|
curl \
|
|
diffutils \
|
|
ncurses-dev \
|
|
tar \
|
|
xz
|
|
|
|
ARG KERNEL_VERSIONS
|
|
|
|
# There is no simple way to copy directories with wild cards as needed
|
|
# for patches-*. Copy the entire dir instead.
|
|
COPY / /
|
|
|
|
# Unpack kernels (download if not present)
|
|
RUN set -e && for VERSION in ${KERNEL_VERSIONS}; do \
|
|
echo "Downloading/Unpacking $VERSION" && \
|
|
KERNEL_SOURCE=https://www.kernel.org/pub/linux/kernel/v4.x/linux-${VERSION}.tar.xz && \
|
|
[ -f sources/linux-${VERSION}.tar.xz ] || curl -fSLo sources/linux-${VERSION}.tar.xz ${KERNEL_SOURCE} && \
|
|
tar xf sources/linux-${VERSION}.tar.xz; \
|
|
done
|
|
|
|
# Apply patches to all kernels and move config files into place
|
|
RUN for VERSION in ${KERNEL_VERSIONS}; do \
|
|
SERIES=${VERSION%.*}.x && \
|
|
echo "Patching $VERSION" && \
|
|
cd /linux-${VERSION} && \
|
|
set -e && for patch in /patches-${SERIES}/*.patch; do \
|
|
echo "Applying $patch" && \
|
|
patch -p1 < "$patch"; \
|
|
done && \
|
|
mv /kernel_config-${SERIES}-x86_64 arch/x86/configs/x86_64_defconfig && \
|
|
mv /kernel_config-${SERIES}-aarch64 arch/arm64/configs/defconfig; \
|
|
done
|
|
|
|
ENTRYPOINT ["/bin/sh"]
|