How to recompile kernel in LInux

Step1: Before compiling the kernel the following packages should be installed in order to compile kernel

a. Glib-devel
b. Gcc
c. Ncurscs-devel
d. Binutils
e. Kernel-sourcecode

Step2: Download the latest kernel from and copy the.tar.bz2 file to /usr/src folder

[root@server~]#cd /usr/src 

Step3: Now unzip the compressed kernel in the same folder it self

[root@server~]#tar xvfj linux-
[root@server~]#cd linux-

Step4: If you have compiled any kernels previously first you have to clear any unwanted entries in source kernel

[root@server~]#make mrproper

Step5: Before recompiling the new kernel we have to take the backup of the old kernel in order to restore it in case you face any issues with the new kernel
[root@server~]#make oldconfig
this backed up kernel configs are stored in /usr/src/kernel/.config

Step6 : So now everything is fine the left part is to compile kernel, to do that we have to execute the following command

[root@server~]# make menuconfig

kernel have so many modules(like process management, memory management, network management, filesystem management, device management) etc, So this command will give a menu kind of list where you can select the different modules.

Linux kernel is Modular kernel, so all the management parts will not be loaded in to kernel at once, The menu will show some check marks.

Type1: Square brackets []If you want the module to be part of kernel select it

For example:

[*] indicates yes
indicates no

And this type of brackets are used to mention wether that option should be a module or built in.

For example :

< > for a feature indicates that feature is not included in the kernel
the feature is inculeded in kernel but it’s a module.
<*>the feature is inculeded in kernel as a built in feature.

So when you execute the above command you will get a menu in this menu select the filesystem->ntfs file system. And save it.

Step7: So now we have to compile this kernel with added features and to create a bzimage file


This step will take more time say some 15 to 30 min depends on the features you have selected

Step8: Once again we have to tell kernel which are reloadable modules by executing the following command

[root@server~]#make modules_install

Step9: Now we have to execute the following command to copy this kernel image to/boot and edit the grub.conf file so that from next boot

[root@server~]#make install



About Manish Jha

Hi All I am Manish Kumar Jha aka Alex Hunt. I am currently working in Iono,Inc as Cloud Solutions Architect. I have around 8 Years of IT experience and have exposure on VMware vSphere, vCloud Director, RHEL and modern data center technologies like Cisco UCS and Cisco Nexus 1000v and NSX. If you find any post informational to you please press like and share it across social media and leave your comments if you want to discuss further on any post. Disclaimer: All the information on this website is published in good faith and for general information purpose only. I don’t make any warranties about the completeness, reliability and accuracy of this information. Any action you take upon the information you find on this blog is strictly at your own risk. The Views and opinions published on this blog are my own and not the opinions of my employer or any of the vendors of the product discussed.
This entry was posted in Linux/CentOS. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s