[CentOS] wiki howto on custom kernel

Mon Mar 12 18:43:24 UTC 2007
Johnny Hughes <johnny at centos.org>

On Mon, 2007-03-12 at 12:02 -0400, Alfred von Campe wrote:
> On Mar 12, 2007, at 10:15, Jim Perrin wrote:
> > Building as root is bad practice for all software. This is mostly to
> > protect you from bad code. If a cleanup script tries to delete /
> > instead of just the buildroot, you'll be in a world of hurt by
> > building as root. By building as a normal/restricted user you reduce
> > the permissions available to the code, thereby minimizing potential
> > damage.
> OK, I understand.  A (somewhat) related question: can I move the ~/ 
> rpmbuild directory to a different location?  My home directory is NFS  
> mounted, and I'd rather do a build on a local disk.  Can I just move  
> it myself or is there a way to specify this as an option when  
> installing the fedora-rpmdevtools RPM?

You can put the /rpmbuild directory anywhere you want ... edit
the .rpmmacros file in the "builder user's" home directory and adjust
the the %_topdir to where you want to build ... mine looks like this:

%_topdir        /home/hughesjr/rpmbuild

Make sure the "build user" has rw permissions in the rpmbuild dir.

> >>    2. Why do these steps not work if you do this as root
> >>       (i.e., no ~/rpmbuild after fedora-buildrpmtree)?
> >
> > Root's rpmbuild dir is /usr/src/redhat
> Of course, I should have known that.
> >>    3. After copying the config file an making one small
> >>       change with "make xconfig", why are there so many
> >>       differences in the config file?
> >
> > Are they actual changes, or is the diff now simply off by a few lines?
> Actual changes.  And lots of them.  The output of diff is over 2,000  
> lines long.  It may be that things just got reordered, but all I did  
> was a "make xconfig" and change two settings.
> >> The first two questions are just intellectual curiosity, but the
> >> third one really has me wondering what's going on.  I followed the
> >> steps in the Wiki, and when I diff'ed the original config file to the
> >> one create by "make xconfig" after making two changes in the serial
> >> port section, I saw a lot of differences.
> >
> > Like what?
> In order to compare apples to apples, I ran both config files through  
> the following "filter": sort -u <configfile> | grep -v '^#'.  The  
> resulting output of diff is now only 317 lines, and here are the  
> first 20 or so:
> # diff -wib /tmp/config.orig /tmp/config.new  | head -25
> 2d1
> <
> 21d19
> 24a23
> 31,32d29
> 73a71
> 99c97
> ---
> 159a158
> 200,201d198
> 207c204
> ---
> 212c209
> The only changes I intended to make were the following two:
>    CONFIG_SERIAL_8250_NR_UARTS=20     [from 4]
> I may only need one or the other, but I wasn't sure so I changed them  
> both.  Anyway, I thought I followed the recipe to the letter, and I  
> got all these changes.  After I noticed this, I even copied the  
> config file again and re-ran "make xconfig" and the same thing  
> happened again.

Did you do "make oldconfig" with the old config file?

you might also want to ensure you are using the correct target and
arch .. I do this:

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

the go to the linux directory under BUILD ... and copy the
configs/kernel-xxxx.config file into .config

then do this:

ARCH=i386 make oldconfig

Then ... 

ARCH=i386 make menuconfig

(you can use xconfig if you like)

make changes

save config file

If this is C4 .. you can take that .config file that you saved and move
it directly into SOURCES to use (replace the current one of that
type ... OR name it something else and modify the spec file to use the
new name as a source).

If this is C5 (or FC5/6) you will need some stuff added to the top of
the config file to get it to work ... but on C4, you can use the config
directly from make menuconfig (xconfig) as a kernel config file.

Johnny Hughes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.centos.org/pipermail/centos/attachments/20070312/99c10141/attachment-0005.sig>