Comments on How To Compile A Kernel - The Fedora Way

How To Compile A Kernel - The Fedora Way Each distribution has some specific tools to build a custom kernel from the sources. This article is about compiling a kernel on Fedora systems. It describes how to build a custom kernel using the latest unmodified kernel sources from www.kernel.org (vanilla kernel) so that you are independent from the kernels supplied by your distribution. It also shows how to patch the kernel sources if you need features that are not in there.

8 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By:

What a great article!

I have always wanted to see a site like this. 

I wonder if an extension to this article or a new howto would cover adding nvidia or ati driver rpms.

-- gondarlinux 

 

By:

Thanks for the procedure. I just used it to customize the kernel on Fedora 9 and it worked just fine. Two small changes. To get the kernel source RPM it is easier to use yumdownloader --source kernel . And there is now a command to build the rpmbuild hierarchy in your home directory. rpmdev-setuptree

By:

Please note that the "fedora-rpmdevtools" package has been renamed to "rpmdevtools" (because it is not fedora-specific).

To install it, use "yum -y install rpmdevtools".

The fedora-rpmbuildtree command is thus renamed "rpmdev-setuptree" (a symlink from the old command is provided, but will be removed at some point in the future)

Also, the rpmdev-setuptree command already sets up the whole rpm building tree, and sets up a correct ~/.rpmmacros file. There is no need to copy the directories from /usr/src/redhat or to echo anything in ~/.rpmmacros.

By:

#make menuconfig

...gives me an error!
...
scripts/kconfig/lxdialog/checklist.c:291: error: âKEY_RIGHTâ undeclared (first use in this function)
make[2]: *** [scripts/kconfig/lxdialog/checklist.o] Error 1
make[1]: *** [menuconfig] Error 2
make: *** [menuconfig] Error 2
# yum -C list installed|grep -i curses
ncurses.i386                             5.5-24.20060715        installed     
# yum -C list available|grep -i curses
ncurses-devel.i386                       5.5-24.20060715        core          
perl-Curses.i386                         1.15-1.fc6             extras        
php-ncurses.i386                         5.1.6-3.3.fc6          updates       
# yum install ncurses-devel
Installed: ncurses-devel.i386 0:5.5-24.20060715
Complete!
# make menuconfig

now it works! 

By:

One thing to watch out for: If you patch a single file and do a "make clean" expecting only that file to be recompiled, you will be surprised. It seems to nuke your whole tree, do a 'make clean' and starts over again.

This at least on  2.6.19-1.2911

 

By: Anonymous

Usefull tutorial...

 

Thank you!

By: Marty

Hi,

I have been compiling kernel 4.5.5 for FC22 on several workstations. It does take time, a lot of time to build the modules.. I just want to know how does and what's the difference with recompiling vs DNF update as DNF seems to compile a newer kernel super fast...

By: Sinad Shan

Really good tutorial. Helped me compile a kernel as part of an assignment. Being really new to this, the article helped me a lot.Some things I came across that helped me:

1. You can use <code>make all -j $(nproc)</code> to speed up making, by using all threads available.

2. Ensure that you've disabled secure boot to avoid issues when you're trying to boot into the new kernel.