Merge "Include image descriptor of only the first boot image in vbmeta"

This commit is contained in:
Treehugger Robot 2020-06-16 00:05:28 +00:00 committed by Gerrit Code Review
commit 397972fa6a
2 changed files with 12 additions and 6 deletions

View File

@ -3057,6 +3057,9 @@ endef
# configured as a chained partition, if BOARD_AVB_<partition>_KEY_PATH is defined. Otherwise the # configured as a chained partition, if BOARD_AVB_<partition>_KEY_PATH is defined. Otherwise the
# image descriptor will be included into vbmeta.img, unless it has been already added to any chained # image descriptor will be included into vbmeta.img, unless it has been already added to any chained
# VBMeta image. # VBMeta image.
# Multiple boot images can be generated based on BOARD_KERNEL_BINARIES
# but vbmeta would capture the image descriptor of only the first boot
# image specified in BUILT_BOOTIMAGE_TARGET.
# $(1): Partition name, e.g. boot or system. # $(1): Partition name, e.g. boot or system.
define check-and-set-avb-args define check-and-set-avb-args
$(eval _in_chained_vbmeta := $(filter $(1),$(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES))) $(eval _in_chained_vbmeta := $(filter $(1),$(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES)))
@ -3065,8 +3068,11 @@ $(if $(BOARD_AVB_$(call to-upper,$(1))_KEY_PATH),\
$(error Chaining partition "$(1)" in chained VBMeta image is not supported)) \ $(error Chaining partition "$(1)" in chained VBMeta image is not supported)) \
$(call _check-and-set-avb-chain-args,$(1)),\ $(call _check-and-set-avb-chain-args,$(1)),\
$(if $(_in_chained_vbmeta),,\ $(if $(_in_chained_vbmeta),,\
$(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \ $(if $(filter boot,$(1)),\
--include_descriptors_from_image $(call images-for-partitions,$(1))))) $(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
--include_descriptors_from_image $(firstword $(call images-for-partitions,$(1)))),\
$(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
--include_descriptors_from_image $(call images-for-partitions,$(1))))))
endef endef
# Checks and sets build variables for a custom chained partition to include it into vbmeta.img. # Checks and sets build variables for a custom chained partition to include it into vbmeta.img.

8
tools/releasetools/add_img_to_target_files.py Executable file → Normal file
View File

@ -788,16 +788,16 @@ def AddImagesToTargetFiles(filename):
boot_images = OPTIONS.info_dict.get("boot_images") boot_images = OPTIONS.info_dict.get("boot_images")
if boot_images is None: if boot_images is None:
boot_images = "boot.img" boot_images = "boot.img"
for b in boot_images.split(): for index,b in enumerate(boot_images.split()):
# common.GetBootableImage() returns the image directly if present. # common.GetBootableImage() returns the image directly if present.
boot_image = common.GetBootableImage( boot_image = common.GetBootableImage(
"IMAGES/" + b, b, OPTIONS.input_tmp, "BOOT") "IMAGES/" + b, b, OPTIONS.input_tmp, "BOOT")
# boot.img may be unavailable in some targets (e.g. aosp_arm64). # boot.img may be unavailable in some targets (e.g. aosp_arm64).
if boot_image: if boot_image:
boot_image_path = os.path.join(OPTIONS.input_tmp, "IMAGES", b) boot_image_path = os.path.join(OPTIONS.input_tmp, "IMAGES", b)
# vbmeta does not need to include boot.img with multiple boot.img files, # Although multiple boot images can be generated, include the image
# which is only used for aosp_arm64 for GKI # descriptor of only the first boot image in vbmeta
if len(boot_images.split()) == 1: if index == 0:
partitions['boot'] = boot_image_path partitions['boot'] = boot_image_path
if not os.path.exists(boot_image_path): if not os.path.exists(boot_image_path):
boot_image.WriteToDir(OPTIONS.input_tmp) boot_image.WriteToDir(OPTIONS.input_tmp)