How to compile the Linux kernel on Debian?
Debian and other Linux distributions come with their Preset generic kernel that includes support for a large number of hardware components. Generally, the vast majority of drivers involved in a generic kernel you do not need, and only unnecessarily takes up the available resources.
Compiling a kernel, you can optimize and customize the same to its hardware components, and thus get a more responsive system, better use of memory and processor resources, and provide support for hardware that is not available in generic kernel.
In this tutorial I will explain how to compile the Linux kernel on Debian, using the unmodified kernel source with http://www.kernel.org/
Before you engage in the process of compiling, you need to install on your system, the necessary tools to compile. Open Terminal and run the following command:
# apt-get install kernel-package libncurses5-dev fakeroot wget bzip2 build-essential libqt3-mt-dev
Then, with http://kernel.org/
download the latest stable version of Linux kernel (the current stable version is 3.2.7):
# cd / tmp Unzip
# wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.2.7.tar.bz2
the downloaded tar.bz2 archive in /usr/src directory:
# tar-xvjf linux-3.2.7.tar.bz2-C /usr/src Switch
to /usr/src/linux-3.2.7 directory:
# cd /usr/src/linux-3.2.7
Then, please copy the old kernel configuration file, which will significantly facilitate the new configuration:
# cp /boot/config-`uname-r`./.config
You're ready for the configuration of the kernel. For this purpose you can use any of the following tools: menuconfig , xconfig (Qt) and gconfig (GTK). In this tutorial we will use xconfig because of the simplicity of using this tool. Start:
# make xconfig
After running make xconfig command, open a window with lots of configuration options. What is important, in the General Setup menu, locate and turn on the Optimize for size option. Also run the key combination Ctrl + F in the window that opens, type in the search kernel debug and click on Search. Excluding kernel debug options will significantly reduce the size of the kernel.
When finished with the settings, click the Save icon and exit the window application.
Then, run the command:
# make-kpkg clean
Then start compiling a new kernel by running the command:
# fakeroot make-kpkg - initrd - append-to-version =-custom kernel_image kernel_headers
Instead of custom
you can put any word that you will identify the new kernel, but the same must begin with ( - )
sign, for *kernel-dualcore*
After completing the compile, in your /usr/src directory are created two. Deb package linux-image
.You can install them easily by double-clicking or using the command dpkg
# cd ..
# dpkg -i linux-image-3.2.7-custom_3.2.7-custom-10.00.Custom_amd64.deb
# dpkg -i linux-headers-3.2.7-custom_3.2.7-custom-10.00.Custom_amd64.deb
Note : Depending on your architecture it will be either *i386
packages you can install on other Debian systems, without having to compile them again.
Finally, reboot the system:
If you have any problems with the new kernel, choose from Grub menu your old generic kernel.