Home > System Tutorial > LINUX > In-depth analysis of the kernel source tree: the synergy between Kconfig files and Makefiles

In-depth analysis of the kernel source tree: the synergy between Kconfig files and Makefiles

王林
Release: 2024-06-28 08:18:52
Original
1115 people have browsed it

深入解析内核源码树:Kconfig 文件与 Makefile 的协同作用

Principle

Each directory in the kernel source tree also contains a Kconfig file, which is used to describe the kernel configuration menu related to the source code in the directory. The Kconfig files in each directory constitute a distributed kernel configuration database.

When configuring the kernel through the makemenuconfig command, read the menu from the Kconfig file Analysis of storage technology principle: Based on the Linux 26 kernel source code , the configuration is completed and saved to the kernel configuration file named .config for the Makefile to compile used in the kernel.

The Makefile on the top floor of the source code directory tree is the entrance to the entire kernel source code management and plays a decisive role in the source code compilation of the entire kernel. When compiling the kernel in linux c, the top-floor Makefile will recursively traverse the Makefile files in all subdirectories of the kernel source code according to the rules to complete the compilation of the kernel modules in each subdirectory.

Configure the kernel

Go to the directory on the top floor of the Linux kernel source code and enter the makemenuconfig command Baidu Netdisk LINUX to enter the main Linux kernel configuration interface based on Ncurses. If ARCH is not specified in the Makefile, it must be specified in the command line:

make ARCH<span class="token operator">=</span>arm menuconfig
Copy after login

First level directory

Almost every item under the first-level menu has complex lower-level submenus, and their respective configuration options are also very rich. It would be a very complicated task to describe them one by one. In actual product development, it is not necessary to fully understand every configuration item of the kernel. Generally, you only need to understand some of the related items.

内核编写_存储技术原理分析:基于linux 26内核源代码_内核存储原理源基于代码分析

在这里插入图片描述

The secondary directory Generalsetup is the kernel general settings menu interface

在这里插入图片描述

SystemVIPC represents the system’s inter-process communication InterProcess

Communication, which is used by the processor to synchronize and exchange information between programs

Enableeventpollsupport: Supports the system call of storm polling.

Enableloadablemodulesupport is the kernel module configuration

Moduleunloading allows unloading already loaded modules

Moduleversioningsupport allows the use of modules from other kernel versions (problems may occur)

Sourcechecksumforallmodules calibrates the source code for all modules. If you do not compile the kernel module yourself, you do not need this function.

内核编写_内核存储原理源基于代码分析_存储技术原理分析:基于linux 26内核源代码

Enabletheblocklayer block device support

Those who use hard disk/USB/SCSI devices must select this option to enable the block device to be removed from the kernel:

Supportforlarge(2TB+)blockdevicesandfiles is only required when using block devices smaller than 2TB

Blocklayerbiothrottlingsupport can be used to limit the IO rate of the device

IOSchedulersIO scheduler I/O is input and output bandwidth control, mainly for hard disks, and is a core necessity. Three IO schedulers are provided here.

SystemType is the processor type and characteristics

Symmetricmulti-processingsupportSymmetric multi-processing support, select it if you have multiple CPUs or are using a multi-core CPU

Processorfamily (Pentium-Pro) processor series, please choose according to the actual CPU used, here is the type of processor

Genericx86support This option uses more general optimizations for x86 series CPUs. If you choose i386, i586 or the like in one of the options, choose this universal x86 support,

Multi-coreschedulersupport optimizes the scheduling strategy for multi-core CPUs. Multi-core scheduling mechanism support, four-core CPUs should be selected

Busoptions is the support and configuration of PCI, ISA and other buses. KernelFeatures is the kernel feature configuration menu

内核存储原理源基于代码分析_存储技术原理分析:基于linux 26内核源代码_内核编写

在这里插入图片描述

Bootoption startup option, you can set the default startup parameters and kernel parameter types

CPUPowerManagementCPU power management related

Including processor frequency reduction, sleep mode support, etc.

Powermanagementoptions Power management related Networkingsupport network configuration

Includes support configuration options for Ethernet, CAN, infrared, Bluetooth, wireless and other networks

Wireless uses wireless network card support

RFswitchsubsystemsupportRF switching device

Networkingoptions network contract and network packet parameter configuration (TCP/IP related contracts must be opened)

Networkingoptions, you can enter the network option configuration interface

在这里插入图片描述

Systems using Linux will use the network, and using the network is often inseparable from TCP/TP, so it is recommended to select the TCP/IP option in the configuration Storage technology principle analysis: Based on the Linux 26 kernel source code, and Select all lower-level options. The tri-state option can also be configured to plug in the module when needed.

DriverDrivers device driver, the configuration interface is also very complicated, there are many configuration items

在这里插入图片描述

Filesystems is the kernel file system configuration interface

内核存储原理源基于代码分析_内核编写_存储技术原理分析:基于linux 26内核源代码

在这里插入图片描述

Kernelhacking Kernel debugging related SecurityoptionsSecurity related options

CryptographicAPI—>//Crypto API, these options will be manually adjusted according to previous optimization

Basic principles for tailoring and configuring kernels

Reference:

The specific process and selection of Linux kernel pruning

Discussion on embedded Linux kernel configuration, tailoring and compilation

Linux kernel compilation configuration (Menuconfig graphical form), steps to create file system

Linux kernel transplantation and root file system production

The above is the detailed content of In-depth analysis of the kernel source tree: the synergy between Kconfig files and Makefiles. For more information, please follow other related articles on the PHP Chinese website!

source:itcool.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template