[OpenAFS-devel] RH 7.1 spec file: archlist

Derek Atkins warlord@MIT.EDU
25 Jul 2001 13:28:12 -0400


Rudolph T Maceyko <rtm@cert.org> writes:

> In the meantime, I'm trying to deal with the fact that building from
> the source RPM takes ages, and happened to notice that it *tries* to
> build a module for all of the architectures specified in $archlist, but
> it actually builds the same module for each of them!

Um, no, it shouldn't be building the same module for each kernel, if
you have a Red Hat kernel-source (and you actually build against
that).  If you look at /usr/src/linux-2.4.2/include/linux/rhconfig.h
you will notice there is something funky going on.  Also, look at
/usr/src/linux-2.4.2/include/linux/modules/ksyms.ver -- you will
notice that Red Hat supplies different kernel symbol versions for each
architecture.  That is why you cannot just build for i386 -- someone
running the 586 or athlon kernel will have different ksyms, preventing
you from loading the modules.

The SPEC file tries to work around this problem by building a
different module for each architeture.

> This is from the openafs-kernel-1.1.1 RPM (straight from openafs.org):
> 
> $ pwd
> /usr/vice/etc/modload
> $ md5sum *.o | sort
> 1c7d991de1682fb242bd014ff15df96e  libafs-2.4.2-2-athlon.o
> 1c7d991de1682fb242bd014ff15df96e  libafs-2.4.2-2-i386.o
> 1c7d991de1682fb242bd014ff15df96e  libafs-2.4.2-2-i586.o
> 1c7d991de1682fb242bd014ff15df96e  libafs-2.4.2-2-i686.o
[snip]
> 
> Of 16 total files there are really only 4 distinct files.  Shouldn't
> they be different?  The same thing happens when I build from the source
> RPM.

Yes, they should be different.  In particular, they should each be
using a different set of kernel module symbols.  Can you take a look
at /usr/vice/etc/modload/SymTable -- each module should be using a
different set of symbols, so each module should be listed differently.
Clearly this isn't working right.  I don't know why, but I'll try to
look into it.  This is most certainly a bug, but I don't know whose
bug.

> Note that the only thing that differs from one compilation to the next
> is the name of the output module:

Wrong...

> > 	for arch in $archlist ; do
> > 
> > 	    PrintRedhatKernelFix $arch $mp src/config/redhat-fix.h
> > 
> > 	    make only_libafs LOCAL_SMP_DEF=-DREDHAT_FIX \
> > 		LINUX_MODULE_NAME="-$arch" MPS=$mp
> > 	done

Note the 'PrintRedhatKernelFix'?  That prints a new header file which
is included from afsconfig.h.  This is supposed to work around the Red
Hat rhconfig.h bug in terms of choosing the proper kernel
"configuration" for the architecture and MP-ness.

> What's the right thing to do here?  Certainly not to build the same
> modules four times over...  :-)  If there are no architecture-specific
> optimizations, then just build them all for i386...

As I said earlier, you cannot do that because you NEED a different
module for each platform to match the kernel symbols in each
architecture.  It _should_ be building different modules (well, be
using different kernel symbols) for each architecture.  I don't know
why it isn't.  But you're right, there is still a problem here.

> -Rudy

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord@MIT.EDU                        PGP key available