forked from linuxkit/linuxkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.kconfig
50 lines (44 loc) · 1.51 KB
/
Dockerfile.kconfig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
ARG BUILD_IMAGE
FROM ${BUILD_IMAGE} AS kernel-build
ARG KERNEL_VERSIONS
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 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 && \
[ -f sources/linux-${VERSION}.tar.xz ] || curl -fSLo sources/linux-${VERSION}.tar.xz --create-dirs ${KERNEL_SOURCE} && \
bsdtar xf sources/linux-${VERSION}.tar.xz; \
done
# Apply patches to all kernels and move config files into place
RUN 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 && \
[ ! -f /config-${SERIES}-x86_64 ] || mv /config-${SERIES}-x86_64 arch/x86/configs/x86_64_defconfig && \
[ ! -f /config-${SERIES}-aarch64 ] || mv /config-${SERIES}-aarch64 arch/arm64/configs/defconfig ; \
done
ENTRYPOINT ["/bin/sh"]