gpt4 book ai didi

linux - "Unknown symbol in module"在模块插入时尽管有 EXPORT_SYMBOL

转载 作者:太空狗 更新时间:2023-10-29 11:13:11 26 4
gpt4 key购买 nike

我正在尝试编译并插入 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 文件放在模块源目录中解决了我的问题。从这个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 放入模块构建目录时,该模块按我预期的方式工作,没有任何错误。

关于linux - "Unknown symbol in module"在模块插入时尽管有 EXPORT_SYMBOL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32392611/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com