Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to see all hardware supported by the kernel in use. For example, if I have the 3.8.x.x version of the Linux kernel, how will I know what hardware is supported there. Tools like lspci, lshw, lscpu and dmidecode only check the hardware that is used at the moment and trying to find this using the loaded modules with lsmod is not handy either.

What I want is something that checks all hardware actually supported by the kernel in use without taking into consideration if I am using that hardware or not.

For the moment I thought of stuff like:

  • Reading the /lib/modules/3.8.0-5-generic/kernel/drivers and parsing every file.
  • Downloading the git source of the kernel and grepping it for information about this.
  • Any other crazy and very long way of doing it.

Is there any other smaller way of achieving this.

share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

What I want is something that checks all hardware actually supported by the kernel in use without taking into consideration if I am using that hardware or not.

If you have the .config file the kernel was built with, you can download the source and run make menuconfig, which will give you an idea of A) what hardware it is possible to configure a kernel for (but see NOTE), and B) what hardware your kernel is actually configured for.

make menuconfig

So to do this:

  1. Download the source. Your distro may have a package, or you can get them from kernel.org; find your version with uname -r.
  2. Find the .config used for your kernel. If you got the source via your distro, it will hopefully be included; you may also be able to find it somewhere in /boot. Even better: often now distro kernels are built with the /proc/config.gz feature. If it exists, copy that out, ungzip it, rename the file .config and copy it into the top level of the kernel source tree.
  3. Run make menuconfig from inside the top level of the source tree. You will need the ncurses development package installed (ncurses-dev or ncurses-devel) and you need to be root.

You can't do anything bad while using menuconfig beyond change the contents of the .config file, which won't matter (just don't confuse yourself with it later).

NOTE: You can't actually see all the possible hardware configurations at the same time, since different options may appear in one place based on what has been selected some other place. Kernel configuration is a bit of a labyrinth. However, you will definitely see everything that is actually selected (M means it is a module, * means it is built in).

share|improve this answer
    
Many thanks for this answer, it sure clear some stuff I had in mind. –  CYREX Feb 10 '13 at 17:36
add comment

I don't believe what you're looking for is possible; assuming a modular kernel, for example, many modules will fail to initialize themselves if they cannot actually find the hardware they support. So they'll quietly abort.

Parsing the kernel sources, automatically, to look for hardware names/versions/model-numbers would be a huge undertaking. Although there are common subsystems (e.g. serial, scsi, usb) the code isn't necessarily uniform. That will become apparent to you pretty quickly.

share|improve this answer
3  
Then there is the problem of defining "all hardware", there are many widgets that look very different (other make, model) but are (essentially) the same inside, and others that have (almost) the same model number while their innards are totally different. And it has happened to me that completely unknown stuff worked out of the box, or after googling around a bit and adding an USB identifier. –  vonbrand Feb 10 '13 at 1:49
add comment

You can call modinfo for all available modules. This prints the aliases of a module. One alias of the module e1000e is this one (among many more):

pci:v00008086d00001559sv*sd*bc*sc*i*

This means it should be loaded for a CPI devices with vendor ID 8086 and device ID 1559. The pattern for USB devices looks similar.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.