My goal is to change kbuild configs using the command line without messing up dependencies.
For this I've created a 'reference' config by editing my default .config
with make menuconfig
. The 'only' thing I've changed was changing from 64 bit to 32 bit.
Now I took my original config and applied the following command (from the linux kernel root directory)
scripts/kconfig/merge_config.sh original.conf 32bit.conf
The content of 32bit.conf
is simply CONFIG_64=n
.
After diffing the two .config
s from make menuconfig
and my command I see that almost every change from make menuconfig
is also present in the other file. But only almost every change.
$ diff .config.mkmenuconfig .config.command
104d103
< # CONFIG_NO_HZ_FULL is not set
112d110
< # CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set
327d324
< # CONFIG_MPSC is not set
330d326
< # CONFIG_GENERIC_CPU is not set
345c341,342
< # CONFIG_HPET_TIMER is not set
---
> CONFIG_HPET_TIMER=y
> CONFIG_HPET_EMULATE_RTC=y
Where are these differences from and is there an official way to manipulate kbuild .config
s via command line?
As of 5.2+ Linux kernel, CONFIG can take in a second file of
.config
and auto-merge them into a final.config
.But first, on a slightly related note on differences of config file, to show differences from your old
.config
to what is newly issued by the Linux kernel, execute:List of Config Files
Use the '
KCONFIG_DEFCONFIG_LIST
' shell define to be read bymake
utility which containing a list of files, each separated by whitespace.config.network
would be in the same directory as theMakefile
of Linux kernel.and
config.notebook-toshiba
may havethen execute:
Miniconfig Method
(partially based on lkml email from/by Rob Landley, re: miniconfig)
The
allyesconfig
/allmodconfig
/allnoconfig
/randconfig
variants can also use the environment variableKCONFIG_ALLCONFIG
as a flag or a filename that contains config symbols that the user requires to be set to a specific value.If
KCONFIG_ALLCONFIG
is used without a filename whereKCONFIG_ALLCONFIG == “”
orKCONFIG_ALLCONFIG == “1”
, make *config checks for a file named “all{yes/mod/no/def/random}.config
” (corresponding to the *config command that was used) for symbol values that are to be forced.If this file is not found, it checks for a file named “all.config” to contain forced values.
This enables you to create “miniature” config (
miniconfig
) or custom config files containing just the config symbols that you are interested in. Then the kernel config system generates the full.config
file, including symbols of your miniconfig file.This ‘
KCONFIG_ALLCONFIG
’ file is a config file which contains (usually a subset of all) preset config symbols. These variable settings are still subject to normal dependency checks.Examples:
or:
or:
These examples will disable most options (allnoconfig) but enable or disable the options that are explicitly listed in the specified mini-config files.
Reference