KBUILD_EXTRA_SYMBOLS - Using Symbols exported from external module

Consider a scenario where you have a symbol (variable/function) present in one external module and you want to use it in your another external module and the source code of these modules is not built by single Makefile, then even you export the symbol from first module, when you are building the second module, it will throw Warning saying that the exported symbol is not found.


The above screenshot shows the module1 code which is exporting a variable 'my_class'



kbuild needs  to have full knowledge of all symbols to avoid spitting out warnings about undefined symbols.
When an external module is built, a Module.symvers file is generated containing all exported symbols which are not defined in the kernel.

Use KBUILD_EXTRA_SYMBOLS and provide it the path of the Module.symvers file if it is present in some other directory other than the module directory.
To resolve this, use KBUILD_EXTRA_SYMBOLS in the Makefile, add the following:

 KBUILD_EXTRA_SYMBOLS := /home/your-user/path/to/module1/Module.symvers


You can see the difference when adding KBUILD_EXTRA_SYMBOLS in the above two screenshots.


Comments

Popular posts from this blog

bb.utils.contains yocto

Difference between RDEPENDS and DEPENDS in Yocto

make config vs oldconfig vs defconfig vs menuconfig vs savedefconfig