[PlanetCCRMA] ccrma kernel sources

Fernando Pablo Lopez-Lezcano nando@ccrma.Stanford.EDU
Mon Jan 19 23:43:01 2004


> I have had some unfortunate experiences with the kernel sources provided by RedHat 
> in the past. The kernel source from RedHat is not configured in the same way as the
> binary kernel. Hence, when I wanted to apply a patch or compile some new modules I 
> had to walk through the whole kernel configuration, option by option, and guess 
> which options they enabled in the old binary kernel to make sure the new compiled 
> kernel behaves like the old one. Not very nice :-(
> 
> Is it possible to get sources for the planet-ccrma kernels that have all the options
> set exactly as they are in the compiled kernel binaries kindly distributed by Nando?

Yes, as is the case for the original RedHat kernels. The kernel is an
rpm and it built as such. The "source" to use for building a kernel is a
source rpm (with the .src.rpm extension), _not_ the kernel-source binary
rpm (with extension .i386.rpm). The later can be used for building
additional modules outside of the kernel, but not for rebuilding the
whole kernel from scratch. The .src.rpm package for the kernel can be
found in the System Stuff page in the web site. 

> I ask because for enabling the camera I will have to compile in some modules. I 
> would only like to do exactly that, not reverse engineer the whole kernel, which 
> is what I have had to do a couple of times with the RedHat kernels. 

That is not necessary at all. Once you have the .src.rpm for the kernel
you want to change, install it with "rpm -Uvh
kernel-2.4.24-1.ll.src.rpm" (for example). 

That will store stuff in:
/usr/src/redhat/SOURCES/*
  --> source for the kernel, patches, configuration files, etc
/usr/src/redhat/SPECS/kernel-2.4.24-1.ll.spec
  --> spec file, the file that controls the build process of the rpm. 

At this point you could rebuild the kernel binary rpms by saying:
  cd /usr/src/redhat/SPECS
  rpmbuild -bb kernel-2.4.24-1.ll.spec
You will need patience and a lot of disk space, it takes a while. 
To build for other architectures:
  rpmbuild -bb --target i686 kernel-2.4.24-1.ll.spec

If you want to _look_ at the configuration files used by the build
process go and look at /usr/src/redhat/SOURCES/*.config. Select the one
that matches the kernel and architecture you want to build. You could
changes options there directly by editing them but have to _really_ know
what you are doing (because of dependencies between modules). Usually
what I do is to get a build tree ready to go by doing:
  rpmbuild -bp kernel-2.4.24-1.ll.spec

This will leave a patched, ready to be built kernel tree in:
  /usr/src/redhat/BUILD/kernel-2.4.24-1.ll/linux-2.4.24-1.ll/
"cd" there, you will find the configuration files in configs/*
Copy the one you want to .config and do the regular make xconfig or
whatever and then copy back the resulting modified .config to
/usr/src/redhat/SOURCES/ (which is where things will be pulled from when
you start a build). 

If you want to add patches, then it is more difficult. You will have to
edit the .spec file and add the patch reference in two places (first a
declaration of the patch and then its application). You'll have to read
through the spec file to try to understand how the process works. Not
easy but not particularly difficult. If you roll your own kernel please
change the release number somehow...

Anyway, this should be enough to get you started. 
-- Fernando