Building CentOS-5 i586 Kernel

Currently the CentOS-5 kernel SRPM do not support i586 targets. This article provides instructions on modifying the official CentOS-5 kernel source and building an i586 kernel RPM out of it.

The resulting RPM is for your own personal use. Custom kernels are not supported by the development team, and you are responsible for its continuing maintenance in case of security updates, new releases, and any other scenario which may warrant such actions.

Unpack kernel source

Follow Section 2 of I Need the Kernel Source to unpack the kernel source into a working directory.

Patch specification file

Make the following changes to ~/rpmbuild/SPECS/kernel-2.6.spec:

  1. Use a custom build ID to avoid conflict with official kernel by uncommenting the following line and defining a unique ID:

    %define buildid .your_identifier
    
  2. Make i586 a valid target architecture by replacing the following lines:

    # Don't build 586 kernels for RHEL builds.
    %if 0%{?rhel}
    %define all_x86 i386 i686
    # we differ here b/c of the reloc patches
    %ifarch i686 x86_64
    

    with:

    %if 0%{?rhel}
    %define all_x86 i386 i586 i686
    # we differ here b/c of the reloc patches
    %ifarch i586 i686 x86_64
    
  3. Prevent deletion of the i586 config file in the build process by removing these lines:

    # don't need these in general
    rm -f kernel-%{kversion}-i586.config
    

Update config file

Copy ~/rpmbuild/SOURCES/kernel-2.6.18-i686.config to ~/rpmbuild/SOURCES/kernel-2.6.18-i586.config and make the following changes in kernel-2.6.18-i586.config:

  1. Replace the following lines:

    # CONFIG_M586 is not set
    # CONFIG_M586TSC is not set
    # CONFIG_M586MMX is not set
    CONFIG_M686=y
    

    with:

    CONFIG_M586=y
    # CONFIG_M586TSC is not set
    # CONFIG_M586MMX is not set
    # CONFIG_M686 is not set
    

Building the i586 kernel

Follow Section 5 of Custom Kernel to build the kernel. Use the --target=i586 flag to specify the desired architecture.

TimothyLee/centos5 i586 patch (last edited 2010-01-11 05:45:02 by TimothyLee)