[OpenAFS-devel] what's "enable-redhat-buildsys" all about?

Matthew Miller mattdm@mattdm.org
Fri, 18 Jun 2004 00:43:11 -0400


[trimming the CC list a bit]

On Fri, Jun 18, 2004 at 12:25:39AM -0400, Derek Atkins wrote:
> I guess the question is:  what RPM do I need installed to build multiple
> modules for each platform?  Is "kernel-source" sufficient or do I need
> something else to get all these ancillary files for each platform build
> of a kernel.

You don't need kernel-source (now "kernel-sourcecode", actually) at all. You
need "/lib/modules/`uname -r`/build" from each binary kernel package. This
is a bunch of Makefiles, Kconfigs, and a few other such bits, plus the
actual include files.

One approach I'm toying with actually grabs that from the binary packages
and creates tar.bz2 files of just that bit, which I then actually include as
sources in the openafs specfile. (See the following quick and dirty
`extractkernheaders.sh` script.)

The advantage of this is that there's no gaping unnamed (and possibly
variable) external dependencies -- just one package, and it reliably and
reproducably builds the same kernel modules every time. This has been an
annoyance for us in the past -- when we build a new openafs to include
modules for a new updated kernel, we have to make sure our build machine has
examples of all possible past kernels that someone might be running.

This method requires an extra step, and some slightly weird redundancy, but
has the advantage of complete predictability.

It's obviously a lot less portable, though. My focus on making an RPM is
somewhat different from the focus of a general openafs.org package -- I want
a very good RPM for BU Linux / Fedora core, and I have the luxury of not
needing to be concerned about SuSE, Mandrake, et al.


Anyway, here's the script.... nothing really fancy. I'll post the actual
src.rpm tomorrow.

 . . . . . .
#!/bin/sh

if [ ! -e $1 ]; then
	echo "usage:"
	echo "  $0 kernel-2.6.#-#.###.i#86.rpm"
	exit 1
fi

OLDDIR=`pwd`
BUILDDIR=`mktemp -d -t kernheaders.XXXXXXXXXX` || exit 2

ARCH=`rpm -qp --qf %{arch} $1`

cd $BUILDDIR
rpm2cpio $OLDDIR/$1 | cpio -idv ./lib/modules/*/build/*
KVER=`ls lib/modules`
cd lib/modules
mv $KVER ${KVER}-${ARCH}
tar cvjf $OLDDIR/kernelheaders-${KVER}-${ARCH}.tar.bz2 ${KVER}-${ARCH}
cd $OLDDIR
rm -rf $BUILDDIR
ls -l kernelheaders-${KVER}-${ARCH}.tar.bz2


-- 
Matthew Miller           mattdm@mattdm.org        <http://www.mattdm.org/>
Boston University Linux      ------>                <http://linux.bu.edu/>