Custom Kernel on Fedora 20

Posted on Sat 23 August 2014 in Fedora

The last time I built a Linux kernel for my machine was quite a time ago. In my Linux hacking times when I did my private researches on how Linux works and how the software can be built for it, I used Gentoo and there it was normal to build every package from source code, including the kernel. The portage system was a copy of the well known ports package system from FreeBSD. It contains all the metadata for the software packages to be built from scratch with its dependencies. But back to my custom and vanilla kernel on Fedora 20.

Prepare your system

You will need the basic C build environment which can be installed using a package group as root or using sudo:

yum groupinstall 'C Development Tools and Libraries'

Download the kernel sources from

I picked the last stable version which is current 3.16.1 and downloaded the sources to /usr/src/kernels to extract it there.

To extract a .xz compressed tar archive use:

tar xvfJ <archive.tar.xz>

Configure your kernel

I prefer a minimalistic kernel. That why I am building my own kernel. I don't like to have support for hardware in my system which I don't want to use. I don't use bluetooth, isdn, scsi or legacy audio devices in my workstation and so I decided to remove everything I don't need.

Change into the kernel source directory you just extracted and run the kernel menu config tool:

cd /usr/src/kernels/linux-3.16.1
make menuconfig

I don't explain how you have to configure your kernel that it will work for you. This is what you have to learn yourself. Read the options and decide if you need the support for that option. There is a lot of documentation out there how you can configure your kernel. And if you are not sure what hardware you have, you maybe should stay with the generic kernel and explore your system with tools like lsusb, lspci and lsmod.

Build your kernel and install your modules

This is quite easy. To build your kernel just run:


And to install the created modules after your build was successful, run:

make modules_install

Install your kernel to boot and create initrd

Now you need to copy your kernel image to /boot:

cp /usr/src/kernels/linux-3.16.1/arch/x86_64/boot/bzImage /boot/vmlinuz-3.16.1

Create initrd:

mkinitrd /boot/initramfs-3.16.1.img 3.16.1

Regenerate the Grub config to add the new kernel option

grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

Reboot and have fun with your new kernel