Kernel and kernel modules: Depmod,lsmod,modinfo,insmod,rmmod,mdprobe

Source: Internet
Author: User

Kernel and kernel modules: Depmod,lsmod,modinfo,insmod,rmmod,mdprobe

First, we need to know where the kernel and kernel modules are placed. Kernel:/boot/vmlinuz or/boot/vmlinuz-version; kernel decompression required RAMDISK:/BOOT/INITRD (/boot/initrd-version); Kernel module:/lib/modules/  Version/kernel or/lib/modules/$ (uname-r)/kernel; Kernel Source:/usr/src/linux or/usr/src/kernels; If the kernel is loaded successfully, there are several information records: Kernel version:/proc/version system kernel function:/proc/sys/kernel If I have a new hardware, but my system does not support, to do this: recompile the kernel, and add the latest hardware driver source code   , compile the driver for the hardware into a module, and load the module at startup. Here we focus on the kernel module one, kernel modules and dependencies basically, the kernel module is placed in the/lib/modules/$ (uname-r)/kernel, several of the contents of the main: archhardware platform-related optionsCryptoCryptographic technologies supported by the kernelDriversSome hardware driversFsfile systems supported by the kernelLibsome function librariesNetNetwork-related protocol data, firewall modules, etc.Soundvarious modules related to sound effectsThere is also file/lib/modules/$ (uname-r)/MODULES.DEP, which records the dependencies of the modules supported by the kernel. So how do you create the file? As follows:#depmod [-ane]-A: When no parameters are added, Depmod will proactively parse the current kernel module and re-write to/lib/modules/$ (uname-r)/modules.dep.  If the-a parameter is added, it will look for a module that is newer than the MODULES.DEP, and if it is found, it will be updated.  -N: does not write to MODULES.DEP, but outputs the result to the screen.   -E: Displays the name of the module that is currently loaded that is not executable. Example: I'm doing a NIC driver A.ko (the kernel module name ends with. Ko), how do I update the kernel dependencies?#cp a.ko/lib/modules/$ (uname-r)/kernel/drivers/net#depmodSecond, view the kernel module to see how many modules are currently loaded in the module.#lsmodModule namethe size of the module whether this module is used by another moduleReview each module information#modinfo [-ADLN] [Module_name|filename]-A: List only the author name-D: Only the description of the modules-L: List only authorized-N: List only the detailed path of the module example: #modinfo mii three, kernel module loading and deletion best use modprobe this command to load the module, because Modprobe will actively  Find the contents of the MODULES.DEP and resolve the dependencies before deciding which modules to load. The insmod is completely user-loaded with a full file name module and does not actively analyze module dependencies.#insmod [/full/path/module_name] [parameters]Example: Try to load the Cifs.ko file system module#insmod/lib/modules/$ (uname-r)/kernel/fs/cifs/cifs.koRemember, it must be the full file name. #rmmod [-FW] module_name-F: Forces the module to be removed, whether or not it is in use-W: if the module is being used, then after the module is used and then removed Insmod and rmmod, you must find the full file name of the module yourself. Therefore, we generally use modprobe.#modprobe [-LCFR] module_name-C: Lists all modules on the current system-L: List all modules currently in/lib/modules/' Uname-r '/kernel full file name-F: Force load the module-r: Remove a module example: Loading a CIFS module#modprobe CIFSIt's convenient because we don't even have to know the full module file nameAdditional parameter configuration for kernel modules:/etc/modprobe.conf If you want to modify the additional parameter settings for some modules, it is within this file. #vi/etc/modprobe.conf

Kernel and kernel modules: Depmod,lsmod,modinfo,insmod,rmmod,mdprobe

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.