Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I needed a newer version of a Kernel module in an quite old kernel.

How can I replace a single kernel module of the mainstream linux kernel and compile only this module?

share|improve this question
up vote 1 down vote accepted

One warning: There is no gurantee, that the new driver version is compatible with the old kernel. But it is worth a try.

  1. Find the newer driver in the kernel. There are two options: You can use the original kernel driver from the kernel git, for example in It is handy to select a tag to find the specific kernel version you need. Download the specific thedriver.h and thedriver.c files and put them into a new directory.

    The second option is to fetch Ubuntu's new kernel from or via apt-get source ...

  2. Install the packages build-essentials and the linux-kernel-headers

  3. Now we create a makefile for this single module as shown on, thedriver.o has to be replaced by the driver name. In the folder which contains the driver code, create a file Makefile with the following content:

    obj-m += thedriver.o
        make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
        make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
  4. Now, in this directory, type make to compile the driver.

  5. If everything works well, a thedriver.ko file should have been created that can be placed into the folder /lib/modules/$kernelversion/kernel/drivers (do not forget to create a backup)

share|improve this answer

Your Answer


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.