[CentOS] Building a new 2.6 kernel

Fri Jul 21 23:56:54 UTC 2006
John Warren <jwarren at prudentrx.com>


> -----Original Message-----
> From: centos-bounces at centos.org 
> [mailto:centos-bounces at centos.org] On Behalf Of Matt Hyclak
> Sent: Friday, July 21, 2006 3:41 PM
> To: 'CentOS mailing list'
> Subject: Re: [CentOS] Building a new 2.6 kernel
> 
> 
> 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.


There were several other steps before that which I did not list.

It goes something like this:

rpm -i kernel-2.6.9-34.0.2.EL.src.rpm
Edit the kernel-2.6.spec file
cp SOURCES/kernel-2.6.9-i686-smp.config BUILD/kernel-2.6.9/linux-2.6.9/.config
Edit as required using menuconfig
cp .config /home/buildcentos/rpmbuild/SOURCES/kernel-2.6.9-i686-smp.config
rpmbuild --target=i686 -bs /home/buildcentos/rpmbuild/SPECS/kernel-2.6.spec
rpmbuild --rebuild --target=i686
/home/buildcentos/rpmbuild/SRPMS/kernel-2.6.9-34.0.2.EL.PRX.01.src.rpm

> 
> > 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.E
> L.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..

Ahh I see, so which directory is the best place to be when you start the
build?

> 
> 
> > 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.

I think they did, see above.

I'm still not sure just how to ket the kernel loaded. Adjusting the grub.conf
I understand. I found this but I'm not sure if it's the right way to do it.

rpm -ivh --force kernel-smp-2.6.9-34.0.2.EL.PRX.01.i686.rpm

Thanks Matt

> 
> Matt
> 
> -- 
> Matt Hyclak
> Department of Mathematics 
> Department of Social Work
> Ohio University
> (740) 593-1263
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>