From 5b0fe18feb044d5648cf08933e8f991bae38b311 Mon Sep 17 00:00:00 2001 From: Sen Jiang Date: Mon, 15 May 2017 14:16:52 -0700 Subject: [PATCH] Add support for avbtool in custom_images. Set CUSTOM_IMAGE_AVB_ENABLE := true to enable avb, add_hashtree_footer args can be added in CUSTOM_IMAGE_AVB_ADD_HASHTREE_FOOTER_ARGS. Bug: 38319818 Test: m custom_images Change-Id: Ia452dc5ce8b55bcbd3abba9e965b72e78fd8c104 --- core/tasks/build_custom_images.mk | 2 ++ core/tasks/tools/build_custom_image.mk | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/core/tasks/build_custom_images.mk b/core/tasks/build_custom_images.mk index 8ebf89b0e7..c5f2a96416 100644 --- a/core/tasks/build_custom_images.mk +++ b/core/tasks/build_custom_images.mk @@ -54,6 +54,8 @@ custom_image_parameter_variables := \ CUSTOM_IMAGE_SELINUX \ CUSTOM_IMAGE_SUPPORT_VERITY \ CUSTOM_IMAGE_VERITY_BLOCK_DEVICE \ + CUSTOM_IMAGE_AVB_ENABLE \ + CUSTOM_IMAGE_AVB_ADD_HASHTREE_FOOTER_ARGS \ # We don't expect product makefile to inherit/override PRODUCT_CUSTOM_IMAGE_MAKEFILES, # so we don't put it in the _product_var_list. diff --git a/core/tasks/tools/build_custom_image.mk b/core/tasks/tools/build_custom_image.mk index f0db476bcf..f916e86232 100644 --- a/core/tasks/tools/build_custom_image.mk +++ b/core/tasks/tools/build_custom_image.mk @@ -74,6 +74,11 @@ $(my_built_custom_image): PRIVATE_SUPPORT_VERITY := $(CUSTOM_IMAGE_SUPPORT_VERIT $(my_built_custom_image): PRIVATE_VERITY_KEY := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY) $(my_built_custom_image): PRIVATE_VERITY_BLOCK_DEVICE := $(CUSTOM_IMAGE_VERITY_BLOCK_DEVICE) $(my_built_custom_image): PRIVATE_DICT_FILE := $(CUSTOM_IMAGE_DICT_FILE) +$(my_built_custom_image): PRIVATE_AVB_ENABLE := $(CUSTOM_IMAGE_AVB_ENABLE) +$(my_built_custom_image): PRIVATE_AVB_ADD_HASHTREE_FOOTER_ARGS := $(CUSTOM_IMAGE_AVB_ADD_HASHTREE_FOOTER_ARGS) +ifeq (true,$(CUSTOM_IMAGE_AVB_ENABLE)) + $(my_built_custom_image): $(AVBTOOL) +endif $(my_built_custom_image): $(INTERNAL_USERIMAGES_DEPS) $(my_built_modules) $(my_image_copy_files) \ $(CUSTOM_IMAGE_DICT_FILE) @echo "Build image $@" @@ -97,6 +102,11 @@ $(my_built_custom_image): $(INTERNAL_USERIMAGES_DEPS) $(my_built_modules) $(my_i echo "verity_key=$(PRIVATE_VERITY_KEY)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt;\ echo "verity_signer_cmd=$(VERITY_SIGNER)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt;\ echo "verity_block_device=$(PRIVATE_VERITY_BLOCK_DEVICE)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt) + $(if $(PRIVATE_AVB_ENABLE),\ + $(hide) echo "avb_enable=$(PRIVATE_AVB_ENABLE)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt;\ + echo "avb_avbtool=$(AVBTOOL)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt;\ + echo "avb_signing_args=$(INTERNAL_AVB_SIGNING_ARGS)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt;\ + echo "avb_add_hashtree_footer_args=$(PRIVATE_AVB_ADD_HASHTREE_FOOTER_ARGS)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt) $(if $(PRIVATE_DICT_FILE),\ $(hide) echo "# Properties from $(PRIVATE_DICT_FILE)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt;\ cat $(PRIVATE_DICT_FILE) >> $(PRIVATE_INTERMEDIATES)/image_info.txt)