Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

migrated from stackoverflow.com Sep 1 '11 at 13:19

This question came from our site for professional and enthusiast programmers.

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.

share|improve this answer

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.

share|improve this answer
I 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. – dimorphus Sep 1 '11 at 11:27
Indeed. 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. – Eli Iser Sep 1 '11 at 12:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.