Kernel Compile on Fedora 16

This is basically my specific case, so this is the official guide you may need: building a custom kernel.

I will just write down the list of command in a minimal way to use it later. Maybe some people like to follow this command list and see what is going on.

1. You need tools for kernel compilation.

su -c 'yum install rpmdevtools yum-utils qt3-devel libXi-devel'

2. Create a box to contain the latest kernel source. Run this in your home directory.


3. Download the kernel source.

yumdownloader --source kernel

4. Install build dependencies.

su -c 'yum-builddep kernel-0.0.0-0.fc00.src.rpm'

5. Install kernel rpm

rpm -Uvh kernel-0.0.0-0.fc00.src.rpm

Now you are going to see hundred lines of warning message, but just ignore them.
6. Now expand all the kernels files, the files you may edit and generate a patch from.

cd ~/rpmbuild/SPECS
rpmbuild -bp --target=$(uname -m) kernel.spec

If you need to apply a specific path or modify the options the kernel is configured with, check the official guide.

7. Before compilation, you need to edit the kernel.spec file. In that file specify your own buildid, such as ‘mykernel-01’

emacs -nw ~/rpmbuild/SPECS/kernel.spec

change this line

   #% define buildid .local


   %define buildid .mykernel-01

8. Now this is the main part: compilation

rpmbuild -bb --with baseonly --with firmware --without debuginfo \
--target=`uname -m` kernel.spec

This will take about 30 minutes or more.

9. When the compilation is done, the next thing is to apply the new kernel on your system.

su -c "rpm -ivh $HOME/rpmbuild/RPMS//kernel-..rpm \
       $HOME/rpmbuild/RPMS//kernel-firmware-..rpm \
       $HOME/rpmbuild/RPMS//kernel-headers-..rpm \

10. After reboot, check your system’s kernel version: “uname -a”

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s