4
votes

To build the linux kernel from source, I would normally do something like:

make mrproper
make menuconfig
make

In the menuconfig step, I enable some modules I want to have built into the kernel that aren't part of the default config file (defconfig).

Now suppose I know in advance what modules I want to enable in menuconfig, but want to automate the build process from a script (i.e. non-interactively). I don't want to edit the .config file manually before issuing make as I may not correctly resolve the dependencies of the modules I want to install.

Is there some way of replacing the menuconfig step with something like

make updateconfig module_name

?

PS I don't want to do menuconfig the first time and then save the updated .config as a new default config.

4
Create once a config file and run make olddefconfig each time you want to update the kernel. And why you don't want to go this direction?0andriy
I ended up doing something like this. My process was: make mrproper; merge some default config files to create a new .config; make olddefconfig in order to specify any remaining options non-interactively; makeuser12066
Btw, you might put in your local branch something like tiny.config and adjust scripts/kconfig/Makefile to support it in the same way. In this case you will never have a conflicts if your "third-party" defconfig file has been changed.0andriy

4 Answers

4
votes

make menuconfig is one of five similar tools that can configure the Linux kernel source, a necessary early step needed to compile the source code. make menuconfig, with a menu-driven user interface, allows the user to choose the features of the Linux kernel (and other options) that will be compiled.

make menuconfig is tool which will load all attribute which define in Kconfig and create new .config. First you will have to add your attribute to Kconfig then it'll show in menuconfig.

 Example :
 I want to add new backlight driver in kernel.
 1. open Kconfig 'drivers/video/backlight/Kconfig' and add below line---

    config BACKLIGHT_LOCOMO
    tristate "Sharp LOCOMO LCD/Backlight Driver"
    depends on SHARP_LOCOMO
    default y
    help
      If you have a Sharp Zaurus SL-5500 (Collie) or SL-5600 (Poodle) say y to
      enable the LCD/backlight driver.

    2. Add CONFIG_BACKLIGHT_LOCOMO to make file.
        obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o

Now run make mrproper and make menuconfig. It'll show in menu.


Otherwise you can manually add to .config 'CONFIG_BACKLIGHT_LOCOMO=y'.

3
votes

I was looking for the answer to Adding an entry to the Linux Kernel .config file

i.e. you can do:

make CONFIG_XILINX_FIXED_DEVTREE_ADDR=y

and the specified module option will be compiled in. Presumably this also takes care of the module dependencies; I've tried it on a module with some dependencies and it seems to work ok.

2
votes

There is a config script in the tree that allows callers to enable and disable options in .config from the shell. It doesn't look like it does any dependency resolution, though, so perhaps it makes sense to run make olddefconfig after using it, as other comments mention.

1
votes

There is also the merge_config.sh script in the tree that allows to merge an additional config-fragment file to your config. Have a look at this answer for details.