In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
In this issue, the editor will bring you commands related to the linux kernel module: what is the instructions for the use of lsmod,depmod,modprobe,modinfo,insmod,rmmod? the article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.
Lsmod
Function: list the status of loaded modules in the kernel
Usage: lsmod
Description:
Lsmod lists the content of / proc/modules in a beautiful way.
The output is:
Module (module name) Size (module size) Used by Use)
Eg. Ne2k_pci 8928 0
8390 9472 1 ne2k_pci
The corresponding in / proc/modules is:
(module name, module size, by. Use, module address (guess, confirm later)
Ne2k_pci 8928 0-Live 0x3086400
8390 9472 1 ne2k_pci, Live 0xe086000
Depmod
Function: analyze the dependencies of loadable modules and generate modules.dep files and mapping files.
Usage: depmod [- b basedir] [- e] [- F System.map] [- n] [- v] [version] [- A]
Depmod [- e] [- F System.map] [- n] [- v] [version] [filename...]
Description:
The Linux kernel module can provide services to other modules (using EXPORT_SYMBOL in the code), which is called "symbols". If the second module uses this symbol, the module obviously depends on the first module. These dependencies are very complicated.
Depmod reads all the modules in the / lib/modules/version directory, checks the symbol exported by each module and the required symbol, and then creates a list of dependencies. By default, the list is written to the modules.dep file in the / lib/moudules / version directory. If the filename in the command is specified, only those specified modules are checked (not very useful).
If the version parameter is provided in the command, the dependency is generated using the directory specified by version instead of the current kernel version (returned by uname-r).
Options:
-b basedir-- basedir basedir if your module is not correctly under / lib/mdules/version, you can specify directory generation dependencies.
The-e-- errsyms is used with the-F option to report when the symbol required by one module is not provided in other modules. Normally, the symbol that the module does not provide is provided in the kernel.
-F-- filesyms System.map provides a System.map file (generated during kernel compilation) that allows the-e option to report unresolved symbol.
-n-- dry_run outputs the resulting modules.dep and various mapping files to standard output (stdout) instead of writing to the module directory.
-A-- quick checks whether any module is newer than the module in modues.dep, and if not, exits without regenerating the file.
Modprobe
Function: Linux kernel add and delete module
Usage:
Modprobe [- v] [- V] [- C config-file] [- n] [- I] [- Q] [- o modulename] [modulename] [module parameters...]
Modprobe [- r] [- v] [- n] [- I] [modulename...]
Modprobe [- l] [- t dirname] [wildcard]
Modprobe [- c]
Description:
Modprobe intelligently adds and removes Linux kernel modules ('_ 'and'-'are the same in the module name for simplicity). Modprobe looks at all modules and files in the module directory / lib/modules/'uname-r', except for the optional / etc/modprobe.conf configuration file and / etc/modprobe.d directory.
Modprobe requires an up-to-date modules.dep file that can be generated with depmod. This file lists the other modules required for each module, which modprobe uses to automatically add or remove module dependencies.
Options:
-v-- verbose shows what the program is doing, and modprobe usually displays information only when something goes wrong.
-C-- config overload (^ _ ^, meaning C++ overload) default configuration file (/ etc/modprobe.conf or / etc/modprobe.d).
-c-- showconfig exports the configuration file and exits
-n-- dry-run can be used with the-v option, debugging is very useful
-I-- ignore-install-- ignore-remove this option causes modprobe to ignore the install and remove commands entered on the command line in the configuration file.
-Q-- quiet generally when modprobe deletes or inserts a module, it will prompt an error if it is not found. Using this option, the specified module is ignored and no error message is prompted.
-r-- remove this option causes modprobe to delete instead of inserting a module. There is usually no reason to delete kernel modules, except for modules that have bug. Your kernel does not necessarily support module unloading.
-V-- verssion version information
-f-force is the same as using-- force-vermagic,-- force-modversion at the same time. It is dangerous to use this option.
-l-- list lists all modules
-a-- all inserts modules on all command lines
-t-- type forces-l to display modules in dirname
-s-- syslog error message is written to syslog
Modinfo
Function: display information about kernel modules
Usage:
Modinfo [- 0] [- F field] [modulename | filename...]
Modinfo-V
Modinfo-h
Description:
Modinfo lists information about the modules specified on the command line in the Linux kernel. If the module name is not a file name, it will be searched in the / lib/modules/version directory, just like modprobe.
Modinfo by default, each attribute of the module is listed in the following format for ease of reading: fieldname: value.
Options:
-V-- version version
-F-- field displays field values only on one line, which is useful for scripts. Commonly used field are: author, description, licence, param, depends, alias, filename.
-0-- NULL uses the'\ 0' character to separate field values instead of a new line. It's useful for scripts.
-a-d-l-p-n these are short forms of author, description, license, param, filename.
Insmod
Function: insert a module into the Linux kernel
Usage: insmod [filename] [modue options.]
Description:
Insmod is a Mini Program that inserts a module into the kernel: if the file name is a hyphen'-', the module enters it from standard input. Most users use modprobe because it is more intelligent.
Rmmod
Function: delete a module in the kernel
Usage: rmmod [- f] [- w] [- s] [- v] [modulename]
Description:
Rmmod is a Mini Program that removes modules from the kernel, and most users use modprobe-r to delete modules.
Options:
-v-- verbose shows what the program is doing and generally displays only the error message at execution time.
-f-- force this option is very dangerous: it won't work unless CONFIG_MODULE_FORCE_UNLOAD is set to work when the kernel is compiled. Use this option to delete modules that are in use, modules that are designed not to be deleted, or modules marked as unsafe.
-w-- wait in general, rmmod refuses to delete modules that are in use. After using this option, the specified module is isolated until it is not used.
-s-- syslog writes error information to syslog instead of standard error (stderr).
-V-- version version information
These are the commands related to the linux kernel module shared by the editor: what are the instructions for the use of lsmod,depmod,modprobe,modinfo,insmod,rmmod? if you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.