From 9e5c86f006082f6710e6fff0167f9a3717b373a2 Mon Sep 17 00:00:00 2001 From: David Sheets Date: Wed, 10 Aug 2016 16:46:36 +0100 Subject: [PATCH 1/2] kernel: add a Makefile DEBUG variable and a kernel_config for debugging Signed-off-by: David Sheets --- alpine/kernel/Dockerfile | 6 ++++++ alpine/kernel/Makefile | 4 +++- alpine/kernel/kernel_config.debug | 25 +++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 alpine/kernel/kernel_config.debug diff --git a/alpine/kernel/Dockerfile b/alpine/kernel/Dockerfile index 66e550571..d67f4485f 100644 --- a/alpine/kernel/Dockerfile +++ b/alpine/kernel/Dockerfile @@ -2,6 +2,7 @@ FROM ubuntu:15.10 ARG KERNEL_VERSION=4.4.17 ARG ARCH=x86_64 +ARG DEBUG=0 ENV KERNEL_SOURCE=https://www.kernel.org/pub/linux/kernel/v4.x/linux-${KERNEL_VERSION}.tar.xz @@ -59,6 +60,11 @@ RUN git clone -b "$AUFS_BRANCH" "$AUFS_REPO" /aufs && \ COPY kernel_config.x86_64 /linux/arch/x86/configs/x86_64_defconfig COPY kernel_config.arm /linux/arch/arm/configs/versatile_defconfig +COPY kernel_config.debug /linux/debug_config + +RUN if [ $DEBUG -ne "0" ]; then \ + cat /linux/debug_config >> /linux/arch/x86/configs/x86_64_defconfig; \ + fi # Apply local patches COPY patches /patches diff --git a/alpine/kernel/Makefile b/alpine/kernel/Makefile index afb79d958..406ff9517 100644 --- a/alpine/kernel/Makefile +++ b/alpine/kernel/Makefile @@ -1,10 +1,12 @@ ARCH ?= x86_64 +DEBUG ?= 0 all: $(ARCH)/vmlinuz64 $(ARCH)/mobykernel-build: Dockerfile kernel_config.$(ARCH) mkdir -p $(ARCH) && \ - docker build --build-arg ARCH=$(ARCH) -t mobykernel-$(ARCH):build . + docker build --build-arg ARCH=$(ARCH) --build-arg DEBUG=$(DEBUG) \ + -t mobykernel-$(ARCH):build . touch $@ $(ARCH)/aufs-utils.tar $(ARCH)/kernel-source-info $(ARCH)/kernel-patches.tar $(ARCH)/kernel-modules.tar: $(ARCH)/mobykernel-build diff --git a/alpine/kernel/kernel_config.debug b/alpine/kernel/kernel_config.debug new file mode 100644 index 000000000..9ea1b4103 --- /dev/null +++ b/alpine/kernel/kernel_config.debug @@ -0,0 +1,25 @@ + + +## MOBY DEBUG OPTIONS ## + +CONFIG_LOCKDEP=y +CONFIG_DEBUG_INFO=y +CONFIG_FRAME_POINTER=y +CONFIG_LOCKUP_DETECTOR=y +CONFIG_DETECT_HUNG_TASK=y +CONFIG_DEBUG_TIMEKEEPING=y +CONFIG_DEBUG_RT_MUTEXES=y +CONFIG_DEBUG_SPINLOCK=y +CONFIG_DEBUG_MUTEXES=y +CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y +CONFIG_DEBUG_LOCK_ALLOC=y +CONFIG_PROVE_LOCKING=y +CONFIG_LOCK_STAT=y +CONFIG_DEBUG_ATOMIC_SLEEP=y +CONFIG_DEBUG_LIST=y +CONFIG_DEBUG_NOTIFIERS=y +CONFIG_PROVE_RCU=y +CONFIG_RCU_TRACE=y +CONFIG_KGDB=y +CONFIG_KGDB_SERIAL_CONSOLE=y +CONFIG_KGDBOC=y From 1163bf09be9211b09d9786674a75c37b64b89f97 Mon Sep 17 00:00:00 2001 From: David Sheets Date: Wed, 10 Aug 2016 17:08:07 +0100 Subject: [PATCH 2/2] kernel: apply debug configuration to all kernels Signed-off-by: David Sheets --- alpine/kernel/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/alpine/kernel/Dockerfile b/alpine/kernel/Dockerfile index d67f4485f..ca5e33ce9 100644 --- a/alpine/kernel/Dockerfile +++ b/alpine/kernel/Dockerfile @@ -64,6 +64,7 @@ COPY kernel_config.debug /linux/debug_config RUN if [ $DEBUG -ne "0" ]; then \ cat /linux/debug_config >> /linux/arch/x86/configs/x86_64_defconfig; \ + cat /linux/debug_config >> /linux/arch/arm/configs/versatile_defconfig; \ fi # Apply local patches