[CentOS] kernel sourcecode ?

Wed Oct 19 19:00:55 UTC 2005
Linus Hicks <lihicks at gpi.com>

Johnny Hughes wrote:
> 
> The Kernel sourcecode is not like kernel-source.  It is a noarch rpm
> that does not get arch specific patches added to the source, making it
> relatively worthless as a package for building kernels.
> 
> Because of that, and because it is not down by either fedora or the
> upstream provider, we are also no longer producing a kernel-sourcecode
> rpm.
> 
> If one needs a full kernel tree, they can download the kernel SRPM from
> here:
> 
> http://mirror.centos.org/centos/4/os/SRPMS/
> 
> OR
> 
> http://mirror.centos.org/centos/4/updates/SRPMS/
> 
> Then install the source with the command:
> 
> rpm -i kernel-xxxx.src.rpm
> 
> Then go to the SPECS directory  (Usually /usr/src/redhat/SPECS) and get
> a full kernel tree with the command:
> 
> rpmbuild -bp --target i686 kernel-2.6.spec
> 
> (substitute your target arch)
> 
> Then go to the BUILD directory and you will have a real (and patched)
> tree:
> 
> cd ../BUILD

Note that alternatively, you can make your own kernel-sourcecode rpm by editing 
the spec file once you install the .src.rpm. You will see several "%define"s 
right near the front, one of which is "buildsource" and by setting that to "1" 
(and I usually set the others to "0" so it won't take so long), rather than 
doing the rpmbuild -bp, you can then do something like:

rpmbuild -bb --target i686 kernel-2.6.spec

and you will get your own kernel-sourcecode rpm in the RPMS/<arch> directory.

Linus