mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 17:26:28 +00:00
kernel: Enable custom kernel config additions
For some use cases, we may want to add additional kernel configuration options (e.g. when adding AUFS). This commit enables it by: - renaming DEBUG to EXTRA - append kernel_config${EXTRA} to the kernel config - allowing passing in an EXTRA argument to the make file Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
parent
e75cf2f611
commit
7209afb758
@ -31,7 +31,7 @@ RUN [ $(uname -m) == x86_64 ] && apk add libunwind-dev || true
|
||||
|
||||
ARG KERNEL_VERSION
|
||||
ARG KERNEL_SERIES
|
||||
ARG DEBUG
|
||||
ARG EXTRA
|
||||
|
||||
ENV KERNEL_SOURCE=https://www.kernel.org/pub/linux/kernel/v4.x/linux-${KERNEL_VERSION}.tar.xz
|
||||
ENV KERNEL_SHA256_SUMS=https://www.kernel.org/pub/linux/kernel/v4.x/sha256sums.asc
|
||||
@ -66,8 +66,7 @@ RUN set -e && for patch in /patches/*.patch; do \
|
||||
done
|
||||
|
||||
# Kernel config
|
||||
COPY kernel_config-${KERNEL_SERIES}* /linux/
|
||||
COPY kernel_config.debug /linux/debug_config
|
||||
COPY kernel_config* /linux/
|
||||
|
||||
RUN case $(uname -m) in \
|
||||
x86_64) \
|
||||
@ -78,15 +77,17 @@ RUN case $(uname -m) in \
|
||||
;; \
|
||||
esac && \
|
||||
cp /linux/kernel_config-${KERNEL_SERIES}-$(uname -m) ${KERNEL_DEF_CONF}; \
|
||||
if [ -n "${DEBUG}" ]; then \
|
||||
sed -i 's/CONFIG_PANIC_ON_OOPS=y/# CONFIG_PANIC_ON_OOPS is not set/' ${KERNEL_DEF_CONF}; \
|
||||
sed -i "s/CONFIG_LOCALVERSION=\"-linuxkit\"/CONFIG_LOCALVERSION=\"-linuxkit${DEBUG}\"/" ${KERNEL_DEF_CONF}; \
|
||||
cat /linux/debug_config >> ${KERNEL_DEF_CONF}; \
|
||||
if [ -n "${EXTRA}" ]; then \
|
||||
sed -i "s/CONFIG_LOCALVERSION=\"-linuxkit\"/CONFIG_LOCALVERSION=\"-linuxkit${EXTRA}\"/" ${KERNEL_DEF_CONF}; \
|
||||
if [ "${EXTRA}" = "-dbg" ]; then \
|
||||
sed -i 's/CONFIG_PANIC_ON_OOPS=y/# CONFIG_PANIC_ON_OOPS is not set/' ${KERNEL_DEF_CONF}; \
|
||||
fi && \
|
||||
cat /linux/kernel_config${EXTRA} >> ${KERNEL_DEF_CONF}; \
|
||||
fi && \
|
||||
rm /linux/kernel_config-${KERNEL_SERIES}* && \
|
||||
rm /linux/kernel_config* && \
|
||||
make defconfig && \
|
||||
make oldconfig && \
|
||||
if [ -z "${DEBUG}" ]; then diff .config ${KERNEL_DEF_CONF}; fi
|
||||
if [ -z "${EXTRA}" ]; then diff .config ${KERNEL_DEF_CONF}; fi
|
||||
|
||||
RUN mkdir /out
|
||||
|
||||
@ -101,7 +102,7 @@ RUN make -j "$(getconf _NPROCESSORS_ONLN)" KCFLAGS="-fno-pie" && \
|
||||
;; \
|
||||
esac && \
|
||||
cp System.map /out && \
|
||||
([ -n "${DEBUG}" ] && cp vmlinux /out || true)
|
||||
([ "${EXTRA}" = "-dbg" ] && cp vmlinux /out || true)
|
||||
|
||||
# WireGuard
|
||||
RUN curl -sSL -o /wireguard.tar.xz "${WIREGUARD_URL}" && \
|
||||
|
@ -17,6 +17,11 @@ ORG?=linuxkit
|
||||
IMAGE:=kernel
|
||||
IMAGE_PERF:=kernel-perf
|
||||
|
||||
# You can specify an extra options for the Makefile. This will:
|
||||
# - append a kernel_config$(EXTRA) to the kernel config for your kernel/arch
|
||||
# - append $(EXTRA) to the CONFIG_LOCALVERSION of your kernel
|
||||
EXTRA?=
|
||||
|
||||
ifeq ($(HASH),)
|
||||
HASH_COMMIT?=HEAD # Setting this is only really useful with the show-tag target
|
||||
HASH?=$(shell git ls-tree --full-tree $(HASH_COMMIT) -- $(CURDIR) | awk '{print $$3}')
|
||||
@ -87,12 +92,12 @@ sources/linux-$(1).tar.xz: Makefile | sources
|
||||
KERNEL_VERSIONS+=$(1)
|
||||
endif
|
||||
|
||||
build_$(2)$(3): Dockerfile Makefile $(wildcard patches-$(2)/*) $(wildcard kernel_config-$(2)*) kernel_config.debug | sources
|
||||
build_$(2)$(3): Dockerfile Makefile $(wildcard patches-$(2)/*) $(wildcard kernel_config-$(2)*) kernel_config-dbg | sources
|
||||
docker pull $(ORG)/$(IMAGE):$(1)$(3)-$(TAG)$(SUFFIX) || \
|
||||
docker build \
|
||||
--build-arg KERNEL_VERSION=$(1) \
|
||||
--build-arg KERNEL_SERIES=$(2) \
|
||||
--build-arg DEBUG=$(3) \
|
||||
--build-arg EXTRA=$(3) \
|
||||
$(LABELS) \
|
||||
--no-cache -t $(ORG)/$(IMAGE):$(1)$(3)-$(TAG)$(SUFFIX) .
|
||||
|
||||
@ -139,11 +144,11 @@ endef
|
||||
# Build Targets
|
||||
# Debug targets only for latest stable and LTS stable
|
||||
#
|
||||
$(eval $(call kernel,4.12.8,4.12.x))
|
||||
$(eval $(call kernel,4.12.8,4.12.x,$(EXTRA)))
|
||||
$(eval $(call kernel,4.12.8,4.12.x,-dbg))
|
||||
$(eval $(call kernel,4.9.44,4.9.x))
|
||||
$(eval $(call kernel,4.9.44,4.9.x,$(EXTRA)))
|
||||
$(eval $(call kernel,4.9.44,4.9.x,-dbg))
|
||||
$(eval $(call kernel,4.4.83,4.4.x))
|
||||
$(eval $(call kernel,4.4.83,4.4.x,$(EXTRA)))
|
||||
|
||||
# Target for kernel config
|
||||
kconfig: | sources
|
||||
|
Loading…
Reference in New Issue
Block a user