Loadable kernel modules can save memory and ease configuration. The scope of modules has grown to include filesystems, ethernet card drivers, tape drivers, printer drivers, and more.
The module utilities are available from wherever you got your kernel source as
modutils-x.y.z.tar.gz; choose the highest patchlevel
x.y.z that is equal to or below that of your current kernel. Unpack it with `
tar zxvf modutils-x.y.z.tar.gz',
cd to the directory it creates (
modutils-x.y.z), look over the
README, and carry out its installation instructions (which is usually something simple, such as
make install). You should now have the programs
/sbin. If you wish, test out the utilities with the ``hw'' example driver in
insmod; look over the
INSTALL file in that subdirectory for details.
insmod inserts a module into the running kernel. Modules usually have a
.o extension; the example driver mentioned above is called
drv_hello.o, so to insert this, one would say `
insmod drv_hello.o'. To see the modules that the kernel is currently using, use
lsmod. The output looks like this:
blah# lsmod Module: #pages: Used by: drv_hello 1`
drv_hello' is the name of the module, it uses one page (4k) of memory, and no other kernel modules depend on it at the moment. To remove this module, use `
rmmod drv_hello'. Note that
rmmodwants a module name, not a filename; you get this from
lsmod's listing. The other module utilities' purposes are documented in their manual pages.
As of version 2.0.30, most of everything is available as a loadable modules. To use them, first make sure that you don't configure them into the regular kernel; that is, don't say
y to it during `
make config'. Compile a new kernel and reboot with it. Then,
/usr/src/linux again, and do a `
make modules'. This compiles all of the modules which you did not specify in the kernel configuration, and places links to them in
/usr/src/linux/modules. You can use them straight from that directory or execute `
make modules_install', which installs them in
x.y.z is the kernel release.
This can be especially handy with filesystems. You may not use the minix or msdos filesystems frequently. For example, if I encountered an msdos (shudder) floppy, I would
insmod /usr/src/linux/modules/msdos.o, and then
rmmod msdos when finished. This procedure saves about 50k of RAM in the kernel during normal operation. A small note is in order for the minix filesystem: you should always configure it directly into the kernel for use in ``rescue'' disks.