linux kernel compilation: ERROR: "function" [path/to/module/module.ko] undefined

linux kernel compilation: ERROR: "function" [path/to/module/module.ko] undefined

我有一个与 this one, only for me it's an error not a warning. I'm building linux-4.8.5 with a patch 类似的问题应用于一个模块。我得到:

ERROR: "intel_soc_pmic_readb" [drivers/gpu/drm/i915/i915.ko] undefined!
ERROR: "intel_soc_pmic_writeb" [drivers/gpu/drm/i915/i915.ko] undefined!
scripts/Makefile.modpost:91: recipe for target '__modpost' failed
make[1]: *** [__modpost] Error 1
Makefile:1201: recipe for target 'modules' failed
make: *** [modules] Error 2

在另一个问题中,他们说了一些关于 KBUILD_EXTRA_SYMBOLS 的内容,文档应该在 Documentation/kbuild/modules.txt 中。但是阅读这个文件,这似乎只适用于 linux 本身不包含的模块?

函数定义如下

int function(){
    do_stuff;
}
EXPORT_SYMBOL(function);

然后是声明

 int function();

在 include 文件夹中的 .h 文件中,它被称为

 #include <the_aforementioned_file.h>
//stuff
function();

来自与函数定义相同的文件夹中的文件。整个源代码树中没有其他函数名称出现。

而且我真的没有看出错误。我想很可能我没找对地方。

正如 Tsyvarev 在评论中所解释的那样,这个错误是因为没有构建有问题的模块,它需要选项 CONFIG_INTEL_SOC_PMIC