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.

# yum install @"Development Tools"
# yum install rpmdevtools yum-utils
$ rpmdev-setuptree
$ yumdownloader --source kernel
# yum-builddep kernel-
# 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

$ rpm -Uvh kernel-
$ 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

$ cd ../SPECS
$ vi kernel.spec
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

$ 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- root@kdpeter:/tmp; ssh root@kdpeter 'rpm -ivh --force /tmp/kernel-'

1 comment:

  1. Thank you very much. You helped me out building a kernel module the indirect way (not from kernel source). The WEB is full of documents that don't help. Your article made a difference.