[CentOS] Building a new 2.6 kernel

Fri Jul 21 22:41:10 UTC 2006
Matt Hyclak <hyclak at math.ohiou.edu>

On Fri, Jul 21, 2006 at 03:12:49PM -0700, John Warren enlightened us:
> You also said something about keeping my own release numbers. I think the line
> is:
> 
> %define release 34.0.2.EL
> 
> So I should change it to something like:
> 
> %define release 34.0.2.EL.PRX.01
>

You can do that, yes. I think by default, it also appends some information
like the user building the RPM to the name. You can check out the spec file
for that.

> PS: Build just finished and got these errors. I was in the following directory
> when I started the build. 
> 
> /home/buildcentos/rpmbuild/BUILD/kernel-2.6.9/linux-2.6.9
>

And the first thing that the RPM does is remove that directory to start from
scratch :-)

> And used the command:
> 
> rpmbuild --rebuild --target=i686
> /home/buildcentos/rpmbuild/SRPMS/kernel-2.6.9-34.0.2.EL.src.rpm
>

If you're making changes to the spec file, you probably want 
rpmbuild -ba --target=i686 kernel.spec instead.

> The errors I got.
> 
> Wrote: /home/buildcentos/rpmbuild/RPMS/i686/kernel-2.6.9-34.0.2.EL.i686.rpm
> Wrote:
> /home/buildcentos/rpmbuild/RPMS/i686/kernel-devel-2.6.9-34.0.2.EL.i686.rpm
> Wrote:
> /home/buildcentos/rpmbuild/RPMS/i686/kernel-smp-2.6.9-34.0.2.EL.i686.rpm
> Wrote:
> /home/buildcentos/rpmbuild/RPMS/i686/kernel-smp-devel-2.6.9-34.0.2.EL.i686.rpm
> Wrote:
> /home/buildcentos/rpmbuild/RPMS/i686/kernel-hugemem-2.6.9-34.0.2.EL.i686.rpm
> Wrote:
> /home/buildcentos/rpmbuild/RPMS/i686/kernel-hugemem-devel-2.6.9-34.0.2.EL.i686
> .rpm
> Wrote:
> /home/buildcentos/rpmbuild/RPMS/i686/kernel-debuginfo-2.6.9-34.0.2.EL.i686.rpm
> Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.23183
> shell-init: error retrieving current directory: getcwd: cannot access parent

Errors are due to where you started. It did successfully create the RPMs,
though.


> It also looks like all of the files and directories are deleted during the
> build. That included the kernel.2.6.spec file. Not a problem but it just
> caught me off guard when they disapeared. It looks like a new copy of the
> sources with the changes I made was created in the SRPMS directory. Is that
> correct? If so I guess I just install it and rebuild. Nice touch if that's
> correct.
> 

Ahh, I bet your changes didn't make it in if you just make them in the
BUILD/kernel... directory. The first thing rebuilding the src rpm does is
wipe that directory out and unpack a fresh copy. You're best off making
changes to the files in the SOURCES directory, and rebuilding from the .spec
file. I think there's also a way to skip parts of the build process, so you
could -bp to prep, make changes in BUILD, then skip the prep part of the
build process so that it doesn't overwrite your changes. man rpmbuild for
that.

Matt

-- 
Matt Hyclak
Department of Mathematics 
Department of Social Work
Ohio University
(740) 593-1263