Identifiyng PCI and USB hardware for kernel configuration

Generic kernel builders include everything they can. When building kernel for a particular machine it makes sense to include support only for hardware you actually do have. This starts with hardware identification. Most useful here is the hardware ID which can be seen in lspci and lsusb output. The example below is for PCI, but identifying USB devices is not different.

# lspci -knn
...
03:00.0 Network controller [0280]: Intel Corporation Centrino Ultimate-N 6300 [8086:4238] (rev 35)
  Subsystem: Intel Corporation Centrino Ultimate-N 6300 3x3 AGN [8086:1111]
  Kernel driver in use: iwlwifi
  Kernel modules: iwlwifi
...

The PCI ID of this device is [8086:4238], first part 8086 identifies manufacturer, Intel in this case. Second part 4238 is unique, identifying this particular piece of hardware. We can use it to search the Linux Kernel Driver Database. Database has its own search function, but I have found the web search is more convenient. This leads me to IWLWIFI page. Now I know this driver has been in kernel since kernel version 2.60, also it has information about prompt in kernel configuration.

kernel iwlwifi configuration

This driver also needs to load firmware, dmesg shows following:

[ 4.464339] iwlwifi 0000:03:00.0: Direct firmware load for iwlwifi-6000-6.ucode failed with error -2
[ 4.464352] iwlwifi 0000:03:00.0: Direct firmware load for iwlwifi-6000-5.ucode failed with error -2
[ 4.467052] iwlwifi 0000:03:00.0: loaded firmware version 9.221.4.1 build 25532 6000-4.ucode op_mode iwldvm

There is 'error -2' which means "not found". Not a reason for concern, Intel driver is known to look for newest firmware which even may not be available for general public yet. The important part is finally it succeeds.

Loading firmware when driver is built into kernel

In above example the kernel driver was built as a module. Modules reside in the root filesystem, so does the firmware. Module loading takes place after the root filesystem is mounted and accessible. However, if the driver is built into kernel then it is different. At the time when kernel image loads the root filesystem is not accessible yet, thus the firmware cannot be loaded from there. As a result firmware loading fails and the driver in kernel will be not functional.
The solution is to build firmware into kernel image. The menu item is:
Device Drivers --> Generic Driver Options --> Firmware Loader

kernel firmware configuration

Please note, this example is from a different machine, it loads firmware for Intel graphics. You can see firmware directory (/lib/firmware) specified and the blobs in subdirectory (i915).

Back to main page

* © Jaglover 2020 *