[OpenAFS-devel] Build system tweak required for SUSE
Marcus Watts
mdw@umich.edu
Sun, 12 Nov 2006 22:11:54 -0500
Mike Fedyk <mfedyk@mikefedyk.com> had replied:
> Message-ID: <4557D75D.1070802@mikefedyk.com>
> From: Mike Fedyk <mfedyk@mikefedyk.com>
> User-Agent: Thunderbird 1.5.0.7 (X11/20060927)
> To: Greg Hudson <ghudson@mit.edu>
> Cc: openafs-devel@openafs.org
> Subject: Re: [OpenAFS-devel] Build system tweak required for SUSE
>
> Greg Hudson wrote:
> > Unlike RHEL or FC, however, SUSE's /lib/modules/<version>/build
> [snip]
> > So, I think AC_TRY_KBUILD needs to be looking for a different file in
> > order to detect a 2.6 tree in order to work out of the box on SUSE.
> > I'm not immediately sure what would work.
>
> Will checking for the existence of /lib/modules/<version>/build be enough?
>
> --
> Mike Fedyk mfedyk@mikefedyk.com
> tel: (712) 432-7952 FWD:779523
> _______________________________________________
> OpenAFS-devel mailing list
> OpenAFS-devel@openafs.org
> https://lists.openafs.org/mailman/listinfo/openafs-devel
>
The OpenAFS linux kernel build subsystem expects to build things
under 2.6 with something like this line:
make -C $LINUX_KERNEL_PATH M=$SRCDIR_PARENT/conftest.dir modules
(where LINUX_KERNEL_PATH is where you told it to find kernel headers,
and SRCDIR_PARENT contains your module's stuff.)
I think the interesting question is whether SUSE puts enough stuff under
whatever points to /lib/modules/<version>/build to make this work.
Right off-hand; in a "real" 2.6 kernel build, I see that the top-level
Makefile includes this file:
include $(srctree)/scripts/Kbuild.include
and I don't see scripts/Kbuild.include in SUSE's truncated build directory.
In fact, the Makefile they do include is not what ships with 2.6,
and looks amazingly wimpy... Oh my. Wow. What they ships
has these lines in Makefile:
KERNELSRC := ../../../linux-2.6.5-7.282
...
$(MAKE) -C $(KERNELSRC) O=$(KERNELOUTPUT)
which basically means there's a whole another layer of indirection going
on here, and the *REAL* kernel source lives somewhere else entirely
different (and also means if you don't have *THAT* you can't build modules.)
Personally I don't think AC_TRY_KBUILD has any business trying to
chase down this kind of indirection, not unless it's expected to
just plain understand a lot that's probably real particular to SUSE,
or it's going to parse arbitrary Makefiles or otherwise exhibit
unwonted signs of AI. Mind you, I do have some fairly crazy
experimental logic to chase down kernel build flags in 2.4 by using
a variation on the kernel build process to make it cough up the
compiler options being used.
The most reliable way I know to determine linux version number
is to try building this:
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
#warning this is 2.6
#else
#warning this might be 2.4
#endif
(s/#warning/#error/ or otherwise munge as desired; can be built with
regular userland compiler; use -I to point to target header files.)
-Marcus