User:Egberts/Drafts/Gentoo Kernel Configuration Guide
Editor: this section gets inserted into Kernel/Gentoo Kernel Configuration Guide or into Kernel/Configuration
Advanced kernel configurations
Linux kernel also has provided two scripts to assist with updating kernel configuration settings (without having to tediously navigate through make menuconfig:
- change a single setting; linux/scripts/config command (introduced 3.33rc1+)
- change many kernel configuration settings; linux/scripts/kconfig/merge_config.sh command (introduced 2.6.29-rc1+)
Single option approach
One way to change the linux/.config at the command line is to change one-line/setting per command evocation.
An example of changing five(5) kernel configuration settings is shown below:
./scripts/config --set-val CONFIG_OPTION y
./scripts/config --enable CONFIG_BRIDGE
./scripts/config --enable CONFIG_MODULES
./scripts/config --disable CONFIG_X25
./scripts/config --module CONFIG_NFT
The purpose of the make oldconfig is to go over the entire kernel configuration settings and make additional changes based on Kconfig dependency logic.
it is possible that a setting will revert back to its old value due to and by dependencies of other settings. For exmaple, trying to be turning off CONFIG_INITRAMFS will flip back on due to CONFIG_MODULES forces the requirement of re-enabling initramfs back to enabled.
The merge_config  command is detailed here.
Multiple-file merge approach
When building and customizing Linux kernel repeatedly, it becomes a time-saver to incorporate all the settings into a single (but smaller) kernel configuration file. Each kernel configuration file would represent a certain feature, device, or functionality.
This makes grouping of many settings of kernel configurations less forgetful and easily referenced by a (descriptive) filename that can be easily inserted into a Linux kernel configuration.
Given the two example files:
CONFIG_HIBERNATION=n CONFIG_AUTOSLEEP=n CONFIG_ACPI_SLEEP=n CONFIG_PM_SLEEP=n
# Terminus Font is a clean, fixed width bitmap font, # designed for long (8 and more hours per day) work with # computers. This is the high resolution, large version # for use with HiDPI screens. CONFIG_FONTS=y CONFIG_FONT_SUPPORT=y CONFIG_FONT_TER16x32=y
./scripts/kconfig/merge_config.sh kernel-kconfig-qemu-always-on.config # Auto-add/auto-remove CONFIG_ dependencies
The command to update the default /usr/src/linux/.config file is:
Now the kernel will incorporate both readable terminals and ensure that it would never hibernate nor sleep.
- merge_config.sh[https://www.kernel.org/doc/html/latest/kbuild/kconfig.html#nconfig-mode config