Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've recently applied a one-line patch to drivers/bluetooth/btusb.c in order to enable compatibility with my Bluetooth device. However, whenever I get a kernel upgrade, the patch will be lost until someone backports it (which isn't likely). Is there a way for me to run a script and patch each new kernel upgrade automatically?

DKMS seems like a good solution, but I'm not sure how to set things up. I don't want to recompile the entire Linux kernel every time I get an update, but I'd like to apply that patch to the btusb module, recompile it, and insert it into my kernel on every update. How can I do this using the source obtained from apt-get source linux-source-3.2.0? What files do I need to copy over? The critical make call is make M=drivers/bluetooth modules, but this depends on other kernel utilities to be built first. How can I assemble a DKMS module for this?

Details on how to apply the patch can be found here on Ask Ubuntu.

share|improve this question
That depends on the package manager and the packaging that the kernel comes in. What distribution are you running? –  Gilles Dec 11 '12 at 23:54
Running an Ubuntu derivative. –  Naftuli Tzvi Kay Dec 12 '12 at 5:35
Updated the question in order to specify what I'm looking for and what I'm struggling with. –  Naftuli Tzvi Kay Dec 12 '12 at 20:42

1 Answer 1

up vote 3 down vote accepted

Yes, you should package up your changes as a DKMS module. Building modules for several installed kernels or automatically rebuilding them on an updated kernel is the main feature of DKMS.

Ubuntu community documention has a nice article on this topic here.

share|improve this answer
Could you give an example of how to configure DKMS for my specific use case? For example, what files do I need to copy over for my module? How should I configure dkms.conf? –  Naftuli Tzvi Kay Dec 11 '12 at 23:46

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.