The following sequence no longer creates a working “
linux-headers” Debian package when compiling Linux kernels newer than version 2.6.x under Ubuntu (tested here with Ubuntu 11.04 and Linux kernel 3.0):
cd linux-3.0 make-kpkg clean export CONCURRENCY_LEVEL=4 fakeroot make-kpkg --initrd kernel-image kernel-headers
As noted in this Launchpad bug report for the `
kernel-package` package, there is a logic error in the package’s makefile which causes the
LINK_ARCH variable to be set incorrectly during package creation. The effect of this is that the
linux-headers...deb cannot be used to successfully build common third-party kernel modules such as VirtualBox’s networking/virtualization drivers or NVIDIA’s proprietary graphics drivers.
/usr/share/kernel-package/ruleset/targets/headers.mk to either fix the version-check logic, or statically set the
LINK_ARCH variable to “
x86“. It shouldn’t matter which way you use, but since I like being precise, I opted for the fixing the logic.
As of this writing, Ubuntu 11.04 Natty Narwhal’s
headers.mk looks like this:
LINK_ARCH=$(KERNEL_ARCH) ifeq ($(shell if [ $(PATCHLEVEL) -eq 6 ] && [ $(SUBLEVEL) -gt 23 ] ; then \ if [ $(KERNEL_ARCH) = "i386" ] || [ $(KERNEL_ARCH) = "x86_64" ] ; then \ echo "yes" ; fi ; fi ),yes) LINK_ARCH=x86 endif
… modify the test on the second line shown to look like this:
ifeq ($(shell if [ $(VERSION) > 2 ] || [ $(PATCHLEVEL) -eq 6 -a $(SUBLEVEL) -gt 23 ] ; then \
You should now be able to compile Linux kernel and header packages the “Debian” way again. Happy hacking!
Pre-built kernel packages
Alternatively, if you’re too ______ (lazy? stupid? cool?) to build your own, you can use mine. Below you’ll find pre-built packages of the pf-kernel patch set for use on 64-bit hosts (AMD or Intel, as long as it’s 64 bit).
The pf patch set includes mainline “stable” updates, as well as various tweaks to disk IO and CPU scheduling, which should be suitable for laptop/desktop users (and possibly server, depending on your workload).
sudo dpkg -i linux-*3.0.5-pf*.deb sudo reboot
Leave a shout if you’re stuck. Adios!