make xxx_deconfig过程

news/2024/5/20 7:50:14

在uboot中,所写的shell脚本:mx6ull_alientek_emmc.sh的内容如下:

#!/bin/bash
  2 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean
  3 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mx6ull_14x14_ddr512_emmc_defconfig
  4 make V=1 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j12

首先是清理工程
其次就是make mx6ull_14x14_ddr512_emmc_defconfig
最后就是编译

在编译uboot之前要使用“make xxx_deconfig”命令来配置值uboot,顶层Makefile中有如下代码:

# To make sure we do not include .config for any of the *config targets
# catch them early, and hand them over to scripts/kconfig/Makefile
# It is allowed to specify more targets when calling make, including
# mixing *config targets and build targets.
# For example 'make oldconfig all'.
# Detect when mixed targets is specified, and make a second invocation
# of make so .config is not included in this case either (for *config).

version_h := include/generated/version_autogenerated.h
timestamp_h := include/generated/timestamp_autogenerated.h

no-dot-config-targets := clean clobber mrproper distclean \
			 help %docs check% coccicheck \
			 ubootversion backup

config-targets := 0
mixed-targets  := 0
dot-config     := 1

ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
	ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
		dot-config := 0
	endif
endif

ifeq ($(KBUILD_EXTMOD),)
        ifneq ($(filter config %config,$(MAKECMDGOALS)),)
                config-targets := 1
                ifneq ($(words $(MAKECMDGOALS)),1)
                        mixed-targets := 1
                endif
        endif
endif

ifeq ($(mixed-targets),1)
# ===========================================================================
# We're called with mixed targets (*config and build targets).
# Handle them one by one.

PHONY += $(MAKECMDGOALS) __build_one_by_one

$(filter-out __build_one_by_one, $(MAKECMDGOALS)): __build_one_by_one
	@:

__build_one_by_one:
	$(Q)set -e; \
	for i in $(MAKECMDGOALS); do \
		$(MAKE) -f $(srctree)/Makefile $$i; \
	done

else
ifeq ($(config-targets),1)
# ===========================================================================
# *config targets only - make sure prerequisites are updated, and descend
# in scripts/kconfig to make the *config target

KBUILD_DEFCONFIG := sandbox_defconfig
export KBUILD_DEFCONFIG KBUILD_KCONFIG

config: scripts_basic outputmakefile FORCE
	$(Q)$(MAKE) $(build)=scripts/kconfig $@

%config: scripts_basic outputmakefile FORCE
	$(Q)$(MAKE) $(build)=scripts/kconfig $@

else
# ===========================================================================
# Build targets only - this includes vmlinux, arch specific targets, clean
# targets and others. In general all targets except *config targets.

ifeq ($(dot-config),1)
# Read in config
-include include/config/auto.conf
  • 定义了变量version_h,此变量保存版本号文件,此文件是自动生成的。
  • timestamp_h保存时间戳文件,此文件也是自动生成的。
  • 将MAKECMDGOALS中不符合no-dot-config-targets的部分过滤掉,剩下的如果不为空的话就条件成立。MAKECMDGOALS是make的一个环境变量,会保存指定的终极目标列表,比如执行“make mx6ull_alientek_emmc_defconfig”,那么 MAKECMDGOALS就为 mx6ull_alientek_emmc_defconfig。很明显过滤后为空,所以条件不成立,变量dot-config依旧为1。
config: scripts_basic outputmakefile FORCE
	$(Q)$(MAKE) $(build)=scripts/kconfig $@

%config: scripts_basic outputmakefile FORCE
	$(Q)$(MAKE) $(build)=scripts/kconfig $@

有目标与之匹配,当输入“make xxx_defconfig”的时候就会匹配到%config目标,目标“%config”依赖于scripts_basic、outputmakefile、FORCE。

FORCE在顶层Makefile的1610行有如下定义

PHONY += FORCE
FORCE:

可以看出FORCE是没有规则和依赖的,所以每次都会重新生成FORCE。
当FORCE作为其它目标的依赖时,由于FORCE总是被更新过的,所以依赖所在的规则总是会执行的。
outputmakefile 无效,只有 scripts_basic 是有效的。

Q=@或为空
MAKE=make

变量build是在scripts/Kbuild.include 文件中有定义

###
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
# Usage:
# $(Q)$(MAKE) $(build)=dir
build := -f $(srctree)/scripts/Makefile.build obj

build =-f ./scripts/Makefile.build obj

scripts_basic展开后

scripts_basic:
@make -f ./scripts/Makefile.build obj=scripts/basic //也可以没有@,视配置而定
@rm -f . tmp_quiet_recordmcount //也可以没有@

所以最后

%config: scripts_basic outputmakefile FORCE
$(Q)$(MAKE) $(build)=scripts/kconfig $@

展开为:

@make -f ./scripts/Makefile.build obj=scripts/kconfig xxx_defconfig

配置uboot的过程

make mx6ull_14x14_ddr512_emmc_defconfig V=1

在这里插入图片描述
scripts/Makfile.build中
scripts_basic 目标对应的命令

@make -f ./scripts/Makefile.build obj=scripts/basic

%config 目标对应的命令

@make -f ./scripts/Makefile.build obj=scripts/kconfig xxx_defconfig

http://www.niftyadmin.cn/n/393968.html

相关文章

TextBlob怎么用的?有哪些具体使用场景呢?

TextBlob是一个Python库,提供了简单而直观的API,用于进行文本处理任务,如文本情感分析、词性标注、文本翻译等。 要使用TextBlob,首先需要安装该库。可以使用pip命令进行安装: pip install textblob 安装完成后&…

[数据结构习题]队列——用栈实现队列

[数据结构习题]队列——用栈实现队列 👉知识点导航💎:【数据结构】栈和队列 👉[王道数据结构]习题导航💎: p a g e 85.3 page85.3 page85.3 本节为栈和队列的综合练习题 题目描述: &#x1f…

Linux 实操篇-RPM 与YUM

Linux 实操篇-RPM 与YUM rpm 包的管理 介绍 rpm 用于互联网下载包的打包及安装工具,它包含在某些Linux 分发版中。它生成具有.RPM 扩展名的文件。RPM是RedHat Package Manager(RedHat 软件包管理工具)的缩写,类似windows 的set…

INTJ型人格适合选择哪些专业?

INTJ型人格是一种理性、独立、逻辑性强的人格类型,他们通常在思考问题时会非常深入,而且对于目标的追求非常明确。 INTJ型人格的人通常在职业发展中追求自我提升和成长,他们善于分析问题、制定计划和实现目标,具有很强的自我意识…

【JUC基础】14. ThreadLocal

目录 1、前言 2、什么是ThreadLocal 3、ThreadLocal作用 4、ThradLocal基本使用 4.1、创建和初始化 4.2、存储和获取线程变量 4.3、清理和释放线程变量 4.4、小结 4.5、示例代码 5、ThreadLocal原理 5.1、set() 5.2、get() 5.3、变量清理 5.4、ThreadLocalMap 6、…

CXGRid实现拖动鼠标多选

要实现在CXGrid中拖动鼠标多选,您可以按住鼠标左键并拖动鼠标,直到选择了要选择的单元格或行。您可以在拖动过程中按住Shift键来限制选择范围。拖动选择的单元格或行时,您可以按住Ctrl键来添加或删除单元格或行的选择。当您完成选择时&#x…

C++并发线程 - 如何管控线程【启动/暂停/停止/恢复】

系列文章目录 C高性能优化编程系列 深入理解软件架构设计系列 高级C并发线程系列 深入理解设计模式系列 超越昨天的自己 Keeps going beyond yesterdays own 线程管控 系列文章目录1、线程最基本的使用 - 简单管控2、如何将参数传递给线程3、线程归属权居然是可以转移的4、通…

华为OD机试真题 Java 实现【租车骑绿道】【2023Q1 100分】

一、题目描述 部门组织绿岛骑行团建活动,租用公共双人自行车骑行,每辆自行车最多坐两人、最大载重 M。 给出部门每个人的体重,请问最多需要租用多少双人自行车。 二、输入描述 第一行两个数字 m、n,自行车限重 m,代…