If you were ever interested in building custom kernel rpms for your machine i have detailed the process here with the minimal amount of steps.
First be sure you have the needed tools
- yum-utils
- rpm-build
Then download the latest kernel source
yumdownloader --source kernel
Once that is downloaded lets setup our local rpm tree
rpmdev-setuptree
Extract and install the source
rpm -Uvh kernel-x.y.zz.ii-jjj.fcx.src.rpm
Execute the “%prep” stage from the spec file. Normally this involves unpacking the sources and applying any patches.
rpmbuild -bp --target=`uname -m` ~/rpmbuild/SPECS/kernel.spec
At this point we can setup our configuration to apply during the build.
cd ~/rpmbuild/BUILD/kernel-x.y.zz/linux-x.y.zz.`uname -m`/ make oldconfig make menuconfig
copy your configuration to the sources folder.
cp .config ~/rpmbuild/SOURCES/config-`uname -m`
and you are ready to build
rpmbuild -bb --with baseonly --without debuginfo --target=`uname -m` ~/rpmbuild/SPECS/kernel.spec
kernel-firmware
if you need to build the firmware module then change this line to this in the
~/rpmbuild/SPECS/kernel.spec
%define with_firmware %{?_with_firmware: 0} %{?!_with_firmware: 1}
Creating Patches
if you’d like to create a working copy to apply any custom test or patches, this will allow you to create a patch for your build.
cp -r ~/rpmbuild/BUILD/kernel-2.6.26/linux-2.6.26.x86_64 ~/rpmbuild/BUILD/kernel-2.6.26.dist cp -al ~/rpmbuild/BUILD/kernel-2.6.26.dist ~/rpmbuild/BUILD/kernel-2.6.26.new diff -uNrp ~/rpmbuild/BUILD/kernel-2.6.26/vanilla/{file} ~/rpmbuild/BUILD/kernel-2.6.26.new/{file} > {file}.patch
After all steps when I execute this command:
cd ~/rpmbuild/SPECS
rpmbuild -bp –target=$(uname -m) kernel.spec
it is giving following error:
DEPMOD 2.6.38.6
+ cp /root/rpmbuild/BUILDROOT/kernel-2.6.38.6-2.x86_64/boot/vmlinuz-2.6.38.6
cp: missing destination file operand after `/root/rpmbuild/BUILDROOT/kernel-2.6.38.6-2.x86_64/boot/vmlinuz-2.6.38.6′
Try `cp –help’ for more information.
error: Bad exit status from /var/tmp/rpm-tmp.CIXxWL (%install)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.CIXxWL (%install)
Please tell me what is wrong with kernel.spec.
those are ticks and not parentheses… the ticks will execute the uname command to determine which architecture to build auto-magically, it’s a convenience function…
perhaps its a site font issue but that line should read :
rpmbuild -bp –target=`uname -m` ~/rpmbuild/SPECS/kernel.spec
cheers
[page@radon 11:04:32 ~] $ uname -m
x86_64
[page@radon 11:04:34 ~] $