Linux kernel source code structure overview

  
 

The Linux kernel source code is located in the /usr/src/linux directory. The structure of the Linux kernel is shown in Figure 1.3. Each directory or subdirectory can be regarded as a module. The connection between the directories indicates the subdirectory. Or the relationship of sub-modules. Below is a brief description of each directory.


The include/subdirectory contains most of the include files needed to build the kernel code. This module uses other modules to rebuild the kernel.


The init/subdirectory contains the kernel initialization code, which is the starting point for the kernel to start working.


The arch/subdirectory contains all the hardware-specific kernel code, as shown in Figure 1.3, the i386 and alpha modules in the arch/subdirectory, and so on.


The drivers/directory contains all the device drivers in the kernel, such as block devices, scsi device drivers, and more.

The fs/directory contains code for all filesystems, such as ext2, vfat module code, and more.


The net/directory contains the kernel's networking code.


The mm/directory contains all the memory management code.


The ipc/directory contains code for interprocess communication.


The kernel/directory contains the main kernel code


Figure 1.3 shows eight directories, namely init, kernel, mm, ipc, drivers The include files for fs, arch and net are in the "include/" directory. The Linux kernel contains drivers, fs, arch and net modules, which makes the Linux kernel neither a hierarchical structure nor a microkernel structure, but a "holistic" structure. Because the system call can directly call the kernel layer, this structure makes the whole system have higher performance. The disadvantage is that the kernel is difficult to modify unless strict rules and coding standards are followed.


The module structure shown in Figure 1.3 represents a work distribution unit. With this structure, we expect Linus Torvalds to maintain and enhance the kernel's core services, ie, Init/, kernel/, mm/and ipc/, other modules drivers, fs, arch and net can also be used as working units. For example, a group of people can be assigned to maintain and further develop the block file system, while another group People perfect the scsi file system. Figure 1.3 is similar to the Linux volunteer development team working together to enhance and extend the framework of the entire system.

Copyright © Windows knowledge All Rights Reserved