Run Script on New Kernel Installation

kernelkernel-modules

I'm currently having to recompile my wireless driver from source every time I get a new kernel release. Thinking it would be awesomely hackerish to automate this process, I symlinked my Bash build script to /etc/kernel/postinst.d. I've verified that it does, in fact, run when the latest kernel update is installed, but one thing is left as a problem: the driver compiles for the existing running version of the kernel.

For example, if I'm running 3.0.0-14-generic and apt-get dist-upgrade to kernel 3.0.0-15-generic, then it compiles for kernel 3.0.0-14-generic, which doesn't really help me at all.

Is there a way to tell from my kernel postinst script which version of the kernel has been installed so I can pass it to my make call so it can be compiled for the newly installed kernel?

Best Answer

This is no actual answer to your question, just a pointer to a tool that might be related and helpful:


Do you have dkms installed? (Some information here, the alioth page seems down at the moment.) It's supposed to do just that, if I'm not misled. It requires the appropriate linux-headers package and the module/firmware/something-like-that package to be installed; and it works for all installed linux-image packages. (I can't say anything about a generic module, but it worked fine when I used it with the non-free nvidia module.)

(There're more links here, like the manpage and this linuxjournal.com article which provides a non-Debian-ecosystem-centric explanation of the program.)

Related Question