TechTalk: Drivers in Linux

If you’re used to Windows and Mac systems, you know that device drivers for these systems are often provided by the hardware manufacturer together with the hardware (today more often as a download). From time to time users ask us how they can download get the drivers for our boards. It’s a bit more difficult on Linux.

For most drivers Linux doesn’t have the concept of standalone drivers. Device drivers are an integral part of the Linux kernel. In the very early phase of Linux,  drivers were compiles directly into the operating system kernel. This is a so-called monolithic kernel. When the OS loaded the kernel all drivers were already loaded with the kernel. People tried to optimize the kernel to include only the modules that they really needed. This isn’t necessary today anymore as most drivers are compiles as so-called modules. This means that the system starts with a minimal set of drivers and loads the other drivers later. It should also only load the necessary drivers. With these modules you might think, this is not a monolithic system anymore, but in reality it still is. 

Let’s have a look at the DAC+ ADC Pro driver. You might e.g. find a file named snd-soc-hifiberry-dacplusadcpro.ko  somewhere on your system. Tis is basically the DAC+ ADC Pro driver. However, this file alone is not useful as it requires a lot of other modules that provide other functionalities of the sound subsystem. Another important thing: This file was created together with the Linux kernel. It is not compatible with other Linux kernels. Even copying it to another system with the same kernel version usually won’t work. And using it with the different kernel version is usually also not possible.

What do you do if the distribution of your choice doesn’t have the drivers included? First advice would be to contact the developers of this distribution. The drivers might be there, but some specific configurations might be needed to use them. Alternatively you can compile your own kernel. The best choice for the Raspberry Pi is always the official Raspberry Pi kernel that’s available on Github. It’s not always best to use the latest version – especially if your system does come with a version that’s way older then the current version. For most users we don’t recommend compiling your own kernel. It’s not a trivial task and replacing the kernel might break some functionalities in your system. Never try to replace the kernel without creating a backup first. There’s a good chance that the system might not boot after replacing the kernel.

July 18, 2022

Subscribe to new blog posts