From 211c90158cd8e822fd453ba88141cd1fda42ce7c Mon Sep 17 00:00:00 2001 From: Yueyao Zhu Date: Thu, 27 Apr 2017 00:34:50 -0700 Subject: [PATCH] Makefile: support build and avb signing of dtbo img Test: make with corresponding configurations in BoardConfig.mk - dtbo.img is copied to the OUT directory - avbtool info_image --image dtbo.img shows avb hashes - avbtool info_image --image vbmeta.img shows dtbo partition info Bug: 37730955 Change-Id: If3edaab860926c743f18fd031c911b076eb09fab --- core/Makefile | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/core/Makefile b/core/Makefile index 0a9937665b..5d449548e7 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1689,6 +1689,26 @@ INSTALLED_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img $(eval $(call copy-one-file,$(BOARD_PREBUILT_VENDORIMAGE),$(INSTALLED_VENDORIMAGE_TARGET))) endif +# ----------------------------------------------------------------- +# dtbo image +ifdef BOARD_PREBUILT_DTBOIMAGE +INSTALLED_DTBOIMAGE_TARGET := $(PRODUCT_OUT)/dtbo.img + +ifeq ($(BOARD_AVB_ENABLE),true) +$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE) $(AVBTOOL) + cp $(BOARD_PREBUILT_DTBOIMAGE) $@ + $(AVBTOOL) add_hash_footer \ + --image $@ \ + --partition_size $(BOARD_DTBOIMG_PARTITION_SIZE) \ + --partition_name dtbo $(INTERNAL_AVB_SIGNING_ARGS) \ + $(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS) +else +$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE) + cp $(BOARD_PREBUILT_DTBOIMAGE) $@ +endif + +endif + # ----------------------------------------------------------------- # vbmeta image ifeq ($(BOARD_AVB_ENABLE),true) @@ -1704,6 +1724,11 @@ INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \ --include_descriptors_from_image $(INSTALLED_VENDORIMAGE_TARGET) endif +ifdef INSTALLED_DTBOIMAGE_TARGET +INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \ + --include_descriptors_from_image $(INSTALLED_DTBOIMAGE_TARGET) +endif + ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true) INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += --setup_rootfs_from_kernel $(BUILT_SYSTEMIMAGE) endif @@ -1740,7 +1765,7 @@ define build-vbmetaimage-target endef INSTALLED_VBMETAIMAGE_TARGET := $(BUILT_VBMETAIMAGE_TARGET) -$(INSTALLED_VBMETAIMAGE_TARGET): $(AVBTOOL) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_SYSTEMIMAGE) $(INSTALLED_VENDORIMAGE_TARGET) +$(INSTALLED_VBMETAIMAGE_TARGET): $(AVBTOOL) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_SYSTEMIMAGE) $(INSTALLED_VENDORIMAGE_TARGET) $(INSTALLED_DTBOIMAGE_TARGET) $(build-vbmetaimage-target) .PHONY: vbmetaimage-nodeps @@ -1980,6 +2005,7 @@ $(BUILT_TARGET_FILES_PACKAGE): \ $(INSTALLED_USERDATAIMAGE_TARGET) \ $(INSTALLED_CACHEIMAGE_TARGET) \ $(INSTALLED_VENDORIMAGE_TARGET) \ + $(INSTALLED_DTBOIMAGE_TARGET) \ $(INTERNAL_SYSTEMOTHERIMAGE_FILES) \ $(INSTALLED_ANDROID_INFO_TXT_TARGET) \ $(INSTALLED_KERNEL_TARGET) \