imx6ull:uboot的make xxx_defconfig 过程分析
相关代码
414 # To make sure we do not include .config for any of the *config targets 415 # catch them early, and hand them over to scripts/kconfig/Makefile 416 # It is allowed to specify more targets when calling make, including 417 # mixing *config targets and build targets. 418 # For example 'make oldconfig all'. 419 # Detect when mixed targets is specified, and make a second invocation 420 # of make so .config is not included in this case either (for *config). 421 422 version_h := include/generated/version_autogenerated.h 423 timestamp_h := include/generated/timestamp_autogenerated.h 424 425 no-dot-config-targets := clean clobber mrproper distclean \ 426 help %docs check% coccicheck \ 427 ubootversion backup 428 429 config-targets := 0 430 mixed-targets := 0 431 dot-config := 1 432 433 ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) 434 ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) 435 dot-config := 0 436 endif 437 endif 438 439 ifeq ($(KBUILD_EXTMOD),) 440 ifneq ($(filter config %config,$(MAKECMDGOALS)),) 441 config-targets := 1 442 ifneq ($(words $(MAKECMDGOALS)),1) 443 mixed-targets := 1 444 endif 445 endif 446 endif 447 448 ifeq ($(mixed-targets),1) 449 # ================================================================ 450 # We're called with mixed targets (*config and build targets). 451 # Handle them one by one. 452 453 PHONY += $(MAKECMDGOALS) __build_one_by_one 454 455 $(filter-out __build_one_by_one, $(MAKECMDGOALS)): __build_one_by_one 456 @: 457 458 __build_one_by_one: 459 $(Q)set -e; \ 460 for i in $(MAKECMDGOALS); do \ 461 $(MAKE) -f $(srctree)/Makefile $$i; \ 462 done 463 464 else 465 ifeq ($(config-targets),1) 466 # ================================================================ 467 # *config targets only - make sure prerequisites are updated, and descend 468 # in scripts/kconfig to make the *config target 469 470 KBUILD_DEFCONFIG := sandbox_defconfig 471 export KBUILD_DEFCONFIG KBUILD_KCONFIG 472 473 config: scripts_basic outputmakefile FORCE 474 $(Q)$(MAKE) $(build)=scripts/kconfig $@ 475 476 %config: scripts_basic outputmakefile FORCE 477 $(Q)$(MAKE) $(build)=scripts/kconfig $@ 478 479 else 480 #================================================================== 481 # Build targets only - this includes vmlinux, arch specific targets, clean 482 # targets and others. In general all targets except *config targets. 483 484 ifeq ($(dot-config),1) 485 # Read in config 486 -include include/config/auto.conf ......
- 第 422 行定义了变量 version_h,这变量保存版本号文件,此文件是自动生成的。其中的内容为
- 第 423 行定义了变量 timestamp_h,此变量保存时间戳文件,此文件也是自动生成的。其中的内容为
- 第 433 行将 MAKECMDGOALS 中不符合 no-dot-config-targets 的部分过滤掉,剩下的如果不为空的话条件就成立。MAKECMDGOALS 是 make 的一个环境变量,这个变量会保存你所指定的终极目标列表,比如执行“make mx6ull_alientek_emmc_defconfig”,那么 MAKECMDGOALS就为 mx6ull_alientek_emmc_defconfig。很明显过滤后为空,所以条件不成立,变量 dot-config 依旧为 1
- 第439行判断KBUILD_EXTMOD是否为空,如果KBUILD_EXTMOD为空的话条件成立,我们没有使用模块编译所以 KBUILD_EXTMOD 为空,条件成立
- 第 440 行将 MAKECMDGOALS 中不符合“config”和“%config”的部分过滤掉,如果剩下的部分不为空条件就成立,很明显此处条件成立,变量 config-targets=1
- 第 442 行统计 MAKECMDGOALS 中的单词个数,如果不为 1 的话条件成立。
此处调用Makefile 中的 words 函数来统计单词个数,words 函数格式如下:
$(words <text>)
很明显,MAKECMDGOALS 的单词个数是 1 个,所以条件不成立,mixed-targets 继续为0- 到这里,这些变量值如下:
config-targets = 1
mixed-targets = 0
dot-config = 1- 第 448 行如果变量 mixed-targets 为 1 的话条件成立,很明显,条件不成立
- 第 465 行如果变量 config-targets 为 1 的话条件成立,很明显,条件成立
- 第 473 行,没有目标与之匹配,所以不执行
- 第 476 行,有目标与之匹配,当输入“make xxx_defconfig”的时候就会匹配到%config 目标
make xxx_defconfig的目标和依赖
当输入“make xxx_defconfig”的时候就会匹配到%config 目标,目标“%config”依赖于 scripts_basic、outputmakefile 和 FORCE
FORCE 在顶层 Makefile的 1610 行有如下定义
1610 PHONY += FORCE 1611 FORCE:
可以看出 FORCE 是没有规则和依赖的,所以每次都会重新生成 FORCE。当 FORCE 作为其他目标的依赖时,由于 FORCE 总是被更新过的,因此依赖所在的规则总是会执行的
scripts_basic 和 outputmakefile 在顶层 Makefile 中的内容如下
394 # Basic helpers built in scripts/ 395 PHONY += scripts_basic 396 scripts_basic: 397 $(Q)$(MAKE) $(build)=scripts/basic 398 $(Q)rm -f .tmp_quiet_recordmcount 399 400 # To avoid any implicit rule to kick in, define an empty command. 401 scripts/basic/%: scripts_basic ; 402 403 PHONY += outputmakefile 404 # outputmakefile generates a Makefile in the output directory, if 405 # using a separate output directory. This allows convenient use of 406 # make in the output directory. 407 outputmakefile: 408 ifneq ($(KBUILD_SRC),) 409 $(Q)ln -fsn $(srctree) source 410 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ 411 $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) 412 endif
- 第 396~398 行是 scripts_basic 的规则,其对应的命令用到了变量 Q、MAKE 和 build,其中:Q=@或为空,MAKE=make,变量 build 是在 scripts/Kbuild.include 文件中有定义,定义如下
177 ### 178 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= 179 # Usage: 180 # $(Q)$(MAKE) $(build)=dir 181 build := -f $(srctree)/scripts/Makefile.build obj
可以看出 build=-f $(srctree)/scripts/Makefile.build obj,经过前面的分析可知,变量 srctree 为”.”,因此:build=-f ./scripts/Makefile.build obj
scripts_basic 展开以后如下:scripts_basic: @make -f ./scripts/Makefile.build obj=scripts/basic //也可以没有@,视配置而定 @rm -f . tmp_quiet_recordmcount //也可以没有@
参考:imx6ull:uboot的Makefile.build脚本分析的scripts_basic目标对应的命令
第 408 行,判断 KBUILD_SRC 是否为空,只有变量 KBUILD_SRC 不为空的时候outputmakefile 才有意义,经过我们前面的分析 KBUILD_SRC 为空,所以 outputmakefile 无效。
make xxx_defconfig的命令
%config: scripts_basic outputmakefile FORCE $(Q)$(MAKE) $(build)=scripts/kconfig $@
将命令展开就是:
@make -f ./scripts/Makefile.build obj=scripts/kconfig xxx_defconfig参考:imx6ull:uboot的Makefile.build脚本分析的%config目标对应的命令
imx6ull:uboot的make xxx_defconfig 过程分析相关推荐
- imx6ull:uboot顶层Makefile分析
版本号 MAKEFLAGES变量 20 MAKEFLAGS += -rR --include-dir=$(CURDIR) Makefile有两个特殊的变量:"SHELL"和&quo ...
- imx6ull uboot nfs Loading* done异常
imx6ull uboot nfs Loading* done异常 uboot nfs加载内核zImage 失败,直接done,我使用的开发板是正点原子的阿尔法. 找了很多文章,基本都试过,反而还出现 ...
- 【uboot】imx6ull uboot移植LAN8720A网卡驱动
文章目录 相关文章 1. 前言 2. IMX6ULL Ethernet LAN8720A硬件连接 3. 支持LAN8720A修改步骤 4. 验证测试 问题1:如何确定LAN8720A网卡PHYAD地址 ...
- imx6ull u-boot 下载/编译/烧写/运行
下载NXP官方提供的u-boot源码 链接: https://pan.baidu.com/s/1VCzTiGSwJTFtg0D_eHXpPw 密码: 7aas 编译u-boot 进入源码目录新建编译脚 ...
- imx6ull uboot
1.uboot 移植的一般流程: ①.在 uboot 中找到参考的开发平台,一般是原厂的开发板. ②.参考原厂开发板移植 uboot 到我们所使用的开发板上. 2.在移植之前,我们先编译一下 NXP ...
- IMX6ULL UBOOT移植-3LCD分辨率修改
由于版本不一样,正点原子手册在mx6ull_ycy.c中代码无法找到,不能在此处修改. 根据网上其他文档找到修改文件在imx6ul-14x14-evk.dtsi中 vim arch/arm/dts/i ...
- IMX6ULL u-boot 2020.04 移植LAN8720A(网卡)
1.修改设备树arch/arm/dts/imx6ul-14x14-evk.dtsi 修改后 &fec1 {pinctrl-names = "default";pinctrl ...
- 【uboot】uboot 2020.04 DM驱动模式 -- Demo体验
文章目录 1. 前言 2. uboot的驱动模型简介 3. U_BOOT_CMD(do_demo)分析 4. 执行命令demo list 5. 执行命令demo hello 6. 执行命令demo l ...
- NXP IMX6ULL的官方文档、官方BSP、交叉编译工具链下载
目录 1 官网下载BSP以及相关文档 1.1 文档下载 1.2 NXP 官方uboot和kernel源码下载 1.3 官方评估板硬件资料下载 1.4 官方BSP下载 2 官网SDK下载 3 交叉编译工 ...
最新文章
- 谈谈 Docker 网络
- 声明及赋值_重述《Effective C++》二——构造、析构、赋值运算
- HDU - 5572 An Easy Physics Problem(几何-碰撞问题)
- cvRemap 对图像进行普通几何变换
- 总投资200亿,中国第五座航天发射中心来了!为何选址在宁波?
- android 自定义 打包文件类型,Android设置apk打包文件名报错
- 56 - I. 数组中数字出现的次数
- MIT科学家正在教AI感受电影中的喜怒哀乐
- 博客侧栏添加恋爱计时框
- JavaWeb一些常用操作
- 终端terminal个性化配置
- Linux入门学习教程:在Ubuntu 14.04中安装使用搜狗拼音输入法
- MySQL函数 思维导图
- 惠普1139一体打印机如何联网打印_惠普1139 惠普1139打印扫描一体机功能
- python字符串转负数_python 字符串 步进 负数
- Unity 常见英文单词
- 小米红米手机通用解锁教程|红米Note8 Pro解锁教程,获取解锁码一键解锁BL的方法
- 上半年精选300篇Python文章,推荐你收藏~
- RuoYi框架放行vue和某些公开接口
- 23岁那年你正处在哪个状态?现在呢?