mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 17:26:28 +00:00
kernel: Add a Dockerfile to make it easier to configure kernels
The new Dockerfile.kconfig can be used, via the 'kconfig' make target to build a 'linuxkit/kconfig' images. This images contains the patched source and default kernel configs for all supported kernels. It's useful to updating the kernel config files. While at it, also update the alpine base. Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
parent
6f1e4add2e
commit
ba2e6a5bb8
@ -1,4 +1,4 @@
|
||||
FROM linuxkit/alpine:87a0cd10449d72f374f950004467737dbf440630 AS kernel-build
|
||||
FROM linuxkit/alpine:a120ad6aead3fe583eaa20e9b75a05ac1b3487da AS kernel-build
|
||||
RUN apk add \
|
||||
argp-standalone \
|
||||
automake \
|
||||
|
36
kernel/Dockerfile.kconfig
Normal file
36
kernel/Dockerfile.kconfig
Normal file
@ -0,0 +1,36 @@
|
||||
FROM linuxkit/alpine:a120ad6aead3fe583eaa20e9b75a05ac1b3487da 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 for VERSION in ${KERNEL_VERSIONS}; do \
|
||||
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 && \
|
||||
cd /linux-${VERSION} && \
|
||||
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"]
|
@ -49,6 +49,8 @@ COMMIT_LABEL=--label org.opencontainers.image.revision=$(REPO_COMMIT)
|
||||
endif
|
||||
LABELS=$(REPO_LABEL) $(COMMIT_LABEL)
|
||||
|
||||
KERNEL_VERSIONS=
|
||||
|
||||
.PHONY: check tag push
|
||||
# Targets:
|
||||
# fetch: Downloads the kernel sources into ./sources
|
||||
@ -76,6 +78,7 @@ define kernel
|
||||
ifeq ($(3),)
|
||||
sources/linux-$(1).tar.xz: Makefile | sources
|
||||
curl -fsSLo sources/linux-$(1).tar.xz https://www.kernel.org/pub/linux/kernel/v4.x/linux-$(1).tar.xz
|
||||
KERNEL_VERSIONS+=$(1)
|
||||
endif
|
||||
|
||||
build_$(2)$(3): Dockerfile Makefile $(wildcard patches-$(2)/*) $(wildcard kernel_config-$(2)*) kernel_config.debug | sources
|
||||
@ -133,3 +136,9 @@ endef
|
||||
$(eval $(call kernel,4.9.44,4.9.x))
|
||||
$(eval $(call kernel,4.9.44,4.9.x,_dbg))
|
||||
$(eval $(call kernel,4.4.83,4.4.x))
|
||||
|
||||
# Target for kernel config
|
||||
kconfig: | sources
|
||||
docker build --no-cache -f Dockerfile.kconfig \
|
||||
--build-arg KERNEL_VERSIONS="$(KERNEL_VERSIONS)" \
|
||||
-t linuxkit/kconfig .
|
||||
|
Loading…
Reference in New Issue
Block a user