Article Title: How is the Linux kernel module transferred to the kernel ?. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Lsmod reads the/proc/modules file to check which kernel modules have been loaded by the kernel. If the extended functions required by the operating system kernel do not exist, the kernel module management daemon kmod executes modprobe to load the kernel module. When a common identifier is passed to modprobe, modprobe first searches for the string in the file/etc/modules. conf. Then, modprobe traverses the file/lib/modules/version/modules. dep to determine whether other kernel modules need to be loaded before the module is loaded. This file is created by command depmod-a and stores the dependency between kernel modules. Finally, modprobe calls insmod to first load the dependent module and then load the module required by the kernel. Modprobe directs insmod to the/lib/modules/version/[1] Directory, which is the default standard directory for storing kernel modules. Therefore, when you want to load a kernel module, you can execute:
Insmod/lib/modules/2.5.1/kernel/fs/fat. o
Insmod/lib/modules/2.5.1/kernel/fs/msdos. o
Or just execute "modprobe-a msdos ".
In Linux, modprobe, insmod and depmod are provided in a toolkit named modutils or mod-utils.
Modules compiled for a specific version cannot be loaded by another version of the kernel if the CONFIG_MODVERSIONS option is enabled in the kernel. Currently, most releases enable this option.
If you are modifying the kernel and want to avoid overwriting the module you are working on, you should try using the variable EXTRAVERSION in the kernel Makefile to create a unique module directory.