mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 18:11:35 +00:00
Merge pull request #2042 from tych0/kernel-config-docs
Kernel config project docs
This commit is contained in:
commit
d2278286ec
@ -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
|
||||
|
@ -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:
|
||||
|
38
projects/kernel-config/README.md
Normal file
38
projects/kernel-config/README.md
Normal file
@ -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.
|
@ -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
|
||||
|
@ -2,10 +2,6 @@
|
||||
|
||||
set -e
|
||||
|
||||
ARCH=$1
|
||||
KERNEL_SERIES=$2
|
||||
DEBUG=$3
|
||||
|
||||
cd /linux && make defconfig
|
||||
|
||||
function merge_config()
|
||||
@ -32,15 +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}"
|
||||
|
||||
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
|
||||
for config in "$@"; do
|
||||
merge_config "$config"
|
||||
done
|
||||
|
||||
cd /linux && make oldconfig
|
||||
|
||||
@ -51,7 +41,9 @@ function check_config()
|
||||
if [ ! -f "$1" ]; then return; fi
|
||||
|
||||
while read line; do
|
||||
if [ -n "${DEBUG}" ] && [ "$line" == "CONFIG_PANIC_ON_OOPS=y" ]; then continue; fi
|
||||
# CONFIG_PANIC_ON_OOPS is special, and set both ways, depending on
|
||||
# whether DEBUG is set or not.
|
||||
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
|
||||
@ -67,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
|
||||
|
Loading…
Reference in New Issue
Block a user