Search code examples
ubuntukernel-modulekbuild

How to identify *.ko file given CONFIG_* name?


I enabled a couple new kernel modules as loadable (m as opposed to builtin with y) but do not understand how the CONFIG maps to the .ko file.

modprobe CONFIG_MY_CONFIG
insmod CONFIG_MY_CONFIG
modprobe MY_CONFIG
insmod MY_CONFIG

Solution

  • Firstly, you need to find usage of CONFIG_<MYCONFIG> variable in one of Makefile's (except the top one). You may use grep utility for this (run from kernel source directory):

    grep -r . --include Makefile -e "CONFIG_<MYCONFIG>"
    

    Line with that usage normally looks like

    obj-${CONFIG_<MYCONFIG>} += <driver>.o
    

    Here <driver> is the name of the driver used by modprobe:

    modprobe <driver>
    

    For find exact path to the driver you may use --show-depends option for modprobe:

    modprobe --show-depends <driver>
    

    Makefile's used in Linux kernel are described in Documentation/kbuild/makefiles.txt.