1
We want to add a program (such as a driver) to the kernel and ensure that this driver can be compiled into the kernel, which is fundamentally divided into two main parts. First, we need to tell the kernel, “Please include me in the next compilation,” which requires us to configure the kernel appropriately. This involves modifying the related Makefile and Kconfig files to let the kernel know that it will compile this new driver. However, simply telling the kernel, “I need you to compile me” is not enough; it is more important to make the kernel actually take action, that is, to compile the kernel.
2
The Makefile collection is a set of compilation commands for the entire kernel project. It constructs a list of kernel source files to be compiled based on the configuration, compiles them separately, and links the target code together to form the kernel binary file. In other words, the Makefile merely stores the rules for building target files from source files; whether these rules are executed depends on those configuration variables.
3
When we run make menuconfig, a configuration menu appears, which is composed of various Kconfig files at different levels. The Kconfig files are distributed across various subdirectories of the source code. The lowest-level Kconfig is located in the source directory under arch/x86/Kconfig. From this entry point, the source statement includes the necessary sub-Kconfig files into the parent directory’s Kconfig, recursively. The Kconfig files control whether new driver configuration options appear in the configuration menu. Users generate configuration options through the Kconfig files to control the configuration of the new driver.
4
The relevant configurations we make in the configuration menu (【】, 【*】, 【M】) will ultimately be stored in the .config file. Therefore, the Kconfig files do not have a direct relationship with these configuration results; they merely provide configuration options in the configuration menu.