October 23, 2014
 
 
RSSRSS feed

Custom Linux Kernels with Debian and Fedora - page 2

The Debian Way of Customizing Kernels

  • August 9, 2007
  • By Carla Schroder

Fedora patches its kernels all to heck, to the point that a vanilla kernel may not work. Of course it costs nothing but a bit of time to try. But if you want to use genuine Fedora kernel sources they come in source RPMs, so you'll have to build your kernel and then package it into an RPM. First fetch your kernel SRPM from your favorite Fedora mirror, such as:

$ wget http://mirrors.kernel.org/fedora/releases/7/Fedora/source/SRPMS/kernel-2.6.21-1.3194.fc7.src.rpm

Then make sure you have the RPM building tools, plus the normal build environment from part 1:

# yum install rpmdevtools

The next step is to create a build tree in your home directory, and make sure to do this as yourself and not as the root user:

$ fedora-buildrpmtree

This creates an rpmbuildtree directory populated with BUILD, RPMS, SOURCES, SPECS, and SRPMS directories. Next, install the source RPM. This will unpack files into your new rpmbuildtree directory:

$ rpm -ivh 2.6.21-1.3194.fc7.src.rpm

Ignore the warnings about "group kojibuilder does not exist."

Next, run the %prep stage of the RPM rebuild, and make the --target option match your CPU type:

 $ rpmbuild -bp --target=i686 ~/rpmbuild/SPECS/kernel-2.6.spec

This extracts the kernel tarball and applies all the Fedora patches. Now change to the source directory of your new build tree:

$ cd ~/rpmbuild/BUILD/kernel-2.6.21/linux-2.6.21-1.3194.i686/

And get started with configuring your new kernel:

$ make mrproper
$ make xconfig

Finally, roll it all up into an RPM:

$ rpmbuild --target i686 -ba ~/rpmbuild/SPECS/kernel-2.6.spec

Again, make the --target option match your CPU type. Your new RPM should be in ~/rpmbuild/RPMS/i686/. Grab your new kernel.rpm and install it just like any other RPM:

# rpm -ivh kernel-2.6.21-1.3194.i686.rpm

This handles all the chores of copying files to /boot and creating a boot menu entry, so all you do is reboot and select your new kernel from your boot menu.

Sitemap | Contact Us