Kernel – Install and Compile in Debian Linux

To get started, we are going to need some packages, namely fakeroot and kernel-package:

root# apt-get install fakeroot kernel-package

Now, lets take a latest source tarball from or you may use following wget command to download it.

root# wget -c

Now, let’s unpack the archive.

root# tar -xvJf linux-3.2.58.tar.xz

After, extracting, a new kernel source directory will be created.

root# cd linux-3.2.58

Now, we will want to configure the kernel. It is best to start with a configuration that you are currently using and work from there. To do this, we will copy the current configuration from the /boot directory to the current working directory and save it as .config.

root# cp /boot/config-3.2.0-4-amd64 ./.config

Now we can configure the kernel:

root# make menuconfig

Once that is done, it is time to clean the source tree.

root# make-kpkg clean

Finally, it’s time to build the kernel package.

root# export CONCURRENCY_LEVEL=3
root# fakeroot make-kpkg --append-to-version "-customkernelname" --revision "1" --initrd kernel_image kernel_headers