linux mod文件,Linux内核中.mod.c文件中版本信息的含义

__versions部分包含在所有单独的* .mod.c文件中

CRC Symbol

{ 0xa6d8dcb5, "module_layout" },

{ 0x16c2b958, "register_netdevice" },

... ...

是一个符号列表及其相应的CRC.这有两个主要用途:

>所有导出符号的全局列表.

>加载ko模块时的模块版本检查.

模块版本控制背后的基本原理

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 as it indicates that the module is built with

reference to a different version of the Linux kernel source.

编译成功后,所有导出符号的所有CRC的全局列表都存储在Linux内核源目录的Module.symvers文件中.本质上,此检查确保从内核模块调用的任何导出符号都存在于模块所期望的相同位置(内核中的偏移量).

entire source code of the modpost tool在Linux内核源代码中可用. add_depends()是负责在每个* .mod.c文件中生成整个__versions部分的相关函数.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值