List my Staging Drivers

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Tue Dec 9 20:50:47 EST 2014


On Tue, 09 Dec 2014 22:18:48 -0200, Lucas Tanure said:

> This command:
> 
> $ lsmod  | grep -Eo '^[^ ]+' | sed 1d | xargs modinfo | grep filename

Note that only finds stuff that's been built with CONFIG_FOOMOD=m,  Modules
that were built into the kernel with =y won't show on an lsmod.  On my laptop
at the moment:

% lsmod | wc -l
34
% ls /sys/module | wc -l
129

Quite obviously, relying on lsmod isn't going to help.

So you really want something like:

% ls /sys/module | xargs modinfo 2> /dev/null | grep filename
% echo the following are built-in; echo `ls /sys/module | xargs modinfo 2>&1 > /dev/null | awk '{print $4}'`

The following *seems* to work.  I admit I haven't tested it against a distro kernel
where the build/ and source/ symlinks may point different places, etc etc...

find /lib/modules/`uname -r`/build/ `ls /sys/module | xargs modinfo 2>&1 > /dev/null | awk '{print " -name " $4".o -o"} END {print "-name null"}'`

(And even the 129 entries in /sys/module doesn't cover the whole story.

find /lib/modules/3.18.0-next-20141208/build/ -name '*.o' | wc -l
4257
zgrep =y /proc/config.gz | wc -l
1072

So there's *lots* more chunks of code that are builtin as options that
simply don't identify as "modules".  At that point, it's time to re-ask
what question you *really* wanted answered. "Find drivers that I'm using"
is *not* the same thing as "what modules do I have"....


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20141209/abfc9ed0/attachment.bin 


More information about the Kernelnewbies mailing list