Install fedora-rpmdevtools (as root) from Fedora Extras.
yum install fedora-rpmdevtools
Create Build Directories Run fedora-buildrpmtree as a
regular user to create
the rpmbuild directory tree in your home
directory.
fedora-buildrpmtree
Get the Source
Get kernel-XXX.src.rpm from a SRPMS directory of your favorite Fedora mirror.
![]() |
Note |
|---|---|
|
After Fedora Core 2 kernel-source-XXX.rpm does NOT exist. |
|
Install Source
(as regular user) Use rpm to install the kernel source code.
rpm -ihv kernel-XXX.src.rpm
Disable SMP Build (Optional)
If a multi-processor kernel is not needed , edit ~/rpmbuild/SPECS/kernel-XXX.spec
to disable the smp build.
%define buildsmp 0
Disable Xen Build (Optional)
If Xen virtualization functionality is not needed, edit ~/rpmbuild/SPECS/kernel-XXX.spec
to disable the Xen
build.
%define includexen 0
Customize Release name (Optional)
Edit ~/rpmbuild/SPECS/kernel-XXX.spec to customize the
release name of the kernel you are building. By default, the "%define rhbsys" macro will add
your
username to the end of the release name.
%define rhbsys %([ -r /etc/beehive-root -o -n "%{?__beehive_build}" ] && echo || echo .`whoami`)
Prepare Build
Use the rpmbuild prep stage to apply any patches and configure the kernel exactly as it is in the Fedora distribution.
rpmbuild -bp --target=ARCH ~/rpmbuild/SPECS/kernel-XXX.spec
Reconfigure the kernel
Use one of the kernel configuration interfaces (menuconfig, xconfig, etc.) to make changes to the kernel configuration.
cd ~/rpmbuild/BUILD/kernel-XXX/linux-XXX/
make menuconfig
![]() |
Note |
|---|---|
|
Some of the configuration interfaces require other packages, menuconfig requires ncurses-devel, xconfig requires qt-devel, and gmenu requires gtk2-devel. |
|
(x86 architectures) Edit the .config file
The first line of .config needs "i386" on the first line. Edit the file to make sure it looks like this.
# i386
Copy .config file and Return to home directory
The entire source tree,
including .config, will be overwritten
before the actual build, so copy .config to
the SOURCES directory replacing the original configuration for your
architecture. Return to home directory because the directory you are in
will be automatically deleted and created again in the next step.
cp .config ~/rpmbuild/SOURCES/kernel-XXX-ARCH.config
cd
Build The Kernel
The -bb option to rpmbuild will build the kernel binary package performing every rpm build stage along the way but with the new configuration.
rpmbuild -bb --target=ARCH ~/rpmbuild/SPECS/kernel-XXX.spec
![]() |
Note |
|---|---|
|
The option -ba should be used to make a source rpm if the new kernel will be distributed. |
|
Install the Kernel RPM
(as root) Install the kernel rpm (and kernel-devel rpm if needed). Do not upgrade or otherwise replace a working kernel.rpm -ivh ~/rpmbuild/RPMS/ARCH/kernel-2.6.XXX.NAME.rpm
rpm -ivh ~/rpmbuild/RPMS/ARCH/kernel-devel-2.6.XXX.NAME.rpm