[LCP]how to obtain a list of installed device drivers on a Li nux box
Matthew Sanderson
matthew at DaMOO.csun.edu
Wed Mar 27 12:17:05 UTC 2002
Shalabh,
Maybe you need tools like this on Windows. But on Linux, I don't need a
program like this to tell me what's happening, because what's happening is
what I said should happen (or there has been some sort of catastrophic
error like a hardware failure).
In this case the device drivers installed on the system are the ones I
said 'Y' or 'M' to when I compiled the kernel (or the ones the vendor said
'Y' or 'M' to if I'm running their kernel). I personally can't see a need
for this tool; all it does it show me what I entered into the computer
earlier.
Are you aware of Hotplug? It makes it pretty much unnecessary for most
users to worry about device drivers, so it might remove the need for
your tool if there is one.
If you're certain you want this, this is how I think I would do it. It's
an apalling crock:
1. Define 'device driver' - for example, a device driver is anything that
registers a network device with the kernel, or anything that claims a USB
device, or anything that creates a new 'struct pci_driver' or calls
pci_register_driver (see include/linux/pci.h), etc.
2. Parse the .config file corresponding to the current kernel, and take
note of anything compiled in ('=y') or modularised ('=m'). I think RedHat
installs the .config file along with the precompiled kernel binary that
corresponds to it; dunno about other vendors. How you figure out which
.config file to use from where, and whether it matches the currently
running kernel, I dunno.
3. Use /proc/ksyms, objdump --syms /lib/modules/`uname -r`/drivermodule.o,
or even parsing the kernel source, to figure out which of the compiled
bits of kernel from step 2 match your definition of 'device driver' from
step 1. This will probably require all sorts of dodgy guesswork and ad-hoc
special cases, and I bet you still won't find all the things you would
call a 'device driver'. (Ex: what if some naughty driver doesn't call
register_foo, but instead just adds itself to the foo list directly?)
4. Use modinfo/lsmod/etc to get the driver info you want (you know how to
do this apparently).
I'll be pretty surprised if this ever works acceptably...
HTH,
--matt
On Tue, 26 Mar 2002 Shalabh_Sharma at Dell.com wrote:
>
> I am trying to make a tool which tells the user which device drivers are
> installed on his/her system and which of those a currently being
> used/loaded.
> This is possible in windows, I just want to know is there a way to do this
> in Linux ?
>
> -----Original Message-----
> From: mulix [mailto:mulix at actcom.co.il]
> Sent: Monday, March 25, 2002 4:51 PM
> To: linuxcprogramming at lists.linux.org.au
> Subject: Re: [LCP]how to obtain a list of installed device drivers on a
> Li nux box
>
>
> On Mon, Mar 25, 2002 at 04:48:22PM -0600, Shalabh_Sharma at Dell.com wrote:
> >
> > I know that lsmod will give the list of loaded modules, but it also gives
> a
> > list of file systems loaded eg: ext-3, smbfs.
> > I want to know which device drivers are currently installed on the system,
> > and which of those are being used currently minus the file systems.
> > If possible I would also like to get their location, description and
> version
> > info. modinfo gives this to a certain degree, but not for the device
> drivers
> > which are installed but are not currently loaded.
>
> i'm afraid that in the context of linux, your question makes no
> sense. some "device drivers" can be compiled into the kernel, some can
> be modules which are loaded into the kernel, some can be modules which
> are in a non standard location, some can be compiled as the system is
> running and automatically loaded into the kernel, etc, etc.
>
> again, please explain what you're trying to do. you're asking the
> wrong question, and therefore getting the wrong answer.
>
> hope this helps,
> --
> The ill-formed Orange
> Fails to satisfy the eye: http://vipe.technion.ac.il/~mulix/
> Segmentation fault. http://syscalltrack.sf.net/
>
> _______________________________________________
> This is the Linux C Programming List
> : http://lists.linux.org.au/listinfo/linuxcprogramming List
>
> _______________________________________________
> This is the Linux C Programming List
> : http://lists.linux.org.au/listinfo/linuxcprogramming List
>
More information about the linuxCprogramming
mailing list