Prashanth Chandra Prashanth Chandra - 3 months ago 8
Linux Question

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

I added a few lines with

MODULE_AUTHOR
, and
MODULE_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
.

However, I want to be able to view the module's info with
modinfo
but it doesn't work.

I get
modinfo: ERROR: Module hello not found.


I tried running
depmod
and
depmod -A
but they didn't make a difference.

Is there any way to make
modinfo
"reload" so that I can view info for newly added modules?

Answer

From the man page:

modinfo extracts information from the Linux Kernel modules given on the command line. 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.

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