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
resulting 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.
The fix
Edit /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).
- linux-image-3.0.5-pf_3.0.5-pf-10.00.Custom_amd64.deb
- linux-headers-3.0.5-pf_3.0.5-pf-10.00.Custom_amd64.deb
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).
Install…
sudo dpkg -i linux-*3.0.5-pf*.deb
sudo reboot
Leave a shout if you’re stuck. Adios!
Man,
I owe you chicken at KFC or wherever you want it for this.
Thanks Alan.
Back to code..
w00t! Zinger burger at KFC accepted 😉
Noted. This Saturday?
Update:
This bug still persists in Ubuntu 12.04 and in the 12.10 alpha builds.
The entries in both *mk. files (for Ubuntu 12.04 and Ubuntu 12.10) after corrections should read:
LINK_ARCH=$(KERNEL_ARCH)
ifeq ($(shell if [ $(VERSION) > 2 ] || [ $(PATCHLEVEL) -eq 6 -a $(SUBLEVEL) -gt 23 ] ; then \
if [ $(KERNEL_ARCH) = “i386” ] || [ $(KERNEL_ARCH) = “x86_64” ] ; then \
echo “yes” ; fi ; fi ),yes)
LINK_ARCH=x86
endif
INSTALL_HDR_PATH=$(SRCDIR)
Adios.