Reputation: 15089
Can I programaticaly generate a .config
file before building a kernel, with some pre-selected values (say CONFIG_DEBUG_INFO
for example). Something like make defconfig CONFIG_DEBUG_INFO=y && make
?
Upvotes: 3
Views: 2300
Reputation: 2470
You can create a .config with the desired options, then run make oldconfig
. This will take all the options it can find in the config and ask you for the unset options. Alternatively you can run make olddefconfig
which does the same but instead of asking, uses the default value for options it didn't find.
Upvotes: 0
Reputation: 332986
I think you should be able to do this with the default config for your architecture together with make allnoconfig
. What you should do is copy the default config for your architecture to, say my-custom.config
, add the symbols that you want, and run make KCONFIG_ALLCONFIG=my-custom.config allnoconfig
. In full, for x86_64:
$ cp arch/x86/configs/x86_64_defconfig my-custom.config
$ cat "CONFIG_DEBUG_INFO=y" >> my-custom.config
$ make KCONFIG_ALLCONFIG=my-custom.config allnoconfig
This will configure it such that everything is turned off except for the things in your default config (which includes the architecture default config plus the pre-selected values that you've enabled) and their dependencies. See the kconfig documentation for details.
edit After testing this out myself, this isn't quite right, as it doesn't pick up up default values that aren't contained in your architecture's defaults. Instead, you probably want to generate a default config for your architecture with make defconfig
, add your specific tweaks to that, and then do the allnoconfig trick with that:
$ make KCONFIG_CONFIG=my-custom.config defconfig
$ echo "CONFIG_DEBUG_INFO=y" >> my-custom.config
$ make KCONFIG_ALLCONFIG=my-custom.config allnoconfig
Upvotes: 3