如何使用depmod使一个Linux内核模块依赖于另一个外部模块? [英] How to make one Linux kernel module depend on another external module with depmod?

查看:175
本文介绍了如何使用depmod使一个Linux内核模块依赖于另一个外部模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个内核模块,该模块取决于一个现有的内核模块.我正在从树中构建模块(作为外部模块).

I'm writing a kernel module which depends on one existing kernel module. I'm building my module out of the tree (as an external module).

我如何声明依赖关系,以便depmod识别它?

How can I declare the dependency, so that it is recognized by depmod?

推荐答案

虽然不完全令人满意,但我想使modprobe发挥作用的最佳方法是在modules.dep

While not entirely satisfying, the best I've come up with to make modprobe work is either adding an entry to modules.dep

# tail -1 modules.dep
../../../../home/ctuffli/mymod/mymod.ko: kernel/drivers/scsi/libsas/libsas.ko kernel/drivers/scsi/scsi_transport_sas.ko

或者,将树外模块符号链接到/lib/modules/,并让depmod找出依赖关系

or alternatively, symbolically linking the out-of-tree module to /lib/modules/ and let depmod figure out the dependencies

# ln -s /home/ctuffli/mymod/mymod.ko /lib/modules/2.6.31-19-server/kernel/drivers/scsi/
# depmod
# grep mymod /lib/modules/2.6.31-19-server/modules.dep
kernel/drivers/scsi/mymod.ko: kernel/drivers/scsi/libsas/libsas.ko kernel/drivers/scsi/scsi_transport_sas.ko

这篇关于如何使用depmod使一个Linux内核模块依赖于另一个外部模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆