日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

[ATF]-ATF makefile的导读

發布時間:2025/3/21 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 [ATF]-ATF makefile的导读 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

快速鏈接:
.
👉👉👉 個人博客筆記導讀目錄(全部) 👈👈👈

根據BLx_SOURCE是否定義,來選擇編譯的鏡像. BLx_SOURCE的第一次定義一般在plat/xxx/platform.mk

ifdef BL1_SOURCES NEED_BL1 := yes include bl1/bl1.mk endififdef BL2_SOURCES NEED_BL2 := yes include bl2/bl2.mk endififdef BL2U_SOURCES NEED_BL2U := yes include bl2u/bl2u.mk endififdef BL31_SOURCES # When booting an EL3 payload, there is no need to compile the BL31 image nor # put it in the FIP. ifndef EL3_PAYLOAD_BASE NEED_BL31 := yes include bl31/bl31.mk endif endif

這里是平臺的定義,選擇哪一個SPD(secure payload dispatcher)
即當敲擊make -C $DIRPATH RESET_TO_BL31=1 PLAT=xxx all,傳過來的PLAT值

ifeq (${PLAT},xxx) SPD := opteed endififneq (${SPD},none) ifdef EL3_PAYLOAD_BASE$(warning "SPD and EL3_PAYLOAD_BASE are incompatible build options.")$(warning "The SPD and its BL32 companion will be present but ignored.") endif# We expect to locate an spd.mk under the specified SPD directorySPD_MAKE := $(shell m="services/spd/${SPD}/${SPD}.mk"; [ -f "$$m" ] && echo "$$m")ifeq (${SPD_MAKE},)$(error Error: No services/spd/${SPD}/${SPD}.mk located)endif$(info Including ${SPD_MAKE})include ${SPD_MAKE}# If there's BL32 companion for the chosen SPD, we expect that the SPD's# Makefile would set NEED_BL32 to "yes". In this case, the build system# supports two mutually exclusive options:# * BL32 is built from source: then BL32_SOURCES must contain the list# of source files to build BL32# * BL32 is a prebuilt binary: then BL32 must point to the image file# that will be included in the FIP# If both BL32_SOURCES and BL32 are defined, the binary takes precedence# over the sources. endif

給NEED_BL31宏賦值

ifdef BL31_SOURCES # When booting an EL3 payload, there is no need to compile the BL31 image nor # put it in the FIP. ifndef EL3_PAYLOAD_BASE NEED_BL31 := yes include bl31/bl31.mk endif endif

調用MAKE_BL(31,in_fip)編譯BL31

(Makefile) ifeq (${NEED_BL31},yes) BL31_SOURCES += ${SPD_SOURCES} $(if ${BL31}, $(eval $(call MAKE_TOOL_ARGS,31,${BL31},in_fip)),\$(eval $(call MAKE_BL,31,in_fip))) endif

MAKE_BL函數的實現:

(make_helpers/build_macros.mk) # MAKE_BL macro defines the targets and options to build each BL image. # Arguments: # $(1) = BL stage (2, 2u, 30, 31, 32, 33) # $(2) = In FIP (false if empty) define MAKE_BL$(eval BUILD_DIR := ${BUILD_PLAT}/bl$(1))$(eval BL_SOURCES := $(BL$(call uppercase,$(1))_SOURCES))$(eval SOURCES := $(BL_SOURCES) $(BL_COMMON_SOURCES) $(PLAT_BL_COMMON_SOURCES))$(eval OBJS := $(addprefix $(BUILD_DIR)/,$(call SOURCES_TO_OBJS,$(SOURCES))))$(eval LINKERFILE := $(call IMG_LINKERFILE,$(1)))$(eval MAPFILE := $(call IMG_MAPFILE,$(1)))$(eval ELF := $(call IMG_ELF,$(1)))$(eval DUMP := $(call IMG_DUMP,$(1)))$(eval BIN := $(call IMG_BIN,$(1)))$(eval BL_LINKERFILE := $(BL$(call uppercase,$(1))_LINKERFILE))$(eval $(call MAKE_OBJS,$(BUILD_DIR),$(SOURCES),$(1)))$(eval $(call MAKE_LD,$(LINKERFILE),$(BL_LINKERFILE)))$(BUILD_DIR):$$(Q)mkdir -p "$$@"$(ELF): $(OBJS) $(LINKERFILE)@echo " LD $$@"@echo 'const char build_message[] = "Built : "__TIME__", "__DATE__; \const char version_string[] = "${VERSION_STRING}";' | \$$(CC) $$(CFLAGS) -xc - -o $(BUILD_DIR)/build_message.o$$(Q)$$(LD) -o $$@ $$(LDFLAGS) -Map=$(MAPFILE) --script $(LINKERFILE) \$(BUILD_DIR)/build_message.o $(OBJS)$(DUMP): $(ELF)@echo " OD $$@"$${Q}$${OD} -dx $$< > $$@$(BIN): $(ELF)@echo " BIN $$@"$$(Q)$$(OC) -O binary $$< $$@@echo@echo "Built $$@ successfully"@echo ifeq ($(1),31)cp $$@ $(BUILD_PLAT)/sloader.img endif.PHONY: bl$(1) bl$(1): $(BUILD_DIR) $(BIN) $(DUMP)all: bl$(1)$(eval $(call MAKE_TOOL_ARGS,$(1),$(BIN),$(2)))endef

ELF的生成使用到了LINKERFILE,而LINKERFILE就等于bl31.ld.S

$(eval BL_LINKERFILE := $(BL$(call uppercase,$(1))_LINKERFILE)) $(eval $(call MAKE_LD,$(LINKERFILE),$(BL_LINKERFILE))) BL31_LINKERFILE := bl31/bl31.ld.S

總結

以上是生活随笔為你收集整理的[ATF]-ATF makefile的导读的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。