This is a guide on how to build the Linux Kernel with make-kpkg.
Install the Required Packages
To download and compile the Linux Kernel source we will need the following packages:
- build-essential - Essential packages required for compiling.
- linux-source - The Linux Kernel Source
- kernel-package - Provides make-kpkg which we will use to build a Debian Kernel package.
- libncurses5-dev - Development files for ncurses5. This alows for a curses based menu driven configuration.
To install these packages run the following command as root:
apt-get install build-essential linux-source kernel-package libncurses5-dev
As root, using the editor of your choice open /etc/kernel-pkg.conf, in this example we will be using emacs.
emacs -nw /etc/kernel-pkg.conf
Navigate to this section of the configuration file:
# The maintainer information. maintainer := Unknown Kernel Package Maintainer email := firstname.lastname@example.org
Update the maintainer and email fields, then save and quit.
Extracting the Kernel Source
As root, change directories to /usr/src:
Here you will find a file looking like linux-source-x.x.tar.bz2. Please note that x.x will match the current Linux Kernel source for your release of Debian. In this example we will be using the 3.2 Kernel under Sid.
Extract the Kernel Source with the following command (NOTE: You will need to change 3.2 to match the .tar.bz2 file in /usr/src):
tar xjvf linux-source-3.2.tar.bz2
Configuring the Kernel
Change directories to the newly extracted linux source (again, match 3.2 to your version):
Create a defconfig with the following command, please change ARCH=i386 to match your target architecture:
make ARCH=i386 defconfig
Building the Debian Package
Use make-kpkg to build the kernel: