Subject: Re: LKM Device Drivers
To: Jared D. McNeill <jmcneill@invisible.ca>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 04/12/2002 17:17:36
On Fri, 12 Apr 2002, Jared D. McNeill wrote:

> I'm currently working on LKM device driver support, but am running into
> some problems. The biggest problem is that I can't load dependencies with
> the way LKMs are currently handled. Consider the following:
>
>  modload mii.o
>  modload mii_bitbang.o
>  modload mii_phy.o
>  modload nsphy.o
>  modload if_ex_pci.o
>
> if_ex_pci.o depends on functions found in the other modules, but without
> an in-kernel linker, I have no way of doing this easily.
>
> So, the solution that I'm using right now, is chainloading a copy of each
> dependency with each driver. I wrote a script that uses modstat and
> proper use of the -A and -o flags to load a driver and any dependencies
> specified on the command line.
>
> Any ideas on a better way to do this? I don't know if I am up for adding
> an in-kernel linker quite yet..

One intermediate step would be to add something like /dev/ksym from
Solaris (which I don't know much about). The main thing is to add a way
for the kernel to:

1) export its symbol table to userland

2) have the symbol table grow as lkms are added (and shrink when they
unload).

3) have userland tools use said new device

Take care,

Bill