Building RPM Kernel Packages

Extract and customize the kernel

1. Log in as root, extract the kernel sources:

tar jxf linux-.tar.bz2 -C /usr/src

2. Customize the kernel with make menuconfig, make xconfig, etc… Create two copies of the .config file and save them in /usr/src/linux<version>-:

.config: this copy has to provide the configuration for the single processor kernel
.config_smp: this copy has to provide the configuration the dual processor (SMP) kernel

3. Copy the linux<version>-.tar.bz2 you downloaded in /usr/src/redhat/SOURCES/

4. Copy my_kernel.spec in /usr/src/redhat/SPECS/

5. Customize the fields Version, Release, description and kernel24 definition in my_kernel.spec. Please note that:

Version has to be the kernel version (e.g. “2.4.33”)
Release should be customized (e.g. “xeon_1.0”). Release will be used for the “EXTRAVERSION” variable in the main kernel Makefile, so you should get at the end that the output of “uname -r” is exactly Version-Release (in this case “2.4.33-xeon_1.0” and “2.4.33-xeon_1.0smp” for the SMP version).
Set kernel24 1 if you are compiling a 2.4 kernel, 0 if it is a 2.6 kernel.

Rebuild the kernel

To recompile the kernel:

rpm -ba /usr/src/redhat/SPECS/my_kernel.spec

or:

rpmbuild -ba /usr/src/redhat/SPECS/my_kernel.spec

You should get two binary packages (kernel-* and kernel-smp-*) in: /usr/src/redhat/RPMS/i386/

Advertisements

Leave a comment

Filed under Configuration, Linux, Tips

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com 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