Linux – Why modify the linux kernel instead of creating a kernel module

driverskernelkernel-moduleslinux

I have a development board which has an older version of Linux installed on it. The vendor supplies an image for the device with a heavily modified linux kernel, some loadable kernel modules, and some example software.

I would like to install a newer version of the linux kernel on the device, but the vendor has no support for this, as their modified linux kernel is based off of an older kernel version.

What I don't understand, is why start hacking away at the linux kernel, when you can make the kernel compatible with the device it is running on by writing drivers as kernel modules. It could be easily recompiled for any kernel version without problems. This way, if the vendor only supports a certain kernel version, you are "stuck" 🙁

But there must be some reason I am missing, because I see many projects use this approach of grabbing some version of the kernel, and heavily modifying it to fit their board. What I would be interested in, is:

  1. Why modify the linux kernel instead of creating a kernel module?
  2. What can be done if I need to run a newer kernel, but I get no support from the vendor (Device drivers should work on newer versions of the kernel…)

Best Answer

This question has a lot of assumptions in it.

Here are some reasons.

The kernel interface is not stable so a module for one version may not compile for a different version.

The kernel may not expose a required facility.

The kernel may expose a required facility but not in a way that is acceptable, for example requiring the module to have a particular license.

The people writing the code found it quicker to write the code this way.

As to your options if you need a newer kernel.

  1. find someone else who has already ported the code
  2. port it yourself
  3. pay someone else to port it (may not need money, beer, flattery and curiosity may work).
Related Question