In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of "how Linux manages the kernel module". The editor shows you the operation process through the actual case. The operation method is simple, fast and practical. I hope this article "how Linux manages the kernel module" can help you solve the problem.
Modular Design of Linux Kernel
1. Linux kernel design: single kernel, modularization (dynamic loading and unloading)
(1) Linux: single kernel design, but fully draws lessons from the advantages of the design of micro-kernel system; introduces a modular mechanism for the kernel.
(2) components of the kernel: kernel: kernel core, usually in bzImage format, usually located in the / boot directory, named vmlinuz-VERSION-release;, this file is no longer used when the system is started, because it has been loaded into memory and placed under / boot to facilitate the management of kernel object: kernel modules, generally placed in / lib/modules/VERSION-release/ kernel modules must strictly match the kernel version
two。 Kernel modules: compilation selection mode
[]: n, does not compile this part [M]: Module, compiles with modularization, can be temporarily loaded, takes up disk space, does not take up kernel space [*]: y, compiles into the kernel core, and can be directly called
3.ramdisk: auxiliary files, not required, depending on whether the kernel can directly drive the device on which the rootfs is located
Ramdisk: a paperback version of the root file system that provides the following drivers: target device drivers, such as SCSI device drivers, logical device drivers, such as LVM device drivers, and file systems, such as xfs file system
Kernel module information acquisition and management commands
1.ldd: print the library files that binary applications depend on-print shared library dependencies
Format: ldd [OPTION] FILE
Display:
\ 1) dependent library file name = > dependent library file path (corresponding to memory loading symbolic link mapping)
\ 2) the entry of the entire system call library
Linux-vdso.so.1 = > (0x00007fff293fe000) / lib64/ld-linux-x86-64.so.2 (0x00007f0228073000)
2.uname: kernel information acquisition-print system information
Format: uname [OPTION]... Uname-a: displays all the information about the kernel uname-v: the compiled version number of the kernel uname-r: the release release number of the kernel uname-n: hostname
3.lsmod: list kernel modules
The kernel displayed comes from the / proc/modules module name, size, number of times referenced, and by what reference
4.modinfo command: displays the details of the specified module
Format: modinfo [- F field] [- k kernel] [modulename | filename...] -k kernel: to query module information on another kernel when multiple cores coexist-F field: display only the information of the specified fields;-n: display the file path; display the relevant information by reading the original data of the / lib/modules/#/* file
Display content: file name, protocol, description, author, alias, RHEL version number, dependent module, signature unit, signature, encryption algorithm
5.modprobe: loads and unloads modules, and mounts dependent modules
Format: dynamic loading of modprobe [- r] module_name modules: dynamic unloading of modprobe module_name: modprobe-r module_name Note: modules loaded by default should not be unloaded at will
6. DepmodRu-Generate modules.dep and map files
A tool for generating kernel module dependency relationship files and system information mapping files
7.insmod, rmmod: module loading and unloading, which cannot automatically resolve module dependencies
Insmod [filename] [module options...] Filename: file path of module file; rmmod [module_name]
Management of ramdisk files
1.mkinitrd (CentOS 5): recreate the ramdisk file for the kernel currently in use
# mkinitrd [OPTION...] []-with=: needs to be loaded into initramfs in addition to default modules; modules provided by-preload=:initramfs need preloaded modules; example: ~] # mkinitrd / boot/initramfs- (uname-r)
2.dracut (CentOS 6amp 7, compatible with 5):-low-level tool for generating an initramfs image
# dracut [OPTION...] [[]] example: ~] # dracut / boot/initramfs- (uname-r)
Kernel information output pseudo file system
1./proc: output interface for kernel status and statistics; also provides a configuration interface, / proc/sys
(1) Parameter: read-only: information output; for example, information related to / proc/#/, process
Writable: it is acceptable for users to specify a "new value" to configure a kernel function or feature; / proc/sys/ format: / proc/sys: net/ipv4/ip_forward is equivalent to net.ipv4.ip_forward
(2) modify the parameter mode
\ 1) the sysctl command is designed to view or set the value of the parameter in the / proc/sys directory; sysctl [options] [variable [= value]] View: # sysctl-a variable=value # sysctl variable modify its value: # sysctl-w variable=value
\ 2) File system commands (cat, echo) View: # cat / proc/sys/PATH/TO/SOME_KERNEL_FILE Settings: # echo "VALUE" > / proc/sys/PATH/TO/SOME_KERNEL_FILE
\ 3) configuration file: / etc/sysctl.conf, / etc/sysctl.d/.conf takes effect immediately: sysctl-p [/ PATH/TO/CONFIG_FILE]
(3) important kernel parameters net.ipv4.ip_forward: core forwarding; vm.drop_caches: kernel.hostname: hostname; net.ipv4.icmp_echo_ignore_all: ignore all ping operations
2./sys directory: introduced after Kernel 2.6
Sys file system: outputs the relevant attribute information of each hardware device identified by the kernel, as well as the parameters that can be set by the kernel to the hardware characteristics. By modifying these parameters, the working characteristics of the hardware device can be customized.
Udev: create device files for hardware devices on demand by reading the hardware device information in the / sys directory; udev is a user space program; special tools: devadmin, when hotplug; udev creates device files for devices, the pre-defined rule files are generally read in the / etc/udev/rules.d/ directory and / usr/lib/udev/rules.d/ directory.
This is the end of the introduction to "how Linux manages the kernel module". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
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.