Debian-Kernel-Compile-Howto  

<< HOWTO-Index

  NEW! Visit my Linux forums!

  This Howto is also available on HowtoForge! If you have also written tutorials, you can publish them there.

Subscribe to FalkoTimme.com Newsletter
and stay informed about my latest HOWTOs and projects.
Email
(If you want to unsubscribe from our newsletter, visit this link.)

Debian-Kernel-Compile-Howto (Kernel 2.4)

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 12/06/2003

In some cases you might want to compile your own kernel that suits your needs better than the standard kernel that comes with your distribution. I will describe how to do this on a Debian machine.

Be aware that there is some risk in doing so! For example, it could happen that your machine does not boot properly after you have installed the new kernel so you might be forced to boot from a rescue CD to repair your system. You have been warned! This document comes without warranty of any kind!

 

Kernel-Compile-Howto

First login to your Debian machine on the command line as root. Install the prerequisites that we need to compile the new kernel:

apt-get install kernel-package ncurses-dev fakeroot wget bzip2

Then go to /usr/src:

cd /usr/src

Then get the latest Linux kernel source (or the kernel source you need) from http://www.kernel.org/pub/linux/kernel/v2.4/:

wget http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.23.tar.bz2

Unpack the kernel sources:

tar xjf linux-2.4.23.tar.bz2

cd linux-2.4.23/

It is normally a good idea to take the configuration of your existing (working!) kernel as a starting point for the configuration of your new kernel. Usually the current kernel configuration is saved in a file under /boot, e.g. /boot/config-2.4.18-bf2.4. We will load this configuration and then do the changes we desire (e.g. add quota support, iptables support, etc.).

make menuconfig

Select Load an Alternate Configuration File and enter the location of the configuration file of your current kernel:

The configuration of your current kernel will be loaded, and you can now browse through the menu and change the configuration to suit your needs. When you are finished, save your new kernel configuration:

Then run the following commands:

make dep
make-kpkg clean
fakeroot make-kpkg --revision=custom.1.0 kernel_image

If the compilation stops with an error, run

make clean

and then re-run the previous commands starting with

make menuconfig

Change the kernel configuration where the error occurs (e.g., the compilation often gives back errors for some WAN modules, so leave them out if you do not need them). If no error occurs you will find the new kernel as a Debian package called kernel-image-2.4.23_custom.1.0_i386.deb under /usr/src.

cd ../

Now you can install the new kernel by doing the following:

dpkg -i kernel-image-2.4.23_custom.1.0_i386.deb

We are almost finished now. Run

lilo

to update your boot loader and reboot your machine:

shutdown -r now

and if everything is ok your machine should come up with the new kernel. You can run

uname -a

to verify that. Good luck!

  NEW! Visit my Linux forums!

  This Howto is also available on HowtoForge! If you have also written tutorials, you can publish them there.

If you find this page useful you can acknowledge your gratitude by making a donation (through PayPal):

<< HOWTO-Index

 
Copyright 2014, Falko Timme. All rights reserved.
     Home  |  News  |  HOWTOs  |  Projects  |  Forums  |  Support  |  About Me   |  Contact Information  |  Site Map