Running Linux, 5th Edition - Matthias Kalle Dalheimer [351]
You can list the drivers that are loaded with the command lsmod:
rutabaga$ lsmod
Module Size Used by
parport 40392 1 parport_pc
The memory usage of the module in bytes is displayed as well. The parport driver here is using about 40 KB of memory. If any other modules are dependent on this module, they are shown in the third column.
A module can be unloaded from memory using the rmmod command, as long as it is not in use. For example:
rmmod parport_pc
The argument to rmmod is the name of the driver as it appears in the lsmod listing.
Once you have modules working to your satisfaction, you can include the appropriate insmod commands in one of the rc scripts executed at boot time. One of your rc scripts might already include a place where insmod commands can be added, depending on your distribution.
One feature of the current module support is that you must rebuild a module any time you upgrade your kernel to a new version or patch level. (Rebuilding your kernel while keeping the same kernel version doesn't require you to do this.) This is done to ensure that the module is compatible with the kernel version you're using. If you attempt to load a module with a kernel that is newer or older than that for which it was compiled, insmod will complain and not allow the module to be loaded. When rebuilding a module, you must be running the kernel under which it will be used. Therefore, when upgrading your kernel, upgrade and reboot the new kernel first, then rebuild your modules and load them. There is an option that allows you to keep your modules when switching kernels, but a number of problems are associated with it, and we recommend against using it.
Loading Modules Automatically
The automatic loading of modules is an especially useful feature implemented by a kernel component called kmod . With the help of kmod, the kernel can load needed device drivers and other modules automatically and without manual intervention from the system administrator. If the modules are not needed after 60 seconds, they are automatically unloaded as well.
In order to use kmod, you need to turn on support for it (Automatic kernel module loading) during kernel configuration in the Loadable module support section.
Modules that need other modules must be correctly listed in /lib/modules /kernelversion/modules.dep, and there must be aliases for the major and minor number in /etc/modprobe.conf (and often in subdirectories of /etc/modprobe.d). See the documentation from the module-init-tools package for further information.
If a module has not been loaded manually with insmod or modprobe, but was loaded automatically by the kernel, the module is listed with the additional string (autoclean) in the lsmod output. This tells you that the kernel will remove the module if it has not been used for more than one minute.
We have gone through quite a lot of material now, and you should have all the tools you'll need to build and maintain your own kernels.
Chapter 19. Text Editing
In this chapter, we will look at some editors for editing text . As you have already learned, Linux is rich in configuration files, and even though there are more and more graphical tools for configuring your system, you will not get far without being able to operate at least one text editor. And of course, if you want to author text documents using a real formatting language like those described in the next chapter, or want to write your own software, as described in Chapter 21, you will need text editors even more. There is a good reason why we discuss more than one text editor here. There are the really large and comfortable ones such as XEmacs, but if you just want to change a few characters here or there, firing up such a huge beast may take longer than you are willing to wait, and in this case it is good if you are able