Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 01 May 2000 11:42:12 -0700
From:      Peter Wemm <peter@netplex.com.au>
To:        Boris Popov <bp@butya.kz>
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: HEADS UP: loader updated to handle module metadata 
Message-ID:  <20000501184212.0E4561CDF@overcee.netplex.com.au>
In-Reply-To: Message from Boris Popov <bp@butya.kz>  of "Tue, 02 May 2000 00:51:07 %2B0700." <Pine.BSF.4.10.10005020045380.55878-100000@lion.butya.kz> 

next in thread | previous in thread | raw e-mail | index | archive | help
Boris Popov wrote:
> 	Loader was updated to handle module metadata which was introduced
> by recent updates in kernel linker. This is related to a new way of
> declaration of module dependencies.

Not only that, but once we've settled on a versioning scheme, we will be
using dependency tags with version numbers in order to detect incompatable
interface changes before the kld gets a chance to crash the system.

In a nutshell, we have a couple of MODULE_*() macros that create small
data structures in linker_set's.  The loader now knows *exactly* what is
in the static kernel, and *exactly* what is inside a kld file.  Remember,
a kld can have zero or more "modules", and many do.  miibus.ko, for example
has about 12 modules and none are actually called "miibus".

The key thin here is that if you compile 'device miibus' into your kernel,
the loader can see it, and if you try and preload one of the miibus drivers
(eg: if_dc, if_vr etc), the loader will now know that it does not need to
preload a 'miibus' module from somewhere.

How these are packaged has an effect on the overall scheme of things.  As a
hypothetical example, it would be possible to do this:

ld -shared -o netbundle.ko setdef0.o if_dc.kld if_vr.kld if_xl.kld \
  miibus.kld setdef1.o

If you then preloaded 'netbundle', then you will get a whole stack of
modules in one chunk.  If you then kldload if_sk (another miibus user), it
would automatically become a dependency on netbundle.ko in order to use the
miibus code contained within it's internals.  If you hand't loaded
netbundle.ko (or something else that contained the miibus internals) then
it would guess and try and load miibus.ko for you.

One thing that I have on my TODO list is an inversion of the kernel build
mechanism so that config(8)'s replacement arranges for building all these
intermediate .kld file bundles according to your compile options.  (eg:
SMP, INVARIANTS etc).  As a final step, the build process takes these .kld
intermediate files and produces a static kernel and/or the final kld
packaging you requested.  Of course, getting this all finished and working
is proving to be 'entertaining' :-).

Cheers,
-Peter



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000501184212.0E4561CDF>