Home >System Tutorial >LINUX >In-depth analysis of the kernel source tree: the synergy between Kconfig files and Makefiles
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
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.
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.
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
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
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!