我正在尝试编译并插入 r8169 realtek 以太网驱动程序。我的内核版本是
ebin@sony:~$ uname -r
4.2.0-rc3-custom
我的本地磁盘中有相同的完整源代码,用于安装当前的内核。当我运行时该模块编译成功make -C /lib/modules/
uname -r/build M=
pwdmodules
但是当我插入模块时,它显示
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
。所以我猜不是未导出符号的问题。如果我需要提供任何其他信息,请告诉我。请帮忙。
正如 Vadim Stupakov 在评论中所说,Module.symvers
模块源目录中的文件解决了我的问题。由此文档 https://www.kernel.org/doc/Documentation/kbuild/modules.txt
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
在模块构建目录中,模块按我的预期工作,没有任何错误。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)