Upgrading Kernel Modules
From Freespire
The name of the package that builds the third party kernel modules is "los-kernel-extra-2.6.14". This package does not actually include the source code for the third party modules. The source code is contained in other packages with names such as "fglrx-driver", "ndiswrapper-source", etc. These packages are all build dependencies of the los-kernel-extra-2.6.14 package.
Suppose we wish to upgrade the ndiswrapper modules. The first step would be to create and install a new ndiswrapper-source package. First we make sure our package lists are up to date:
# sudo apt-get update
Next we retrieve the source for the current ndiswrapper-source package:
# apt-get source ndiswrapper-source # cd ndiswrapper-1.3~rc1
This will download and unpack the source package, which consists of either two or three files (two in this case, a .dsc file and a tarball.) The unpacked source is in the directory ndiswrapper-1.3~rc1. We go over to the ndiswrapper web site (which is supposed to be mentioned in the source directory file debian/control) http://ndiswrapper.sourceforge.net and we find and download ndiswrapper-1.21.tar.gz. We put this into the source directory right next to the old source file ndiswrapper-1.3~rc1.tar.gz. Next we need to change the package version number by adding an entry to the top of debian/changelog. Be careful with the formatting of the entry, the requirements are stringent! See section 4.4 of the " Debian Policy Manual.
Now we can build and install a new version of ndiswrapper-source:
# sudo dpkg-buildpackage
Unfortunately, this build fails when it tries to apply some patches to the source code before packing it up. Examining the patches subdirectory, we find a patch cvs-head-20050915.patch which is listed in 00list. This patch appears to be obsolete, so we delete it from 00list and try again. This time the linspire.patch patch fails to apply, but this is a much simpler patch and easy to fix. The reason it doesn't apply is because some of the text surrounding the line to be changed has changed, so we need to reconstruct the change. The unpacked source tree is in debian/modules/ndiswrapper, and the file being patched is Makefile, We can make the change using a text editor and then construct the new patch using the diff command:
# diff -ru debian/modules/ndiswrapper/Makefile~ debian/modules/ndiswrapper/Makefile
--- debian/modules/ndiswrapper/Makefile~ 2006-07-15 10:40:28.000000000 -0700
+++ debian/modules/ndiswrapper/Makefile 2006-07-17 12:18:26.000000000 -0700
@@ -9,7 +9,7 @@
DESTDIR =
mandir = $(DESTDIR)$(shell [ -d /usr/man/man8 ] && echo /usr/man || echo /usr/share/man )
-KVERS ?= $(shell uname -r)
+KVERS ?= $(shell realpath /boot/config | awk -F/boot/config- '{print $$NF}')
.PHONY: all
(Note that this is an important patch, it replaces code which says to build the module for the running kernel with code that says to build the module for the kernel whose source is installed.) If we substitute this output into the linspire.patch file, we find that our build will succeed. Now we can install the source package, and we may as well install the -utils and -drivers packages that the build produced, as they are required to support the kernel modules we are trying to build:
# dpkg-buildpackage # dpkg -i ../ndiswrapper-source_1.21-1_all.deb # dpkg -i ../ndiswrapper-utils_1.21-1_all.deb # dpkg -i ../ndiswrapper-drivers_1.21-1_all.deb
Now we need to build the kernel modules by downloading and building the los-kernel-extra-2.6.14 package:
# cd .. # apt-get source los-kernel-extra-2.6.14 # cd los-kernel-extra-2.6.14-2.6.14.4
It is probably a good idea to edit the changelog here as we did for the ndiswrapper-source package above so we can distinguish the packages we produce from the ones currently installed. After that we go on and attempt to build the package:
# sudo dpkg-buildpackage dpkg-buildpackage: source package is los-kernel-extra-2.6.14 dpkg-buildpackage: source version is 2.6.14.4-1.0.0.50.linspire1.11 dpkg-buildpackage: source changed by Autobuilder <autobuilder@linspireinc.com> dpkg-buildpackage: host architecture i386 dpkg-checkbuilddeps: Unmet build dependencies: sharutils los-kernel-link-2.6.14 los-kernel-default-config-2.6.14 acx100-source adm8211-source affix-source ageremodem-source atmelwlandriver-source (>= 3.4.1.0-0.0.1.50.linspire0.2) bcm5700-source cloop-src drm-source fglrx-kernel-src hcfpcimodem-source hsfmodem-source (>= 7.18.00.06full-0.0.0.50.linspire0.4) intel536ep-source intel537ep-source ivtv-source kqemu-source linux-wlan-ng-source ltmodem-source madwifi-source ndiswrapper-source nvidia-driver-source pcmcia-source pctel-source realtime-lsm-source rt2500-source rt2570-source sis18x-source slmdm-source (>= 2.9.10-13Apr2005-2.0.0.50.linspire0.7) spca5xx-source unionfs-source dpkg-buildpackage: Build dependencies/conflicts unsatisfied; aborting. dpkg-buildpackage: (Use -d flag to override.)
This message about "Unmet build dependencies" means there are packages we need to install in order for the build to succeed. Use apt-get to install the packages:
# sudo apt-get install sharutils los-kernel-link-2.6.14 los-kernel-default-config-2.6.14 acx100-source adm8211-source affix-source ageremodem-source atmelwlandriver-source bcm5700-source cloop-src drm-source fglrx-kernel-src hcfpcimodem-source hsfmodem-source intel536ep-source intel537ep-source ivtv-source kqemu-source linux-wlan-ng-source ltmodem-source madwifi-source ndiswrapper-source nvidia-driver-source pcmcia-source pctel-source realtime-lsm-source rt2500-source rt2570-source sis18x-source slmdm-source spca5xx-source unionfs-source # sudo dpkg-buildpackage
With luck this build will succeed. In this particular case it did. However, it is not unusual for the newest version of the module source to be incompatible with an older version of the kernel source. In this case you may be able to patch the source so it builds again, or you may be able to build a kernel (see below) new enough for the module build to succeed.
Finally, be sure to install *all* the packages produced by the build so that your version numbers don't get out of sync:
# sudo dpkg -i ../los-kernel-extra-2.6.14_2.6.14.4-1.0.0.50.linspire1.11_i386.deb # sudo dpkg -i ../drm-modules-2.6.14_2.6.14.4-1.0.0.50.linspire1.11_i386.deb # sudo dpkg -i ../ivtv-modules-2.6.14_2.6.14.4-1.0.0.50.linspire1.11_i386.deb
Don't Forget!
We, the maintainers of the standard Freespire kernel, would like to know about changes you make to the kernel. Our goal is to ship a kernel that is all things to all users. If you have to build one, we have not met our goal. Please let us know:
- what you changed,
- why you changed it,
- how you changed it,
- how it helped.
- anything else that seems important

