mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-09-26 02:08:12 +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:
@@ -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}" && \
|
||||
|
Reference in New Issue
Block a user