How to non-interactively configure the Linux kernel build?
Solution 1
Option I:
The qconfig tool seems to serve the purpose, albeit depends on what interface you'd prefer. It takes an input file with the CONFIG_ directives
that you'd want changed, and changes them. I didn't try it yet.
I didn't try it yet, but it doesn't look like it has an interface via command line arguments, along the lines of what you described.
Option II:
sed -i 's:CONFIG_X=y:# CONFIG_X is not set:g' .config
It's strange that non-interactive configuration seems to not get attention at all. It's certainly not applicable in general, but when you need to just flip a few switches (with few or no dependencies), e.g., a make target, then it would be very useful, more user-friendly than directly using sed
, and better than maintaining .config-with-X
, .config-without-X
.
Solution 2
The simplest way would be to hand build the .config
file with the required options. This would of course require all of the configuration options to be given, so it would be applicable in case of minor changes to an existing interactively-created .config
file.
If you are asking about using the current .config
but only changing some flags via the make
, than I don't know. But you might try to edit the .config
file via a script and then run make
.
Related videos on Youtube
dimorphus
Updated on September 18, 2022Comments
-
dimorphus over 1 year
Is there any method to configure linux kernel in such way (just an example):
make config CONFIG_OPTION=y && make config CONFIG_OPTION1=no CONFIG_OPTION3=64 CONFIG_OPTION4=/path/
and all the dependencies and alternatives of these configuration options will be set automatically in non-interactive mode.
-
T. Perkins over 6 yearsHere is a script that automates Linux kernel configuration with dependency resolution: Kernel Expect (kernelexpect)
-
Gustavo Bittencourt about 4 yearsThe kernel has a tool (./scripts/config) to change specific options on .config, for example:
./scripts/config --set-val CONFIG_OPTION y
-
-
Admin over 12 yearsI tried to use sed for this purpose (changing only some flags in current .config), but in the case of many different .config files it is very difficult to take into account all dependencies and alternatives.
-
Eli Iser over 12 yearsIndeed. The kernel compilation system is quite complex. If you could explain more about what you are trying to accomplish, we might be able to help you more.
-
Ciro Santilli Путлер Капут 六四事 over 7 years
scripts/kconfig/merge_config.sh
is a built-in script that also usessed
: unix.stackexchange.com/a/309264/32558