Today it happened again. So I think to myself "There must be a better way." It turns out there is: It is called DKMS, the "Dynamic Kernel Module Support". Essentially it works by registering the module for rebuild whenever the kernel is upgraded.
Here's what I did:
- Copy the source code to /usr/src/r8168-8.023.00 - the directory name must be MODULE-VERSION
- Create a dkms.conf:
PACKAGE_NAME="r8168" PACKAGE_VERSION="8.023.00" AUTOINSTALL="yes" MAKE="'make' modules" BUILT_MODULE_NAME="r8168" BUILT_MODULE_LOCATION="src" DEST_MODULE_LOCATION="/kernel/drivers/net"
- Tell DKMS about the module: sudo dkms add -m r8168 -v 8.023.00
- Build it: sudo dkms build -m r8168 -v 8.023.00
- And finally install it: sudo dkms install -m r8168 -v 8.023.00
- At this point, you can use DKMS to build a deb package if you wish. In any case, further kernel upgrades will magically build and install the module.
Oh THANK YOU, man! I was aware that DKMS is able to solve these "break things after kernel update" easily, but I was always missing such a short guide on how to setup and register a new DKMS module.
On Ubuntu 11.10 (oneiric) I needed to quote the "make" word additionally with in your dkms conf: There is a bug in dkms which silently adds a KERNELRELEASE parameter thus breaking the dkms build.
In this case dkms build reports:
make KERNELRELEASE=3.0.0-16-generic modules....(bad exit status: 2)
In this case change the dkms.conf. The changed line should read as follows:
Refer to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=553625
Again many thanks!
Well, dang! That would explain why my DKMS build didn't work last time. :) I've updated the post; thanks for the the tip!
Post a Comment