Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Feb 2002 17:54:01 -0600
From:      "Mike Meyer" <mwm-dated-1014767642.ba7055@mired.org>
To:        Cliff Sarginson <csfbsd@raggedclown.net>
Cc:        questions@freebsd.org
Subject:   Re: Kernel loader
Message-ID:  <15477.34969.572893.76786@guru.mired.org>
In-Reply-To: <89637344@toto.iv>

next in thread | previous in thread | raw e-mail | index | archive | help
Cliff Sarginson <csfbsd@raggedclown.net> types:
> Well, I tried this out in -hackers, and got a couple of mono-syllabic
> replies, but no-one answered my question. So I will try it here.

Gee, I wouldn't answer on -hackers because I figured someone who knew
the answers better than I would answer. Oh well...

> The kernel loader code has mechanisms to implant dependencies in the
> module code, e.g. if module A requires module B, then you can build
> this knowledge into module A.

That's correct.

> Now I do not believe that if you load module A, then module B is
> automagically loaded as well. Looking at the program kldload it
> is just a few lines that just invokes a system call to load the
> module requested. I think the system call code should be in my
> source tree somewhere but I am damned if I can find it.

Your belief is incorrect. Well, it's incorrect for elf modules. I
don't know about other formats because I didn't check them. The source
code you want is in sys/kern/kern_linker.c and link_elf.c.

> What I was getting at is that in Linux they have this 'depmod'
> setup that creates a dependency list, so that loading a module
> should load all other required modules. I am looking for the
> same functionality in FreeBSD. I do not believe it exists.

You may be looking for gensetdefs. It's used in dealing with
dependency lists in /usr/src/sys/conf/kmod.mk. It looks like the
gensetdefs man page is out of date, though. However, if you're going
to write a kld, you really don't care.

> Can anyone confirm this, or refute it.

I'm not sure which I did, but I think I answered your question.

> My second question was this.
> It seems to me that the kernel module loading may have some 
> sensitivity over the point at which it is loaded. I have reported
> a bug in drm-kmod and my tests seem to show that it makes a
> difference when a particular module (in this case "agp") is loaded
> early on in the boot process via loader.conf, or later on by a shell
> command in /usr/local/etc/rc.d. Is this likely to be expected ?

I can't really help here, because I'm not that intimate with PC
hardware. However, I know that BSD has run on hardware on which it
mattered which order devices were allocated. Basically, if something
that can use anything grabs what it thinks is best, then something
needing a specific flavor or amount comes along, the second one may
work if allocated first, and fail if allocated second. Just to make
matters interesting, if you probed for them in the order that
allocation worked, the probe didn't work, and vice versa.

> I got zero answers to this question.
> 
> If it does make a difference then I would be so bold as to say that
> on-demand kernel loadable modules are not on-demand kernel loadable
> modules if they cannot be loaded after the main boot process is
> complete...and therefore you may as well build them into the kernel
> in the first place.

It may be that whether or not you can load them after the main boot
process completes depends on what gets loaded by the main boot
process. So that on some kernel configs it works fine as a kld, and on
others it doesn't work because some resource it needs is no longer
available.

	<mike
--
Mike Meyer <mwm@mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

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




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