[OpenAFS-devel] Linux Kernel Module build question

Jeremy Katz katzj@linuxpower.org
Thu, 12 Jul 2001 09:03:02 -0700


On Thursday, July 12 2001, Derek Atkins said:
> Jeremy Katz <katzj@linuxpower.org> writes:
> > On Thursday, July 12 2001, Derek Atkins said:
> > > I have sent a patch to Derrick that will enable me to better build Red
> > > Hat kernels (especially on 7.1).  The kludge I'm going to use is to
> > > replace /boot/kernel.h for each kernel-module build.
> > 
> > And you will break building the packages as non-root.  This is not the
> > right answer at all.  The only package which should ever have to be
> > built as root is a package containing device nodes (and even that
> > requirement should be going away real soon now).  
> 
> Well, it's a short-term solution until Red Hat fixes your bug.
> Considering you need to be root in order to install the RPMs in the
> first place, I don't consider it a major hastle that you need to be
> root to build it as well.

The problem isn't so much the hassle, it's the amount of build root
contamination which is possible if something goes awry. =\  Build root
pollution bad, reproducibility of builds good.  
 
> > > The other problem is choosing the right module.  I'm still working on
> > > that one.
> > 
> > The UP/SMP mechanism already present should work fine (actually, are you
> > installing to /lib/modules now or still to /usr/vice/etc/modload?)  In
> > addition to that, you can just build multiple times using --target (eg,
> > --target=i586, --target=i686) and add proper %ifarch macros to the
> > specfiles so that the only things which get built with the non-base
> > architectures is the kernel modules package.   Normal RPM magic then
> > applies as far as getting the right modules.
> 
> I am still installing modules in /usr/vice/etc/modload.  I don't want
> to have multiple user-space packages, just multiple kernel-modules.

Exactly.

> What do you mean by building 'multiple times using --target'?  Can you
> show me an example of that?

Simple example spec (should give the basic idea of what you need)
<initial boiler plate stuff including all subpackages...  )
%setup -q 

%build
<do some standard stuff>

# change what we build based on if it's one of the subarches
%ifnarch i586 i686
make all
%else
make modules
%endif

%install
make install

# don't include the base package files on a subarch build
%ifnarch i586 i686
%files
<standard filelist>
%endif

# include for all arches
%files kernel
<kernel files>

#EOF


Then, instead of just running the rpm build once, you run the first time
to build all of the base packages and then build additional times for
each subarchitecture by rebuilding the SRPM with a --target, eg

rpm -ba openafs.spec # get initial SRPM and base package
rpm --rebuild openafs.src.rpm --target=i586
rpm --rebuild openafs.src.rpm --target=i686

HTH,

Jeremy

-- 
Jeremy Katz
katzj@linuxpower.org	| jlkatz@eos.ncsu.edu
http://linuxpower.org	| Developer, NCSU Realm Kit for Red Hat Linux
GPG fingerprint: 367E 8B6B 5E57 2BDB 972A 4D73 C83C B4E8 89FE 392D