DEPMOD(1)

NAME
depmod, modprobe - handle loadable modules automatically

SYNOPSIS
depmod [ -a ]
depmod [ -a version ]
depmod module1.o module2.o ...

modprobe module.o [symbol=value ...]
modprobe -t tag pattern
modprobe -a -t tag pattern
modprobe -l [ -t tag ] pattern
modprobe -r module
modprobe -c

DESCRIPTION
These utilities are intended to make a Linux modular kernel manageable for all users, administrators and distribution maintainers.

Depmod creates a "Makefile"-like dependency file, based on the symbols it finds in the set of modules mentioned on the command line (or in a default place). This dependency file can later be used by modprobe to automatically load the relevant module(s).

Modprobe is used to load a set of modules, either a single module, a stack of dependant modules, or all modules that are marked with a specified tag.

Modprobe will automatically load all base modules needed in a module stack, as described by the dependency file modules.dep. If the loading of one of these modules fails, the whole current stack of modules will be unloaded (by rmmod) automatically.

Modprobe has two ways of loading modules. One way (the probe mode) will try to load a module out of a list (defined by pattern ). It stops loading as soon as one module load successfully. This can be used to autoload one ethernet driver out of a list for example. The other way, is to load all modules from a list. This can be used to load some modules at boot time.

With the option -r, modprobe will automatically unload a stack of modules, similar to the way rmmod -r does.

Option -l combined with option -t list all available modules of a certain type. An enhanced mount command could use the command
    modprobe -l -t fs to get the list of all file system drivers available and on request load the proper one. So, the mount command could become more generic as well... (The kerneld solve this without changing the mount utility)

Option -c will print all configuration (default + configuration file).

The normal use of depmod is to include the line "/sbin/depmod -a" in one of the rc-files in /etc/rc.d, so that the correct module dependencies will be available immediately after booting the system.
Note that it is also possible to create the dependency file immediately after compiling a new kernel. If you do "depmod -a 1.3.99" when you have compiled kernel 1.3.99 and its modules the first time, while still running e.g. 1.3.98, the file will be created in the correct place.
Note however that the dependencies on the kernel will not be guaranteed to be correct in this case!

Option -d put depmod in debug mode. It outputs all command it is issuing. Option -e output the list of unresolved symbol for each module, Normally depmod only output the list of unloadable modules. Option -v output the list of all processed modules. Modules may be located at different place in the filesystem, but there will always be some need to override this, especially for module developers. We expect some official standard will emerge, defined by the FSSTND. Until that time you might as well use this suggested directory structure.

CONFIGURATION
The behaviour of depmod and modprobe can be adjusted by the (optional) configuration file /etc/conf.modules

The configuration file consists of a set of lines.
All empty lines, and all text on a line after a '#', will be ignored.
Lines may be continued by ending the line with a '\'.
The remaining lines should all conform to one of the following formats:
  keep
  parameter=value
  options module symbol=value ...
  alias module real_name
  pre-install module command ...
  install module command ...
  post-install module command ...
  pre-remove module command ...
  remove module command ...
  post-remove module command ... All values in the "parameter" lines will be processed by a shell, which means that "shell tricks" like wild-cards and commands enclosed in back-quotes can be used:
  path[misc]=/lib/modules/1.1.5?
  path[net]=/lib/modules/`uname -r` Parameters may be repeated multiple times.

These are the legal parameters:

keep
    If this word is found on a line before any lines that contain the path descriptions, the default set of paths will be saved, and thus added to. Otherwise the normal behaviour is that the default set will be replaced by the set of paths in the configuration file.

depfile=DEPFILE_PATH
    This is the path to the dependency file that will be created by depmod and used by modprobe.

path=SOME_PATH
    The path parameter specifies a directory to search for the modules.

path[tag]=SOME_PATH
    The path parameter can carry an optional tag. This tells us a little more about the purpose of the modules in this directory and allows some automated operations by modprobe. The tag is appended to the "path" keyword enclose in square brackets. If the tag is missing, the tag "misc" is assumed.
    One very useful tag is boot, which can be used to mark all modules that should be loaded at boot-time.

If the configuration file '/etc/conf.modules' is missing, or if any parameter is not overridden, the following defaults are assumed:

  depfile=/lib/modules/`uname -r`/modules.dep
  path[boot]=/lib/modules
  path[fs]=/lib/modules/`uname -r`
  path[misc]=/lib/modules/`uname -r`
  path[net]=/lib/modules/`uname -r`
  path[scsi]=/lib/modules/`uname -r`
  path[fs]=/lib/modules/default
  path[misc]=/lib/modules/default
  path[net]=/lib/modules/default
  path[scsi]=/lib/modules/default
  path[fs]=/lib/modules
  path[misc]=/lib/modules
  path[net]=/lib/modules
  path[scsi]=/lib/modules

All "option" lines specify the default options that are needed for a module, as in:
  modprobe de620 bnc=1 These options will be overridden by any options given on the modprobe command line.
It is possible to have an "option" line for aliased module names as well as for the non-aliased name. This is useful for e.g. the dummy module:
  alias dummy0 dummy
  options dummy0 -o dummy0

The "alias" lines can be used to give alias names to modules. A line in /etc/conf.modules that looks like this:
  alias iso9660 isofs makes it possible to write modprobe iso9660 although there is no such module available.
Note that the line:
  alias some_module off will make modprobe ignore requests to load that module. This is usually used in conjunction with kerneld.

Commands
    The configuration lines
      pre-install module command ...
      install module command ...
      post-install module command ...
      pre-remove module command ...
      remove module command ...
      post-remove module command ...
    can be used when one wants some specific commands to be executed when a module is inserted or removed. All text after the module name will be interpreted as the command text.
    Note that the pre- and post-remove commands will not be executed if a module is "autocleaned" by kerneld! Look for the up-coming support for persistent module storage instead.

STRATEGY
The idea is that modprobe will look first at the directory containing modules compiled for the current release of the kernel. If the module is not found there, modprobe will look in the directory containing modules for a default release.

When you install a new linux, the modules should be moved to a directory related to the release (and version) of the kernel you are installing. Then you should do a symlink from this directory to the "default" directory.

Each time you compile a new kernel, the command make modules_install will create a new directory, but won't change the default.

When you get a module unrelated to the kernel distribution you should place it in one of the version-independent directories under /lib/modules.

This is the default strategy, which can be overridden in /etc/conf.modules.

EXAMPLES

modprobe -t net
    Load one of the modules that are stored in the directory tagged "net". Each module are tried until one succeed (default: /lib/modules/net).

modprobe -a -t boot
    All modules that are stored in the directory tagged "boot" will be loaded (default: /lib/modules/boot).

modprobe slip.o
    This will attempt to load the module slhc.o if it was not previously loaded, since the slip module needs the functionality in the slhc module. This dependency will be described in the file "modules.dep" that was created automatically by depmod

modprobe -r slip.o
    will unload slip.o. It will also unload slhc.o automatically, unless it is used by some other module as well (like e.g. ppp.o).

FILES
/etc/conf.modules, (and /etc/modules.conf)
/lib/modules/*/modules.dep,
/lib/modules/*

SEE ALSO
lsmod(1), kerneld(8), ksyms(1), modules(2),

REQUIERED UTILITIES
insmod(1), nm(1) rmmod(1),

NOTES
The pattern supplied to modprobe will often be escaped to ensure that it is evaluated in the proper context

AUTHOR
Jacques Gelinas (jack@solucorp.qc.ca)
Bjorn Ekwall (bj0rn@blox.se)

BUGS
Naah...