[Gllug] How to check if module is in kernel ?

Jon Masters jonathan at jonmasters.org
Tue Nov 16 11:51:56 UTC 2010


On Mon, 2010-11-15 at 22:06 +0100, salsaman at xs4all.nl wrote:
> On Mon, November 15, 2010 18:17, Jon Masters wrote:
> > On Mon, 2010-11-15 at 16:54 +0100, salsaman at xs4all.nl wrote:
> >> On Mon, November 15, 2010 15:33, Richard Jones wrote:
> >> > On Mon, Nov 15, 2010 at 12:57:44PM +0100, salsaman at xs4all.nl wrote:
> >> >> What about looking in /proc/kallsyms ? Is that standard ?
> >> >
> >> > No.  It can be configured out of the kernel, and a number of small
> >> > distros do this because it adds considerable overhead.
> >> >
> >> > What is wrong with doing this the right way, like I said in my
> >> > previous email?
> >> >
> >>
> >> There is nothing I can see in /proc or /sys.
> >
> > Do you see anything in the /sys/module directory?

> Yes, sure, I see vloopback in there, but the original question was how to
> tell if it was compiled into the kernel.

You have some options, which include just parsing that directory and
comparing with lsmod or /proc/modules output, using e.g. diff. But you
can also look for things only present in modules, for example if your
kernel has srcversions turned on for modules, you'll only see the files
like /sys/module/drm_kms_helper/srcversion for loadable modules. A
similar situation is true for the "sections" entries - they are only
present whenever it is a loadable module as these contain the
information from the modinfo and other module ELF sections.

> If it's built as a module I can
> just use lsmod and grep of course.

Would you like an option in lsmod to give you this data? You can open a
bug on the bugzilla.kernel.org, under "other" and then
"module-init-tools" and request that I add this.

Jon.


-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list