From d14412810ae400aa24e2a3689208fcb71e0e1d61 Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Wed, 14 Jun 2017 12:08:29 -0600 Subject: [PATCH 1/4] kernel config project: s/x86/x86_64 Let's use the kernel machine architecture for this value. Also remove a broken check. The "arch" binary on OSX outputs different stuff than on linux. Since we don't need this check anyway (the variable is mostly to demonstrate how cross platform stuff would work, not to actually do it yet), let's just remove the check. Signed-off-by: Tycho Andersen --- projects/kernel-config/Makefile | 2 +- .../kernel-config/{kernel_config.x86 => kernel_config.x86_64} | 0 .../{kernel_config.x86.4.10.x => kernel_config.x86_64.4.10.x} | 0 .../{kernel_config.x86.4.9.x => kernel_config.x86_64.4.9.x} | 0 4 files changed, 1 insertion(+), 1 deletion(-) rename projects/kernel-config/{kernel_config.x86 => kernel_config.x86_64} (100%) rename projects/kernel-config/{kernel_config.x86.4.10.x => kernel_config.x86_64.4.10.x} (100%) rename projects/kernel-config/{kernel_config.x86.4.9.x => kernel_config.x86_64.4.9.x} (100%) diff --git a/projects/kernel-config/Makefile b/projects/kernel-config/Makefile index a06c6be66..710c72007 100644 --- a/projects/kernel-config/Makefile +++ b/projects/kernel-config/Makefile @@ -12,7 +12,7 @@ HASH?=$(shell git ls-tree HEAD -- ../$(notdir $(CURDIR)) | awk '{print $$3}') # Name on Hub IMAGE:=kernel -ARCH?=$(shell if [ "$$(arch)" = "x86_64" ]]; then echo x86; else $$(arch); fi) +ARCH?=x86_64 .PHONY: check tag push sign # Targets: diff --git a/projects/kernel-config/kernel_config.x86 b/projects/kernel-config/kernel_config.x86_64 similarity index 100% rename from projects/kernel-config/kernel_config.x86 rename to projects/kernel-config/kernel_config.x86_64 diff --git a/projects/kernel-config/kernel_config.x86.4.10.x b/projects/kernel-config/kernel_config.x86_64.4.10.x similarity index 100% rename from projects/kernel-config/kernel_config.x86.4.10.x rename to projects/kernel-config/kernel_config.x86_64.4.10.x diff --git a/projects/kernel-config/kernel_config.x86.4.9.x b/projects/kernel-config/kernel_config.x86_64.4.9.x similarity index 100% rename from projects/kernel-config/kernel_config.x86.4.9.x rename to projects/kernel-config/kernel_config.x86_64.4.9.x From 502c2c674fc1c5c282d661d360e8dac781228dfb Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Fri, 26 May 2017 16:48:55 -0600 Subject: [PATCH 2/4] kernel-config: less special casing for PANIC_ON_OOPS Instead of having a special case sed script, we can just put this in the .debug config file, and have a special case when it's being checked. Signed-off-by: Tycho Andersen --- projects/kernel-config/kernel_config.debug | 1 + projects/kernel-config/makeconfig.sh | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/projects/kernel-config/kernel_config.debug b/projects/kernel-config/kernel_config.debug index 00e73d577..7149bb31f 100644 --- a/projects/kernel-config/kernel_config.debug +++ b/projects/kernel-config/kernel_config.debug @@ -24,3 +24,4 @@ CONFIG_KGDB_SERIAL_CONSOLE=y CONFIG_KGDBOC=y CONFIG_DEBUG_RODATA_TEST=y CONFIG_DEBUG_WX=y +# CONFIG_PANIC_ON_OOPS is not set diff --git a/projects/kernel-config/makeconfig.sh b/projects/kernel-config/makeconfig.sh index 98e675133..86c940181 100755 --- a/projects/kernel-config/makeconfig.sh +++ b/projects/kernel-config/makeconfig.sh @@ -37,11 +37,6 @@ merge_config "/config/kernel_config.${ARCH}" merge_config "/config/kernel_config.${KERNEL_SERIES}" merge_config "/config/kernel_config.${ARCH}.${KERNEL_SERIES}" -if [ -n "${DEBUG}" ]; then - sed -i sed -i 's/CONFIG_PANIC_ON_OOPS=y/# CONFIG_PANIC_ON_OOPS is not set/' /linux/arch/x86/configs/x86_64_defconfig - append_config "/config/kernel_config.debug" -fi - cd /linux && make oldconfig # Let's make sure things are the way we want, i.e. every option we explicitly @@ -51,6 +46,8 @@ function check_config() if [ ! -f "$1" ]; then return; fi while read line; do + # CONFIG_PANIC_ON_OOPS is special, and set both ways, depending on + # whether DEBUG is set or not. if [ -n "${DEBUG}" ] && [ "$line" == "CONFIG_PANIC_ON_OOPS=y" ]; then continue; fi value="$(grep "^${line}$" /linux/.config || true)" From 9757a33bf96731c76d2bce81f154fccfdeed71e2 Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Fri, 26 May 2017 17:12:46 -0600 Subject: [PATCH 3/4] kernel config project: makeconfig.sh takes config as args Instead of figuring out which config files to use inside of makeconfig.sh, let's figure that out in the Dockerfile and pass them into the script. Signed-off-by: Tycho Andersen --- projects/kernel-config/Dockerfile | 9 ++++++++- projects/kernel-config/makeconfig.sh | 23 +++++++---------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/projects/kernel-config/Dockerfile b/projects/kernel-config/Dockerfile index 346a29443..e6f8a6d70 100644 --- a/projects/kernel-config/Dockerfile +++ b/projects/kernel-config/Dockerfile @@ -23,7 +23,14 @@ RUN set -e && for patch in /patches/*.patch; do \ patch -p1 < "$patch"; \ done -RUN /config/makeconfig.sh ${ARCH} ${KERNEL_SERIES} +RUN \ + if [ -n "${DEBUG}" ]; then dbg=kernel_config.debug; else dbg=; fi && \ + /config/makeconfig.sh \ + kernel_config.base \ + "kernel_config.${ARCH}" \ + "kernel_config.${ARCH}.${KERNEL_SERIES}" \ + "kernel_config.${KERNEL_SERIES}" \ + "$dbg" RUN /config/check-kernel-config.sh /linux/.config RUN mkdir /out diff --git a/projects/kernel-config/makeconfig.sh b/projects/kernel-config/makeconfig.sh index 86c940181..671d15a08 100755 --- a/projects/kernel-config/makeconfig.sh +++ b/projects/kernel-config/makeconfig.sh @@ -2,10 +2,6 @@ set -e -ARCH=$1 -KERNEL_SERIES=$2 -DEBUG=$3 - cd /linux && make defconfig function merge_config() @@ -32,10 +28,9 @@ function merge_config() cd /linux && make defconfig && make oldconfig -merge_config "/config/kernel_config.base" -merge_config "/config/kernel_config.${ARCH}" -merge_config "/config/kernel_config.${KERNEL_SERIES}" -merge_config "/config/kernel_config.${ARCH}.${KERNEL_SERIES}" +for config in "$@"; do + merge_config "$config" +done cd /linux && make oldconfig @@ -48,7 +43,7 @@ function check_config() while read line; do # CONFIG_PANIC_ON_OOPS is special, and set both ways, depending on # whether DEBUG is set or not. - if [ -n "${DEBUG}" ] && [ "$line" == "CONFIG_PANIC_ON_OOPS=y" ]; then continue; fi + if [ "$line" == *"CONFIG_PANIC_ON_OOPS"* ]; then continue; fi value="$(grep "^${line}$" /linux/.config || true)" # It's okay to for the merging script to have simply not listed values we @@ -64,10 +59,6 @@ function check_config() done < $1 } -check_config "/config/kernel_config.base" -check_config "/config/kernel_config.${ARCH}" -check_config "/config/kernel_config.${KERNEL_SERIES}" -check_config "/config/kernel_config.${ARCH}.${KERNEL_SERIES}" -if [ -n "${DEBUG}" ]; then - check_config "/config/kernel_config.debug" -fi +for config in "$@"; do + check_config "$config" +done From d9135b515ccd52ff160cc5c668644f90e971a3c8 Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Wed, 14 Jun 2017 11:25:00 -0700 Subject: [PATCH 4/4] kernel config project: add a writeup Add a writeup of how the kernel config project designed to behave when migrating kernel versions. Signed-off-by: Tycho Andersen --- projects/kernel-config/README.md | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 projects/kernel-config/README.md diff --git a/projects/kernel-config/README.md b/projects/kernel-config/README.md new file mode 100644 index 000000000..84b5567b2 --- /dev/null +++ b/projects/kernel-config/README.md @@ -0,0 +1,38 @@ +## kernel config project + +The intent of the kernel config project is to demonstrate a better way to +handle kernel config. Specifically: + +* support for arch and version specific config +* make diffs as readable as possible +* ensure that all of our config settings are kept after oldconfig + +We achieve the goals by: + +* having version-specific config in separate files, which are automatically + merged +* only keeping track of visible symbols, only keeping track of a delta from + defconfig, and keeping symbols sorted alphabetically +* checking after a `make oldconfig` in the kernel, that all of our symbols are + set as we want them to be + +The bulk of this work happens in makeconfig.sh, which merges the configs (and +checks that the resulting config is okay). + +One important piece is generating a kernel config for a new version. There are +a few cases: + +* A new kconfig symbol is introduced that we want to set a non-default value + of: in this case, we introduce a new `kernel_config.${VERSION}` file, and set + the value to what we want to set it to +* A config symbol that was no-default before become the default: in this case, + we would move the non-default setting to version specific files for all of + the other versions, and not set anything for this new kernel, since what we + want is now the default. +* A symbol we want to set is removed (or renamed), similar to the above, we + simply move the old symbol name to version specific files for older kernels + and put the new symbol name (if it exists) in the new version specific file + +When dropping support for an old kernel version, we just delete that version +specific file, and promote any option that is present in all other versions to +the common config file.