Linux is made up of two parts: Kernel core + kernel module
The core name is usually Vmlinuz-version-release, and the module is placed in/lib/modules/version-release/
Once the system is up and running, the kernel will be loaded into memory to see the kernel basic information in operation.
uname [OPTION] ...
-r: Kernel release number
-N: Host name
Module information Acquisition and management
If you want to understand the modules that are loaded by the running kernel
Lsmod command #显示的信息来自于/proc/modules
Kernel module Details
Modinfo [-F field] [-K kernel] [modulename|filename ...]
-F field: Displays only the information for the specified field;
-N: Show file path;
-D: Show description
-P: Display module parameters
Kernel module loading and unloading
modprobe [-R] Module_name
Dynamic loading of modules: modprobe module_name #/etc/modprobe.conf pass parameters to modules
Dynamic Uninstall: Modprobe-r module_name
Module dependencies
/lib/modules/version-release/ The MOUDULES.DEP file in the directory has documented dependencies between modules, and this file is compiled into binary format (modules.dep.bin) for use, and can be regenerated using the Depmod command if the file is corrupted or missing (you can also generate/boot/ SYSTEM.MAP)
Loading and unloading kernel modules
Insmod command: insmod [filename] [module Options ...] Full path required for loading
Rmmod command: rmmod [module_name] unload only requires module name
This approach requires self-resolution of dependencies between modules
/proc Catalogue Introduction
PutKernel Configurable parametersInformation and currentRunning StateInformation via/proc pseudo file system
Kernel parameters: Writable, can accept the user to specify a "new value" to implement a function or feature of the kernel configuration, generally located in the/proc/sys, in addition to this other directory is read-only information
How to Modify Parameters: (1) sysctl command manages kernel parameters. (2) Echo redirect output to file
Run Status: Read Only, for informational display only. For example: This directory under the number named sub-directory is the current running process information
Kernel parameter tuning
(1) Sysctl command
Designed to view or set the values of the parameters in the/proc/sys directory;
sysctl [Options] [Variable[=value]]
View:
# sysctl-a All the kernel parameters that can be modified
# sysctl Variable
Modified: 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
Note: The settings above are only valid for the current running kernel and will not be permanently active, using the configuration file:/etc/sysctl.conf,/etc/sysctl.d/*.conf
and immediate effect of the way: Sysctl-p [/path/to/config_file]
Example:
Free–m viewing memory space consumed by the cache
/proc/sys/vm/drop_caches=1 Reclaim memory space for buffers and cache
/sys Catalogue Introduction
The kernel is used to output attributes that have been identified by the hardware device, as well as the configurable parameters of the kernel for hardware features, and some parameter modifications can be used to adjust the hardware device's operating characteristics.
Introduction to the/dev directory
This directory is used to output the device files according to the existing hardware device, but the kernel access device is directly through the driver, only when the user accesses the hardware device, only need to pass the device file, however, the kernel starts to detect the existing hardware information will not create a device file for it. So the 2.4 kernel is pre-created all the hardware of all the device files, later when the user space needs to use the hardware device to re-trigger the kernel probing hardware, and keep the information in the/sys directory, udev by reading this directory information, to create device files for existing devices.
The device file name that Udev creates is the driver file name, which can read its pre-defined rule file, typically in the/etc/udev/rules.d/directory and the/usr/lib/udev/rules.d/directory, to re-name the device file.
ramdisk file creation
(1) mkinitrd command
re-authoring the RAMDisk file for the currently in-use kernel, this command is also called Dracut:
# MKINITRD [OPTION ...] [<initrd-image>] <kernel-version>
--WITH=<MODULE>: Modules that need to be loaded into the INITRAMFS in addition to the default modules;
--preload=<module >:INITRAMFS module required for pre-loading modules;
Example: ~]# mkinitrd /boot/ initramfs-$ (UNAME-R) .img $ (uname-r)
(2) dracut command
# Dracut [OPTION ...] [<image> [<kernel Version>]
Example: ~]# dracut/boot/initramfs-$ (UNAME-R) .img $ (uname-r)
Linux kernel basic load uninstall