Kconfig and LKM
I'm working with LKM outside the kernel tree and I want to use some compiling options for my module like MYLKM_CONFIG_{something}. I know that this can be done using the C preprocessing (#define // #ifdef // #endif). But I want to know is it possible to use Kbuild (Kconfig files or something related) for that purposes?.开发者_如何转开发.
And one more question. Is it possible to make menuconfig
for only my module, not for the whole kernel tree?
Thanks.
If you use the recommanded method for building drivers outside of the tree (see ldd Chapter 2), the command should look like this:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
The effect of this command is two:
- the -C option changes the current directory to the
$(KERNELDIR)
where it finds the main kernel Makefile - the -M option makes the makefile go back your current module dev directory
$(PWD)
, where it tries to build the modules target
So if you copy your .config from $(KERNELDIR)
to $(PWD)
, it should be parsed by the Makefile and you should have all your CONFIG_LKM_* #defines available (not tested though, but it sounds logical).
For the make menconfig
question, with regards to the above explanation, it may work if you add some KConfig files in your $(PWD)
directory.
精彩评论