1_5.3.2_ Kernel configuration tailoring and boot process_ Kernel boot process analysis configuration_P

Publisher:数字驿站Latest update time:2021-08-20 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

insert image description here

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.

insert image description here

insert image description here

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)

insert image description here
insert image description here
insert image description here
insert image description here

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.

insert image description here

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

insert image description here

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.

insert image description here

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;

Reference address:1_5.3.2_ Kernel configuration tailoring and boot process_ Kernel boot process analysis configuration_P

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

About the configuration file Configuration Wizard of Keil MDK
One advantage of the startup code that comes with Keil MDK is the visual configuration option, which is the Configuration wizard option, which saves us from the problem of manually entering the configuration. For example, the following Configuration interface for Memory design:    The configuration program in t
[Microcontroller]
About the configuration file Configuration Wizard of Keil MDK
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components
Guess you like

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号