2. Steps

All steps should be done under your normal user account except the first and last steps which require root access.
  1. Install fedora-rpmdevtools (as root) from Fedora Extras.

    yum install fedora-rpmdevtools
  2. Create Build Directories Run fedora-buildrpmtree as a regular user to create the rpmbuild directory tree in your home directory.

    fedora-buildrpmtree
  3. Get the Source

    Get kernel-XXX.src.rpm from a SRPMS directory of your favorite Fedora mirror.

    [Note] Note

    After Fedora Core 2 kernel-source-XXX.rpm does NOT exist.

  4. Install Source

    (as regular user) Use rpm to install the kernel source code.

    rpm -ihv kernel-XXX.src.rpm
  5. 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
  6. 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
  7. 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`)
  8. 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
  9. 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] Note

    Some of the configuration interfaces require other packages, menuconfig requires ncurses-devel, xconfig requires qt-devel, and gmenu requires gtk2-devel.

  10. (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	
  11. 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
  12. 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] Note

    The option -ba should be used to make a source rpm if the new kernel will be distributed.

  13. 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