Re: [PATCH] asm*/resource.h fix for glibc

Miquel van Smoorenburg (miquels@cistron.nl)
16 Dec 1999 21:52:00 GMT


In article <cistron.19991216222200.B16373@pcep-jamie.cern.ch>,
Jamie Lokier <lkd@tantalophile.demon.co.uk> wrote:
>Miquel van Smoorenburg wrote:
>> People just need to understand that you have to compile modules
>> with -I/usr/src/linux/include or -I/usr/src/linux-2.4.22/include
>
>Modules aren't the only things which need kernel headers, unfortunately.
>Glibc will never be magically up to date with the ioctl of the day.

Well yes, it's hard to compile userland stuff with
-I/usr/src/linux-4.1.2/include because /usr/include/net and
/usr/src/linux-4.1.2/include/net are 2 very different things.

I would like it very much if include/net and include/scsi in
the kernel source were renamed to say include/knet and include/kscsi
(or include/linux/net and include/linux/scsi)

>> A Makefile fragment in /usr/src/linux (say, config.mk) that keeps
>> the CFLAGS that were used to compile the kernel would go a long
>> way to getting people to use -I/usr/src/linux-2.4.22/include
>> pretty much automatically.
>
>Some standard fragment would be very cool for add-on modules.
>But where do you put it?

It should probably go in /usr/src/linux-4.1.2/include/linux, so that it
still works if you have just the kernel headers installed and
not the entire source

>I find my installed kernel source tree is often different to the one I'm
>running. Often because the kernel in the source tree has bugs ;-)

Exactly

>> Module Makefiles then would look like something like this:
>>
>> # Point to kernel you want to build against
>> TOPDIR=/usr/src/linux
>>
>> include $(TOPDIR)/config.mk
>
>It would be great if it weren't for that pesky /usr/src/linux thing.

That's why it says "Point to kernel you want to build against". It
should probably look more like this:

# Point to include file directory of the kernel you want to build against
# A good default is /usr/src/linux/include
KERNELINC=/usr/src/linux-2.4.5/include

include $(KERNELINC)/linux/config.mk
CFLAGS := -I$(KERNELINC) $(CFLAGS)

I'm not sure about using /usr/src/linux-2.4.5/include or simply
/usr/src/linux-2.4.5 (the base directory). Oh well.

The README that comes with a module should tell you to edit the Makefile
and adjust the path to the kernel if you want to build against a
non-standard kernel. The default should probably be /usr/src/linux
for people who installed the running kernel and headers and/or source
straight from the rpm or deb and simply want to build a module.

That way, nothing depends on /usr/include/linux anymore.

So actually, we need 2 things:

- rename include/net and include/scsi in the kernel source.
This is for the benefit of compiling userland programs against
non-standard kernel headers
- generate a config.mk Makefile fragment when compiling the kernel
that gets put in include/linux/config.mk (like config.h, really)
This is for the benefit of compiling standalone modules

Note that this is probably the 6th time that this is discussed
and I am at least the 2nd person to come to this conclusion ;)

Mike.

-- 
The From: and Reply-To: addresses are internal news2mail gateway addresses.
Reply to the list or to miquels@cistron.nl (Miquel van Smoorenburg)

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