设为首页 加入收藏

TOP

UBOOT编译--- UBOOT编译过程目标依赖分析(八)(二)
2023-07-23 13:30:28 】 浏览:183
Tags:UBOOT 编译 --- 程目标 赖分析
.bin endif # Add optional build target if defined in board/cpu/soc headers ifneq ($(CONFIG_BUILD_TARGET),) //include/config/auto.conf中未定义 ALL-y += $(CONFIG_BUILD_TARGET:"%"=%) endif ifneq ($(CONFIG_SYS_INIT_SP_BSS_OFFSET),) //include/config/auto.conf中未定义 ALL-y += init_sp_bss_offset_check endif

$(ALL-y)目标除了第一行的通用目标外,其余的目标的定义都只有在特定平台下才成立,这里的注释只针对我当前使用的开发板。要特别注意的是上面的宏定义来源于include/config/auto.conf和include include/autoconf.mk(注意:-include include/config/auto.conf、include include/autoconf.mk这两句话),而上述头文件又来源于执行make pmyimx8mmek240-8mm-2g_defconfig时生成的 .config,详解参见前几篇文章UBOOT编译--- include/config/auto.conf、 include/config/auto.conf.cmd、 include/generated/autoconf.h (二)UBOOT编译--- include/config.h、 include/autoconf.mk、include/autoconf.mk.dep、u-boot.cfg(三)


综上:ALL-y 的定义汇总如下:

ALL-y += u-boot.srec u-boot.bin u-boot.sym System.map binary_size_check
ALL-y += spl/u-boot-spl.bin
ALL-y += u-boot.img
ALL-y += u-boot.dtb
ALL-y += u-boot-dtb.img
ALL-y += u-boot.elf  

4.1.1 目标u-boot.bin

ifeq ($(CONFIG_MULTI_DTB_FIT),y)//未定义

fit-dtb.blob: dts/dt.dtb FORCE
	$(call if_changed,mkimage)

MKIMAGEFLAGS_fit-dtb.blob = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
	-a 0 -e 0 -E \
	$(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) -d /dev/null

u-boot-fit-dtb.bin: u-boot-nodtb.bin fit-dtb.blob
	$(call if_changed,cat)

u-boot.bin: u-boot-fit-dtb.bin FORCE
	$(call if_changed,copy)
else ifeq ($(CONFIG_OF_SEPARATE),y)   //对DEVICE_TREE的支持(CONFIG_OF_SEPARATE)
u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE
	$(call if_changed,cat)

u-boot.bin: u-boot-dtb.bin FORCE
	$(call if_changed,copy)
else
u-boot.bin: u-boot-nodtb.bin FORCE
	$(call if_changed,copy)
endif

因为我们打开了DEVICE_TREE的支持,因此u-boot.bin的依赖关系如下:

u-boot-nodtb.bin: u-boot FORCE
	$(call if_changed,objcopy)
	$(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE))
	$(BOARD_SIZE_CHECK)
	
dts/dt.dtb: u-boot
	$(Q)$(MAKE) $(build)=dts dtbs
		
u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE
	$(call if_changed,cat)

u-boot.bin: u-boot-dtb.bin FORCE          //u-boot.bin
	$(call if_changed,copy)

可以看到u-boot.bin的依赖有u-boot-dtb.bin 和FORCE ,u-boot-dtb.bin 的依赖有u-boot-nodtb.bin和dts/dt.dtb:
(1)u-boot-nodtb.bin的依赖有u-boot 和 FORCE;
(2)dts/dt.dtb的依赖有u-boot


4.1.2 目标u-boot.srec、u-boot.sym、System.map

u-boot.hex u-boot.srec: u-boot FORCE
	$(call if_changed,objcopy)

......

u-boot.sym: u-boot FORCE
	$(call if_changed,sym)

......
	
System.map:	u-boot
		@$(call SYSTEM_MAP,$<) > $@

以上三个目标的依赖都是u-boot

4.1.3 目标binary_size_check

binary_size_check: u-boot-nodtb.bin FORCE
	@file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \
	map_size=$(shell cat u-boot.map | \
		awk '/_image_copy_start/ {start = $$1} /_image_binary_end/ {end = $$1} END {if (start != "" && end != "") print "ibase=16; " toupper(end) " - " toupper(start)}' \
		| sed 's/0X//g' \
		| bc); \
	if [ "" != "$$map_size" ]; then \
		if test $$map_size -ne $$file_size; then \
			echo "u-boot.map shows a binary size of $$map_size" >&2 ; \
			echo "  but u-boot-nodtb.bin shows $$file_size" >&2 ; \
			exit 1; \
		fi \
	fi

目标binary_size_check的依赖是u-boot-nodt

首页 上一页 1 2 3 4 5 6 7 下一页 尾页 2/7/7
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇UBOOT编译--- UBOOT的编译和链接.. 下一篇Cache的相关知识(二)

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目