“模块中的未知符号";尽管有EXPORT_SYMBOL,但仍可插入模块 [英] "Unknown symbol in module" on module insertion despite EXPORT_SYMBOL
问题描述
我正在尝试编译并插入r8169 realtek以太网驱动程序.我的内核版本是
I am trying to compile and insert the r8169 realtek ethernet driver. My kernel version is
ebin@sony:~$ uname -r
4.2.0-rc3-custom
我的本地磁盘上有完整的源代码,该磁盘用于安装当前内核.当我运行make -C /lib/modules/
uname -r /build M=
pwd modules
时,模块编译成功
但是当我插入模块时,它会显示
I have the full source of the same in my local disk, which is used to install the current kernel. The module compiles successfully when I run make -C /lib/modules/
uname -r/build M=
pwdmodules
but when I insert the module, it shows
ebin@sony:~/linux_testing/linux-stable/drivers/net/ethernet/realtek$ sudo insmod r8169.ko
insmod: ERROR: could not insert module r8169.ko: Unknown symbol in module
ebin@sony:~/linux_testing/linux-stable/drivers/net/ethernet/realtek$ dmesg
[16717.311216] r8169: Unknown symbol mii_ethtool_gset (err 0)
浏览源代码时,我发现
EXPORT_SYMBOL(mii_ethtool_gset);
已在mii.c
中导出.因此,我想这不是未导出符号的问题.让我知道是否需要提供其他信息.请帮忙.
already exported in the mii.c
. So I guess it is not the problem of unexported symbol. Let me know if I have to provide any other info. Please help.
推荐答案
正如Vadim Stupakov在评论中所说,将Module.symvers
文件放在模块源目录中解决了我的问题.从此文档
As Vadim Stupakov said in the comment, Putting the Module.symvers
file in the module source directory fixed my issue. From this documentation
Module versioning is enabled by the CONFIG_MODVERSIONS tag, and is used
as a simple ABI consistency check. A CRC value of the full prototype
for an exported symbol is created. When a module is loaded/used, the
CRC values contained in the kernel are compared with similar values in
the module. if they are not equal, the kernel refuses to load the
module.
Module.symvers contains a list of all exported symbols from a kernel
build.
据我了解,Module.symvers
是在make modules
上创建的.我错过了那个文件.当我将适当的Module.symvers
放在模块构建目录中时,该模块将按预期运行,而不会出现任何错误.
As per my understanding, Module.symvers
is created on make modules
. I missed out that file. When I put the appropriate Module.symvers
in the module build directory, the module works as I expected without any errors.
这篇关于“模块中的未知符号";尽管有EXPORT_SYMBOL,但仍可插入模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!