简体   繁体   English

如何查看有关新加载的外部Linux内核模块的信息?

[英]How to view information about a newly loaded external Linux kernel module?

I have a simple Hello World kernel module from http://www.tldp.org/LDP/lkmpg/2.6/html/x121.html 我有一个来自http://www.tldp.org/LDP/lkmpg/2.6/html/x121.html的简单Hello World内核模块
I added a few lines with MODULE_AUTHOR , and MODULE_DESCRIPTION 我用MODULE_AUTHORMODULE_DESCRIPTION添加了几行

It builds successfully, I'm able to insert it with insmod into the current kernel, view logs with dmesg , check that the module exists with lsmod . 它构建成功,我可以使用insmod将其插入当前内核,使用dmesg查看日志,使用lsmod检查模块是否存在。

However, I want to be able to view the module's info with modinfo but it doesn't work. 但是,我希望能够使用modinfo查看模块的信息,但是它不起作用。
I get modinfo: ERROR: Module hello not found. 我收到modinfo: ERROR: Module hello not found.
I tried running depmod and depmod -A but they didn't make a difference. 我尝试运行depmoddepmod -A但它们没有任何区别。

Is there any way to make modinfo "reload" so that I can view info for newly added modules? 有什么办法可以使modinfo “ reload”以便我可以查看新添加的模块的信息?

From the man page: 从手册页:

modinfo extracts information from the Linux Kernel modules given on the command line. modinfo从命令行上给出的Linux内核模块中提取信息。 If the module name is not a filename, then the /lib/modules/version directory is searched, as is also done by modprobe(8) when loading kernel modules. 如果模块名称不是文件名,则将搜索/ lib / modules / version目录,这在加载内核模块时也由modprobe(8)完成。

So it looks like this command just uses the kernel module files to get this information, so you can either run: 因此,看起来此命令仅使用内核模块文件来获取此信息,因此您可以运行:

modinfo hello.ko

or you could put your kernel module in the /lib/modules/version/ directory 或者您可以将内核模块放在/lib/modules/version/目录中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM