Recompiling a RHEL 5 / CentOS 5 kernel
--------------------------------------

 - Look up the version of the installed kernel, e.g. through the
following command:
    uname -r

 - Choose a RHEL / CentOS mirror

 - Download the source RPM matching the installed kernel version, e.g.
kernel-2.6.18-92.1.22.el5.src.rpm

 - Now generate a kernel source tree from this source RPM by running
the following commands as root:

    useradd mockbuild
    rpm -i kernel-2.6.18-92.1.22.el5.src.rpm

The above commands will create a kernel spec file
/usr/src/redhat/SPECS/kernel-2.6.spec and will create the files for
building the kernel source tree in /usr/src/redhat/SOURCES/.

 - The kernel source tree can now be built by running the commands
below. These commands will not only create a kernel source tree but will
also install a kernel .config file:

    yum install unifdef
    rm -rf /usr/src/redhat/BUILD
    mkdir -p /usr/src/redhat/BUILD
    chown mockbuild /usr/src/redhat/BUILD
    sudo -u mockbuild rpmbuild -bp /usr/src/redhat/SPECS/kernel-2.6.spec

 - Next, apply the SCST patches to this kernel source tree:

    cd "/usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.$(uname -m)"
    patch -p1 <${SCST_SOURCE_DIR}/scst/kernel/rhel/scst_exec_req_fifo-rhel5.patch
    patch -p1 <${SCST_SOURCE_DIR}/iscsi-scst/kernel/patches/rhel/put_page_callback-rhel5.patch

 - Modify EXTRAVERSION in Makefile from "-prep" into "-scst". The text
assigned to the EXTRAVERSION variable will be appended to the kernel
version 2.6.18 and will appear a.o. in the GRUB boot menu. Choosing a
name that refers to the SCST project will help to recognize the
customized kernel.

 - If you are familiar with kernel configuration, you can decrease
kernel compilation time significantly by minimizing the kernel
configuration as follows:

    yum install qt-devel
    lsmod
    make xconfig &

 - Now compile and install the kernel:

    make && make modules
    mkdir -p /lib/modules/2.6.18-scst && make modules_install && make install

 - Edit the bootloader menu such that the newly compiled kernel is
loaded by default:

    vi /boot/grub/menu.lst

- Boot into the new kernel:

    reboot
