Wednesday, January 5, 2005

Debian Way to Patch and Add Modules to the Kernel

There have been articles before about patching the kernel but I am going to merge two articles into one easiest way for me to modify my kernel under Woody. I will be borrowing heavily from http://myrddin.org and http://pptpclient.sourceforge.net. Together these two sites have given me an easy way to patch and install new compiled modules into my kernel.

If I find out that there is an even easier way, I will make changes to this page.

INSTALLING A KERNEL PATCH
First, get the source code (root is necessary for most of these steps, If you are installing something unknown like a non-Debian patch or module, you should copy the source code to a user directory and perform the rest of the steps there as a normal user account.)
# apt-get install kernel-source-2.6.6 #or whatever Debian source you want
# apt-get kernel-package debhelper dpkg-dev
# apt-get install libncurses5-dev #usually unecessary if you use the oldconfig option
# cd /usr/src
# tar -jxvf kernel-source-2.6.6.tar.bz2


Second, copy Debian's stock kernel config file
# cp /boot/config-`uname -r` /usr/src/linux/.config

(If this doesn't work, it just means that you do not have the stock kernel image installed. You can just use the closest kernel config available.)

Third step, here is where I differ from myrddin.org by using pptpclient.sf.net
# cd /usr/src/kernel-source-2.6.8
# export PATCH_THE_KERNEL=YES
# make-kpkg --added-patches mppe --append-to-version -1-686-mppe \ #This follows Debian's naming standard with a description at the end for easy grub identification
--config oldconfig --initrd kernel_image module_image #module_image and kernel_image don't both hav to be there

Now comes the long compile. You will be asked about any questions that the /usr/src/kernel-source-`uname -r`/.config file and the current version of the kernel.

For example,
PPP MPPE compression (encryption) (PPP_MPPE) [N/m/?] (NEW) m


Last step install the kernel and module packages you created
# dpkg -i /usr/src/kernel-image-2.6.6-1-686-mppe_10.00.Custom_i386.deb

No comments:

Post a Comment