Linux – How to list all hardware supported by kernel

drivershardwarekernellinux

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.

Best Answer

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).

Related Question