Subject: Re: Request for comments: let config(1) generate LKMs
To: Hiroyuki Bessho <bsh@grotto.jp>
From: Quentin Garnier <cube@cubidou.net>
List: tech-toolchain
Date: 09/13/2007 18:32:59
--yHybtreh+GYqnN39
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Sep 14, 2007 at 01:19:18AM +0900, Hiroyuki Bessho wrote:
> At Thu, 13 Sep 2007 13:34:24 +0200,
> Martin Husemann wrote:
> >=20
> > There are two parts to this:
> >=20
> >  - generate the module - I don't see how config(1) is involved here
> >=20
>   I think Quentin has answered better to this.  config(1) knows how to
> build all parts of the kernel, so it also knows how to build an LKM
> once it is told (with new syntax) which part of the kernel goes to the
> module.  Which means, you don't need to hand-craft files like
> sys/dev/BUS/DEV/{Makefile,DEV_lkm.c} everytime you want the LKM
> version of a device driver.

The information config(1) has is how pieces of code within the tree
depend from eachother, and only that.

There are two different situations for building LKMs:

  - OS-wide, for kernel distribution.  This is what FreeBSD and Linux
    do from the kernel source tree, i.e., modules are built as parts of
    the kernel.

  - casual compilation of a kernel component, usually from a 3rd party.
    In that case config(1) can't really help for anything, at least in
    its current incarnation.

[...]
> > Sorry, but I guess I did not quite understand what you are proposing,
> > could you please explain?
> >=20
>   In the linux camp, building a module of a device driver (or a
> subsystem of the kernel) is very easy and just mark [M] instead of [X]
> in menuconfig (as far as the device driver code supports module and
> in-kernl forms).  What I want is to do the same thing with config(1)
> and config(5).

What you're missing here is how Linux does the dependency stuff.  It
works at the symbol level, and requires the use of depmod(8) to make
auto-loading possible.  config(1) can offer very precious information
for dependencies, but in order to use it, you'll have to go a lot
further than just config(1).

--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"You could have made it, spitting out benchmarks
Owe it to yourself not to fail"
Amplifico, Spitting Out Benchmarks, Hometakes Vol. 2, 2005.

--yHybtreh+GYqnN39
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (NetBSD)

iQEVAwUBRulmO9goQloHrPnoAQIeFggAtMhFhP6kjEU9RIG7Ej3UVp9hEiN+AQxO
nepBci73wIKZA9KUCOVhBIk8ZBtWfhPEY/PfSdkcImdgFeo1Xml0znN2MYq9sffa
yfrbuhzNILhhYmt/LfNExAgBglxhbJZ2f0cOLqPxaBZkd5WwLdrCnSYKXCl8a7/c
1L9zq+4AeSvYYGBKkeUr77txg/8D3xdq4Pc19RHw5KfXgBQZ/B3U+rEYL8D6R9vb
QNWS8yfekffBXMpWMOZtI0CeGgdkGXLyzix7Mb3rbiUh08XNd7TkbPzJHTAdUf1D
rgnODKZwLxqtWZKwj89Na6qILMqhtriWFKpzVgUzZGqOumNDsA0sdw==
=6Yk4
-----END PGP SIGNATURE-----

--yHybtreh+GYqnN39--