Wednesday, 4 May 2011

Linux Custom Kernel Compilation

1. Download the latest kernel from
Example: wget
"tar zxvf linux-2.6.x.tar.gz"
"cd linux-2.6.x"
2. Do an lsmod commad and copy the defalt modules loaded.

"make menuconfig"
3. Select the modules listed from lsmod and make sure those modules are selected in new kernel. Remove all unwanted modules to make the kernel small and custom. Don't remove critical drivers but can remove certain modules that
you are sure not going to be used. Eg: If you are not going to use any wireless device in the server, there is no need to select wirless modules.
4. Make the modules
Modules are parts of the kernel that are loaded on the fly, as they are needed.
"make modules"
5. Install the modules
This will copy all the modules to a new directory, "/lib/modules/<kernelVersion>
"make modules_install"
6. Finalize the installation.
"make install"
*The grub.conf gets updated by the last command. Set the priority of the newly compiled kernel in grub.conf and restart the system to boot in newly compiled kernel.

No comments:

Post a Comment