Intro
The aim of this tip is to: Upload, view and delete kernel modules Display system configuration information in the file system (/proc) Configure runtime parameters with the system file (/proc)
Kernel Modules
Modular components of the Kernel
Many components of the kernel can be configured to be dynamically loaded, this option provides increased functionality of the kernel without increasing the size of the boot image. Thus all the components not needed to boot are modularized including device drivers and any additional file system.
The /lib/module directory
The kernel modules reside in /lib/module/{ Kernel version}. The directory name correspond to the kernel version (as reported by uname -r or uname -a). From version 2.4 an additional structure was added including new directories (kernel/{arch, drivers, fs, net}).
Control Modules
The modules are loaded when the kernel prompt them. The command lsmod lists the modules currently present in the Kernel. To request the kernel to load other modules you can use insmod or rmmod to unload an inactive module.
Intelligent control of modules
Just as for the dependency packages, modules depend on each other. It is possible to generate this dependence through the depmod command.
This command is executed automatically, with REDHAT. At system startup, rcsysinit launch command depmod -A, which compares the timpestamps of the files and updates modules.dep, if needed. modprobe can then be used to load kernel modules.
Configuring Kernel Modules
When the kernel needs a module, it will load it using modprobe and the kmod program will run it.
Some modules require, for their execution, the transition configuration settings. These parameters are present in the /etc/moduleonf file, which contains the default settings of loaded modules and their aliases. modprobe consults the configuration file when loading a new module to assign its default settings.
The file system /proc
The file system (/proc) is not associated with hard drive, but is enabled or disabled in the kernel. It represents a map of the kernel processes running. Its initialization is done via an entry in /etc/fstab file.
It is possible to navigate under /proc, as in a normal directory but note that all files have a size ofzero, however, it is possible to view the content using commands such as cat (Avoid viewing the file /proc/kcore because it represents an image of kernel memory for outstanding performance).
The / proc directory contains:
/proc/scsi: information about SCSI devices
information about SCSI devices /proc/ide : information on IDE devices
information on IDE devices /proc/net: information on network activity and configuration
information on network activity and configuration /proc/sys : parameters of the kernel configuration
parameters of the kernel configuration /proc/
Configure /proc/sys avec sysct
Changes made to /proc/sys are temporary, in fact, during system startup, rc.sysinit will call sysctl -e -p /etc/syctlonf. It also defines the values for /proc/sys/kernel/modprobe or /proc/kernel/hotplug.. This automatically restores the values of /proc/sys.
Notes
Thanks to wjaouadi for this tip