FC3 – Building a Custom Kernel

A Simplified Approach

Some preliminaries; I have created an rpm build user “rpmbuild.” The reason for creating a specific user is that some people need to create the home directory someplace other than /home where there is more disk space. Compiling a kernel may require close to 1gb of space.

In rpmbuild’s home directory, I have created the file  .rpmmacros with the following lines.

%_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
%_topdir %(echo “$HOME”)    #Use rpmbuild’s home directory rather than /usr/src/redhat

Now you need to create the build directories. Note that the directory names are all caps:


The current, available. FC3 source-code (currently kernel-2.6.10-1.760_FC3.src.rpm) is the source code necessary for building an installable kernel RPM. The simple objective is to create kernel-sourcecode-2.6.10-1.760_FC3.rpmbuild.i686.rpm. This, in turn, will create a kernel source tree when installed.

Download kernel-2.6.10-1.760_FC3.src.rpm from your favorite FC3 mirror. It is in updates/3/SRPM.

Install with rpm -ivh kernel-2.6.10-1.760_FC3.src.rpm

Open ~/SPECS/kernel-2.6.spec in your text editor of choice. Edit the first few lines of the file so that it looks like the example below. Save the file.

From ~/SPECS type the following command:

“rpmbuild –target i686 -bb kernel*.spec”

Fedora Core 3 accepts two kernel architectures; i686 and i586. If you omit the target architecture the build will fail because it will default to i386. Since this is going to be source code, the architecture is irrelevant.

Your new kernel source code (kernel-sourcecode-2.6.10-1.760_FC3.rpmbuild.i686.rpm) will be located in ~/RPMS. Install as su with “rpm -ivh kernel-sourcecode-2.6.10-1.760_FC3.rpmbuild.i686.rpm.”

You can safely delete the contents of of ~/BUILD ~/SPECS and ~/SOURCES.

To configure and install the custom kernel is quite simple:

rpm -ivh kernel* Installs the source tree to /usr/src. Note the “i” option. “U” may overwrite an existing FC3 kernel.
make mrproper A precautionary deep clean. Use “make clean” between builds to retain the configuration.
make menuconfig Select your options. While you are at it, remove the bloat of things that you are certain you do not need.
make all Compiles the new kernel after you save your configuration.
make modules_install Installs modules to /lib/modules/kernel-name
make install Installs the image to /boot and updates grub.conf
make clean Not required but safe to do if disk space is an issue.

You May Also Like

Leafnode Local News Server

Linux Diversions

RBLDNSD Blocklist for Postfix