CentOS 6.5 kernel compile for VIA C7 CPU

After a recent kernel update I found that the stock CentOS kernel was less than optimal for the CPU I am using, and so I decided to create a kernel optimised for my VIA C7 CPU.

As root:

• Set up build environment

Make sure kernel packages are not excluded in yum config
nano /etc/yum.conf
# exclude = kernel*
Install development packages (possibly not all of them are required, feel free to experiment)
yum groupinstall "Development Tools"
yum install ncurses-devel
yum install qt-devel qt3-devel
yum install hmaccalc zlib-devel binutils-devel elfutils-libelf-devel
yum install rpm-build redhat-rpm-config asciidoc hmaccalc perl-ExtUtils-Embed xmlto
yum install binutils-devel elfutils-libelf-devel newt-devel python-devel zlib-devel
yum install elfutils-devel audit-libs-devel
yum install gtk2-devel gtk+-devel gtk+extra-devel
wget http://dl.fedoraproject.org/pub/epel/6/i386/libunwind-1.1-2.el6.i686.rpm
wget http://dl.fedoraproject.org/pub/epel/6/i386/libunwind-devel-1.1-2.el6.i686.rpm
rpm -Uvh libunwind*.rpm

As standard user:

• Prepare sources

Install sources (modify download URL for version required)
# wget http://vault.centos.org/6.5/updates/Source/SPackages/kernel-2.6.32-431.17.1.el6.src.rpm
wget http://vault.centos.org/6.5/updates/Source/SPackages/kernel-2.6.32-431.20.3.el6.src.rpm
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
# rpm -i kernel-2.6.32-431.17.1.el6.src.rpm 2>&1
rpm -i kernel-2.6.32-431.20.3.el6.src.rpm 2>&1
Update spec file
cd ~/rpmbuild/SPECS
cp kernel.spec kernel.spec.ori
nano kernel.spec
modify buildid (line 18)
%define buildid .zjl_viac7
Update config files
cd ~/rpmbuild/SOURCES/
nano  config-i686-nodebug-rhel
and add the following lines
# CONFIG_M686 is not set
The config file hierarchy is
to produce kernel-2.6.32-i686.config
and I simply picked the last (by default empty) config file in the sequence.

• Prepare sources in build directory

cd ~/rpmbuild/
rpmbuild -bp --target=$(uname -m) SPECS/kernel.spec
If rpmbuild gets stuck after line
gpg: keyring `./pubring.gpg' created
probably there is not enough entropy available. Perform some background tasks, e.g. wiggle the mouse or open a new terminal and run
sudo find /
sudo rngd -r /dev/hwrandom
sudo rngd -r /dev/urandom

• Build

cd ~/rpmbuild/
rpmbuild -v -bb --with baseonly --without debug --without debuginfo --without doc --without kabichk --without perf --target=`uname -m` SPECS/kernel.spec 2> build-err.log | tee build-out.log
rpmbuild -v -bb --target noarch --without doc SPECS/kernel.spec 2> fw-build-err.log | tee fw-build-out.log

As root:

• Install

rpm -ivh kernel-*.rpm
If kernel packages were excluded initially, restore yum config
nano /etc/yum.conf
exclude = kernel*

See also


4 thoughts on “CentOS 6.5 kernel compile for VIA C7 CPU”

  1. Hi,
    what was the background to recompile the kernel?
    i use C7 too via 3100+ board, on high load the cpu crashes
    sometimes and mdadm degraded my raid 1
    Thanks for Infos

  2. cool! thanks for the infos… hope my VIA EPIA EN15000 will now clean reboot and work also so solid like yours 😉

Leave a Reply

Your email address will not be published. Required fields are marked *