I am experimenting with flashcache on my Ubuntu and it looks interesting enough to do a long term test with it. I downloaded the sources, compiled them and installed the resulting kernel module. So far so good.

But once I update my Operating System and a new kernel is installed, the module needs to be recompiled for the new kernel and installed in a different path.

I am sure this can be done automatically, but I don't know how. Whenever I update the kernel on my system, serveral modules are automatically compiled (amongst others the virualbox modules).

How can I automatically recompile a manually installed kernel module upon upgrading my kernel package? I basically need some hook that does the make and make install stages for flashcache during an apt-get upgrade.

  • 2
    The ones that are automatically built are probably using dkms. You can add your own modules to it (or possibly Debian's flashcache-dkms package will work on Ubuntu, or will be imported into universe soon enough—or at least will show you how to add it) – derobert Nov 14 '12 at 19:22
  • Yes I just found some dkms docs too, which I'm studying right now. Initially I thought it was about installing a module in initramfs, but it seems to be more than just that. – jippie Nov 14 '12 at 19:24
  • If you figure out the steps to add it to DKMS (and there is a README-DKMS in the flashcache repo that may help), please feel encouraged to answer your own question here. – derobert Nov 14 '12 at 19:26
  • For this particular case I needed to change the supplied Makefile.dkms file because I downloaded the zip and not the full GIT repository as follows: COMMIT_REV := 2.0.0. Just guessing about the 2.0.0, but it can't be all too wrong because the zip file has a v2 extension. Then run the makefile: make -f Makefile.dkms. The Makefile.dkms isn't too hard to read, but requires quite a few man pages to be studied. – jippie Nov 14 '12 at 20:05
  • As a side effect I start to understand Makefiles a bit better too ;o) – jippie Nov 14 '12 at 20:08

The "usual" way is to use DKMS (initially developed by Dell to support specific drivers for their servers under Linux). Even nVidia has now an integration of their graphic-card-driver with DKMS - that driver needs to be recompiled with every kernel-update, too.


If you do a

$ make help

in the kernel source directory, you will see among others

Kernel packaging:
deb-pkg - Build the kernel as a deb package

make deb-pkg builds several kernel related packages:

  • linux-firmware-image_*.deb
  • linux-headers-*.deb
  • linux-image-*.deb
  • linux-libc-dev_*.deb

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.