What determines if kernel modules are auto-loaded?

Lowell Gilbert freebsd-questions-local at be-well.no-ip.com
Mon Sep 22 06:26:39 PDT 2003


David Fleck <david.fleck at mchsi.com> writes:

> Why, for instance, does my (4.6.2-RELEASE-p20) system have a nfs.ko kernel
> module, and a line in /boot/defaults/loader.conf to enable this module,
> but (apparently) no way to *use* the module?  If I compile a kernel with
> 'options NFS' uncommented in the kernel config file, the nfs module gets
> built into the kernel, and loading the module is pointless - however, if I
> comment out 'options NFS', the kernel can't compile because of missing
> symbols.  So I have a chunk of code that gets built by the makefile as a
> module, but can't be used as a module?  I find this all very unintuitive.
        
Quite simply, it *can* be used as a module.  Your problems trying to
do that are probably pilot error; at a guess, you forgot to remove
NFS_ROOT from the kernel configuration when you removed NFS.

> What seems to be happening during the kernel compile process is that a
> certain number of modules are always compiled, regardless of config file
> settings - the settings only determine if a given chunk of code makes it
> into the kernel itself.  If the module is compiled into a .ko file, and if
> the code isn't present in the kernel, then it can be loaded by kldload. Is
> this correct?

That's exactly right.  Even if the functionality is already in the
kernel, the module is built as well.  There are make.conf(5) settings
to change (by hand) which modules do/don't get built, but most people
find it easier to just not worry about it and let everything get
built.  



More information about the freebsd-questions mailing list