Configuration result: A .config file is generated.
Take the configuration item CONFIG_DM9000 as an example.
Use vim to open .config and search for DM9000. You can see CONFIG_DM9000=y, which means DM9000 will be linked and compiled into the kernel when compiling the kernel.
Some parameters are equal to m, which means that after compilation, they are treated as modules and are not compiled into the kernel, but the module can be loaded dynamically.
Use the grep "CONFIG_DM9000" * -nwR command to search for CONFIG_DM9000 in all files.
As you can see, CONFIG_DM9000 can be searched in the following four places.
C source code: CONFIG_DM9000 (mainly macros, defined in the autoconf.h file)
Subdirectory Makefile: drivers/net/Makefile
include/config/auto.conf
include/linux/autoconf.h (as can be seen from the file name, it is automatically generated based on some commands and .config)
Looking at autoconf.h, I found that in autoconf.h, whether it is positioned as y or m, it is defined as 1 in the file.
So where is the difference between y and m?
A: It is reflected in the Makefile of the subdirectory. As mentioned before, y will be linked into the kernel, and m will only generate a module, which will be dynamically loaded when needed. In other words, both y and m will be compiled, but one will be linked and the other will only generate a module and not be linked.
Check the Makefile in the subdirectory and you can see an obj-$(CONFIG_DM9000) += dm9dev9000c.o
First, let me explain obj. If there are the following two statements in the Makefile of the subdirectory, then:
obj-y += xxx.o, which means it will be compiled into the kernel in the end;
obj-m += yyy.o, which means that yyy.c will be compiled into a loadable module yyy.ko;
That is to say, when CONFIG_DM9000 = y, dm9dev9000c.c will be compiled into the kernel; when CONFIG_DM9000 = m, dm9dev9000.c will be compiled as a loadable module.
So, where does this CONFIG_DM9000 come from? It comes from auto.conf.
Check auto.conf, search for DM9000, and find CONFIG_DM9000=y in this file. So where does this y come from? Answer: It also comes from .config.
Obviously, for this auto.conf to work, it must be included by other files, so what files include it?
Answer: It is included by the top-level Makefile. The top-level Makefile includes this file, and also includes the Makefiles of other subdirectories. In this way, the Makefiles of other subdirectories and the auto.conf file are connected.
So, when making uImage:
According to the .config file, autoconf.h is generated. This file is used in the source code to determine whether to compile;
Based on the .config file, an auto.conf file is also generated. This file is used in the Makefile to decide whether to link;
Previous article:1_5.3.1_Kernel configuration tailoring and boot process_Compilation of kernel boot process analysis
Next article:1_5.3.3_ Kernel configuration tailoring and boot process_ Kernel boot process analysis Makefile_P
Recommended ReadingLatest update time:2024-11-16 14:45
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications