Re: Linus's include file strategy redux

From: Miquel van Smoorenburg (miquels@traveler.cistron-office.nl)
Date: Sat Dec 16 2000 - 06:09:49 EST


In article <Pine.LNX.3.96.1001215194935.19208D-100000@tarot.mentasm.org>,
 <ferret@phonewave.net> wrote:
>On 15 Dec 2000, Miquel van Smoorenburg wrote:
>
>> I think /lib/modules/`uname -r`/ should contain a script that
>> reproduces the CFLAGS used to compile the kernel.
>
>However it happens, the necessary information THAT I KNOW OF is:
>0) The kernel headers under linux/include
>1) The state information generated by running make configure ; make dep ;
>make clean -OR- equivalently by Debian's make-kpkg clean ; make-kpkg
>configure which does the same thing but adds packaging-specific metadata.

That state info is in ARCH, CFLAGS, CC and include/linux/autoconf.h

>A SYMLINK from /lib/modules/`uname -r`/ into /path/to/kernel-`uname -r`
>will not always work, because:
>0) The destination may not even exist (if the kernel has been installed
>onto another machine)

Yes but in that case, how are you going to compile a module without
the kernel headers anyway. If you compiled a kernel on one
machine and you know that you want to be able to compile modules
on the second machine you need to copy over /usr/src/linux-x.y.z/include
as well.

>1) The destination has no metadata or has the WRONG metadata (if I've just
>compiled and installed 2.4.0-test11 on my i386, then am now building same
>for my sun4c)

As I said the kconfig script should do some simple sanity checks-
compare version and architecture at least.

>I have been recently told that a full copy of kernel headers and metadata
>in /lib/modules/`uname -r`/ isn't going to work either, but the gentleman
>who informed me of this hasn't yet shown why.

Because lots of use have a small root file system of just 30 MB ?

Hmm, but as soon as you start thinking about cross-compiles etc
you need more and more state - like CROSS_COMPILE, AS, LD, CPP, AR,
NM etc etc. Yuck. It would probably be better to put all that info
in /usr/src/linux/Config.make, and use the current "build" symlink.
A module makefile would then look like this:

#! /usr/bin/make -f

# You might want to point BUILD somewhere else.
BUILD = /lib/modules/$(shell uname -r)/build
include $(BUILD)/Config.make

module.o:
        $(CC) $(CFLAGS) -c module.c

Ah yes, this is probably a much better approach then a kconfig script

Mike.

-- 
RAND USR 16514
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Dec 23 2000 - 21:00:15 EST