Re: Distributing drivers independent of the kernel source tree

J.A. Magallon (jamagallon@able.es)
Fri, 27 Sep 2002 00:03:23 +0200


On 2002.09.26 Arjan van de Ven wrote:
>On Thu, 2002-09-26 at 22:55, Heater, Daniel (IndSys, GEFanuc, VMIC)
>> 2. Assuming the kernel source is in /usr/src/linux is not always valid.
>>
>> 3. I currently use /usr/src/linux-`uname -r` to locate the kernel source
>> which is just as broken as method #2.
>
>you have to use
>
>/lib/modules/`uname -r`/build
>(yes it's a symlink usually, but that doesn't matter)
>
>
>that's what Linus decreed and that's what all distributions honor, and
>that's that make install does for manual builds.
>

And that does not work if you build against a non-running kernel.
You force a two step (two reboots!!) procedure for a kernel upgrade.
Say I use alsa drivers. If I jump from kernel 2.4.18 to 2.4.19
I have to:

- build 2.4.19
- boot on 2.4.19 (without alsa and a ton of messages about failed
sound services)
- build alsa
- boot again

I really hate that 'uname -r'. As far as /usr/src/linux has _nothing_
to do with current system (glibc has its own headers), you can always
suppose that /usr/src/linux is the source of the kernel you are working
with (building, hacking, wahtever), and that it is different from what
you run. So a kernel upgrade is just
- build 2.4.19 (on /usr/src/linux-2.4.19, and /usr/src/linux symlinks to it)
- build alsa against /usr/src/linux
- reboot and alehop, done in _one_ step.

Where to install the out-of-tree module ? Get the version you are building
against from /usr/src/linux/include/version.h:

KREL:=$(shell grep UTS_RELEASE /usr/src/linux/include/linux/version.h | cut -d\" -f2)

You can always not-to-hardcode kernel location using something like:
LINUX=/usr/src/linux
KREL=$(shell grep UTS_RELEASE $(LINUX)/include/linux/version.h | cut -d\" -f2)
CFLAGS=-nostdinc -I$(LINUX)/include
MODDIR=/lib/modules/$(LINUX)/my_private_dir

I use this for adding nvidia and bproc to a kernel and works fine.
Just one reboot per upgrade.

/juan

-- 
J.A. Magallon <jamagallon@able.es>      \                 Software is like sex:
werewolf.able.es                         \           It's better when it's free
Mandrake Linux release 9.0 (Cooker) for i586
Linux 2.4.20-pre7-jam0 (gcc 3.2 (Mandrake Linux 9.0 3.2-1mdk))
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/