Search

Compiling linux kernel on debian

Here are the steps to compile a kernel from source in debian based systems.

Note:These steps have worked successfully on debian 6.0 (linux 2.6.32)
You will need a package by the name kernel-package, which implements the commands required for compilation, hence run



1. Download the source of the kernel version to which you want to compile e.g. linux-3.1.5.tar.bz2 or linux-3.1.5.tar.gz for linux kernel version 3.1.5 2. Untar the source using



Now change directory to kernel source



The make-kpkg command which we will use to compile the kernel might some times fail generate the initrd, to make sure the initrd is generated at the end of compilation run the following command.



Create a config file using the command



This will create a default configuration file, to customize it we can either open the .config file using an editor and set the required configuration or use the menuconfig i.e



Note: ncurses-devel package would be required to launch the menuconfig, hence if menuconfig does not launch with the error that ncurses was not found install the package.


A graphics window should launch which will allow you to select the options you need and then create an updated .config file based on your choices.
Now to compile and generate the deb package for the new kernel run the command



If you want the kernel headers too then add the target kernel-headers also to the command. 10. If the compilation in the above step finishes with out any errors, you should have a .deb package, linux-image-3.1.5_3.1.5-10.00.Custom_i386.deb in the folder in which you have placed the source package.
Install the package using



Now if you restart the system, the grub should list out this kernel too in the boot options, on selecting which you will boot into the custom kernel with your system call in it.


We can confirm the kernel version using the command


Follow by Email