0

I added a feature in Linux kernel which I switch on/off using pre-processor macros. I now want these macros to be available in make menuconfig as configuration parameters. I tried to add them in the default configuration file but the make process does not recognize its format (it gives error). Is there a special way to add preprocessor macros to the configuration file (for e.g. preceding the paramater name with a CONFIG_*)?

I am not too experienced with the configuration process. Any help will be appreciated.

Thanks.

jada12276
  • 129
  • 8
  • 1
    Read the [documentation](http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/kbuild). – CL. Apr 15 '16 at 12:05
  • @CL Thank you for the link. I will certainly go through it. – jada12276 Apr 17 '16 at 00:09
  • @SamratDas Thanks for the link. This exactly what I was looking for. I still have to try the solution in the link (will do so on Monday) after which I will mark it solved (if I succeed). – jada12276 Apr 17 '16 at 00:13

1 Answers1

3

menuconfig configuration is done by 2 files that exists in almost any directory in the kernel code. Kconfig and Makefile
To add a new configuration you need to choose the directory based on the settings you want to add and edit the 2 files: on Kconfig you need to add:

config MY_SETTING
    bool “This is the menuconfig label”
    default y
    help
       help for your new option 

Edit the Makefile in the same directory and add:

obj-$(CONFIG_MY_SETTING)       += yournewcode.o

The constant CONFIG_MY_SETTING is defined by the kernel and contains 'y' if the user select it from the menuconfig you can also change 'bool' to 'tristate' if you want to add a file as a loadable module and the above constant contains 'm' if user choose to compile it as a module

if you don't need any file associated with the constant just declare it in Kconfig file

Liran Ben Haim
  • 436
  • 3
  • 10
  • Thanks for your explanation. But my question is a duplicate which is answered in the link shared by Jakuje. – jada12276 Apr 19 '16 at 12:57