DEV Community


Posted on • Updated on

Compiling Upstream Kernel Fedora


I have been using Linux as my main OS for a long time now. I have always wanted to contribute to the Linux Kernel, but the task has always seemed daunting. But a few days ago, I found out about the Linux Kernel Mentorship Program and decided that this might be the best way I can get started with Linux Kernel Development.
There is a prerequisite course A Beginner’s Guide to Linux Kernel Development that needs to be completed before applying. It is written for Ubuntu, and I had to do some additional things to make it work for Fedora, so I decided to write and document it.

Install Dependencies

I use toolbox. So I will be building the kernel inside the container. Thus these dependencies need to be installed inside the container.

sudo dnf install ncurses-devel pesign bison flex qt5-qtbase-devel libXi-devel gcc gcc-c++ lld elfutils-libelf-devel openssl-devel dwarves
Enter fullscreen mode Exit fullscreen mode

Copy Current Config

I just used the current kernel config instead of starting from scratch.

cp /boot/config-uname -r* .config
make oldconfig
Enter fullscreen mode Exit fullscreen mode

You might need to select some new features that have been added in the kernel recently, but the default values are fine for the most part.


Run the following:

make bzImage
make modules
Enter fullscreen mode Exit fullscreen mode


We now switch back to the system terminal. Then run the following commands:

make modules_install
make install
Enter fullscreen mode Exit fullscreen mode

The new kernel should automatically show up in Grub now.

Additional Resources

Fedora Wiki

Discussion (0)