Monday, May 23, 2011

Steps to test custom Kernel RPM build on Fedora 15

These are minimum steps required to test if your Fedora 15 has everything it needs to build custom Kernel RPM. Lines starting with "#" are actions done with root. Lines starting with "$" are done with non-root user.

Downloading
# yum install @"Development Tools"
# yum install rpmdevtools yum-utils
$ rpmdev-setuptree
$ yumdownloader --source kernel
# yum-builddep kernel-2.6.38.6-26.rc1.fc15
# yum install qt3-devel qt3 libXi-devel

Note for Fedora 15: If you are experiencing problems related to missing dependencies, mainly on x64 systems, try to add --enablerepo=updates-testing on the end of yum commands, so it will look like:
# yum install @"Development Tools" --enablerepo=updates-testing


Preparing
$ rpm -Uvh kernel-2.6.38.6-26.rc1.fc15.src.rpm
$ cd ~/rpmbuild/SPECS
$ rpmbuild -bp --target=$(uname -m) kernel.spec
$ cd ../BUILD
$ cp -r kernel-2.6.38.fc15/ kernel-2.6.38.fc15.orig
$ cp -a kernel-2.6.38.fc15.orig kernel-2.6.38.fc15.new

$ cd ../SPECS
$ vi kernel.spec
From: http://fedoraproject.org/wiki/Docs/CustomKernel
Open the kernel.spec file for editing to give the kernel a unique name. This is important to ensure the custom kernel is not confused with any released kernel. Add a unique string to the kernel name by changing the 'buildid' line. Optionally, change ".local" to your initials, a bug number, the date or any other unique string.

Change this line:

#% define buildid .local

To this (note the extra space is removed in addition to the pound sign):
%define buildid .custom_text


Building
$ rpmbuild -bb --with baseonly --without debuginfo --target=`uname -m` kernel.spec

Copying and installing custom Kernel RPM into test VM
$ scp ../RPMS/x86_64/kernel-2.6.38.6-26.rc1.peter.fc15.x86_64.rpm root@kdpeter:/tmp; ssh root@kdpeter 'rpm -ivh --force /tmp/kernel-2.6.38.6-26.rc1.peter.fc15.x86_64.rpm'

No comments:

Post a Comment