Compiling Fedora 16/17/18/19 Kernel

Here in this post, I will explain how to compile and install Linux Kernel for any version of fedora 16 and upwards from Vanilla source available from

To compile Linux Kernel the following are required to be installed:

  • gcc latest version,
  • ncurses development package
  • and system packages should be up-to date

To install the dependencies run the following commands:

For gcc

$ sudo yum install gcc

For ncurses development package

$ sudo yum install ncurses-devel

After installing the above

$ sudo yum update

Next download the linux kernel version you want to compile from: In this howto, I used 3.1.1 and ran the command:


Once the download is complete move to the directory where you have downloaded the kernel package “linux-3.1.1.tar.gz“.

Now extract the tar file to the location “/usr/src/“. To extract the tar file run the following command.

sudo tar -xvf linux-3.1.1.tar.gz -C /usr/src/

Now move to the directory where the extracted file is, or copy and paste the below command in terminal.  

To use a default configuration file from the previous installed Kernel - you may copy the one from /boot/ - For example, config-3.11.6-201.fc19.x86_64 and copy it into your directory with the name .config

To Configure

sudo make menuconfig

The above command is used to configure the Linux kernel. Once you execute the command, you will get a pop up window with the list of menus and you can select the items for the new configuration. If your unfamiliar with the configuration just check for the file systems menu and check whether ext4 is chosen or not, if not select it and save the configuration. 

Now run the following:

sudo make
sudo make modules
sudo make install
sudo make modules_install install

Now reboot and choose the kernel version you just installed.  Note that if it is not first in the list, and perhaps it is the second option then you can run the following commands:

sudo grub2-set-default 2
sudo grub2-editenv list
sudo grub2-mkconfig -o /boot/grub2/grub.cfg

To remove your custom kernel, as sudo or root (provided it is not the kernel you are using); remove the following for your kernel:

sudo rm -rf /lib/modules/3.12.0custom/
sudo rm -rf /boot/initramfs-3.12.0custom.img
sudo rm -rf /boot/
sudo rm -rf /boot/vmlinuz-3.12.0custom

If you receive and error when bootinf about not being able to sync fs root or a kernel image is not installed - please try running the make install commands again... PLEASE.

Blog tags: 



Thank you so much! Very helpful.

Uncompressed Kernel

How can i create an uncompressed kernel image? And i dont want to install it in my machine, its for another board with an atom processor.
admin's picture

Good question

I have only done this for embedded platforms - is this for a resource limited board? If so, I'm not sure that using Fedora is the correct choice. Do you have any more information for me that you wish to divulge?

very helpful

thank you very much


Hi, After you compiled your kernel, do you know how to enable Virtualbox support? Since it's related with DKMS,vboxdrv and stuffs. Still cannot find the solution. Thanks
admin's picture

Virtualization support is

Virtualization support is usually included in the default options. You may have to enable a sysconfig switch, but I don't think you have to for this.

Invalif format error when installing module

I download kernel 3.6.11 for Fedora 17, compile and install the modules according to your instructions. When I tried to install a module with insmod, the command came back with error. "Module cant be inserted, invalid module format...". The module is found by insmod, but not in the right format insmod expects, I guess. Do you know what may have happen? and how to correct this situation? Thanks,
admin's picture

Well, one of the reasons you

Well, one of the reasons you can get that message is that you had something remaining from a previous build or its a bug. Which module is it you were trying to compile and build? I'm on Fedora 18 now, so unfortunately I don't have the same build environment, but I can build this kernel.

It's stupid. You need to make

It's stupid. You need to make rpm in fedora. Forget "make && make install", it's bad tips.
admin's picture

This was for older versions

This was for older versions of Fedora and no you didn't need to make an RPM for them...

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <python> <c>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.