|
Although kerneld comes with builtin knowledge about the most common types of modules, there are situations where kerneld will not know how to handle a request from the kernel. This is the case with things like CD-ROM drivers or network drivers, where there are more than one possible module that can be loaded.
The requests that the kerneld daemon gets from the kernel is for one of the following items:
a block-device driver
a character-device driver
a binary format
a tty line discipline
a filesystem
a network device
a network service (e.g. rarp)
a network protocol (e.g. IPX)
The kerneld determines what module should be loaded by scanning the configuration file /etc/conf.modules[1]. There are two kinds of entries in this file: Paths where the module-files are located, and aliases assigning the module to be loaded for a given service. If you don't have this file already, you could create it by running
/sbin/modprobe -c | grep -v '^path' /etc/conf.modules |
If you want to add yet another path directive to the default paths, you must include all the default paths as well, since a path directive in /etc/conf.modules will replaceall the ones that modprobe knows by default!
Normally you don't want to add any paths by your own, since the built-in set should take care of all normal setups (and then some...), I promise!
On the other hand, if you just want to add an alias or an option directive, your new entries in /etc/conf.modules will be added to the ones that modprobe already knows. If you should redefine an alias or an option, your new entries in /etc/conf.modules will override the built-in ones.
If you run /sbin/modprobe -c, you will get a listing of the modules that kerneld knows about, and what requests they correspond to. For instance, the request that ends up loading the floppy driver is for the block-device that has major number 2:
osiris:~ $ /sbin/modprobe -c | grep floppy alias block-major-2 floppy |
Why block-major-2 ? Because the floppy devices /dev/fd* use major device 2 and are block devices:
osiris:~ $ ls -l /dev/fd0 /dev/fd1 brw-rw-rw- 1 root root 2, 0 Mar 3 1995 /dev/fd0 brw-r--r-- 1 root root 2, 1 Mar 3 1995 /dev/fd1 |
Character devices are dealt with in a similar way. E.g. the ftape floppy tape driver sits on major-device 27:
osiris:~ $ ls -lL /dev/ftape crw-rw---- 1 root disk 27, 0 Jul 18 1994 /dev/ftape |
However, kerneld does not by default know about the ftape driver - it is not listed in the output from /sbin/modprobe -c. So to setup kerneld to load the ftape driver, I must add a line to the kerneld configuration file, /etc/conf.modules:
alias char-major-27 ftape |
You can also use the device name instead of the char-major-xxx or block-major-yyy setup. This is especially useful for network drivers. For example, a driver for an ne2000 netcard acting as eth0 would be loaded with
alias eth0 ne |
If you need to pass some options to the driver, for example to tell the module about what IRQ the netcard is using, you must add an "options" line:
options ne irq=5 |
This will cause kerneld to load the NE2000 driver with the command
/sbin/modprobe ne irq=5 |
Of course, the actual options available are specific to the module you are loading.
Binary formats are handled in a similar way. Whenever you try to run a program that the kernel does not know how to load, kerneld gets a request for binfmt-xxx, where xxx is a number determined from the first few bytes of the executable. So, the kerneld configuration to support loading the binfmt_aout module for ZMAGIC (a.out) executables is
alias binfmt-267 binfmt_aout |
Since the magic number for ZMAGIC files is 267, if you check /etc/magic, you will see the number 0413; keep in mind that /etc/magic uses octal numbers where kerneld uses decimal, and octal 413 = decimal 267. There are actually three slightly different variants of a.out executables (NMAGIC, QMAGIC and ZMAGIC), so for full support of the binfmt_aout module we need
alias binfmt-264 binfmt_aout # pure executable (NMAGIC) alias binfmt-267 binfmt_aout # demand-paged executable (ZMAGIC) alias binfmt-204 binfmt_aout # demand-paged executable (QMAGIC) |
a.out, Java and iBCS binary formats are recognized automatically by kerneld, without any configuration.
Line disciplines are requested with tty-ldisc-x, with x being usually 1 (for SLIP) or 3 (for PPP). Both of these are known by kerneld automatically.
Speaking of ppp, if you want kerneld to load the bsd_comp data compression module for ppp, then you must add the following two lines to your /etc/conf.modules:
alias tty-ldisc-3 bsd_comp alias ppp0 bsd_comp |
Some network protocols can be loaded as modules as well. The kernel asks kerneld for a protocol family (e.g. IPX) with a request for net-pf-X where X is a number indicating what family is wanted. E.g. net-pf-3 is AX.25, net-pf-4 is IPX and net-pf-5 is AppleTalk; These numbers are determined by the AF_AX25, AF_IPX etc. definitions in the linux source file include/linux/socket.h. So to autoload the IPX module, you would need an entry like this in /etc/conf.modules:
alias net-pf-4 ipx |
See Common Problems for information about how you can avoid some annoying boot-time messages related to undefined protocol families.
kerneld requests for filesystems are simply the name of the filesystem type. A common use of this would be to load the isofs module for CD-ROM filesystems, i.e. filesystems of type iso9660:
alias iso9660 isofs |
[1] | Some distributions call this file modules.conf |
Hosting by: Hurra Communications Ltd.
Generated: 2007-01-26 17:58:02