From accf09b2e0bf39c8ab8b006d11e341b4dc982787 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Tue, 19 Feb 2019 15:42:45 -0800 Subject: [PATCH] Fix dynamic partition size check for devices with recovery Devices with TARGET_NO_RECOVERY unset will contain a patch of the recovery image in the system image. Fix corresponding size checks. Fixes: 120043292 Bug: 124489494 Test: build cuttlefish with DAP Change-Id: I508881f421672180ab852c0f9216184b925d83ad --- core/Makefile | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/Makefile b/core/Makefile index b3e9d37b2f..71b9046a93 100644 --- a/core/Makefile +++ b/core/Makefile @@ -2175,6 +2175,19 @@ endif # INSTALLED_BOOTIMAGE_TARGET $(INSTALLED_SYSTEMIMAGE_TARGET): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH) @echo "Install system fs image: $@" $(copy-file-to-target) +ifdef RECOVERY_FROM_BOOT_PATCH +ifeq ($(PRODUCT_USE_DYNAMIC_PARTITION_SIZE),true) +ifeq ($(BOARD_SYSTEMIMAGE_PARTITION_SIZE),) + # system image size is dynamic, hence system_size in generated_system_image_info.txt does not + # have room for recovery from boot patch. Increase system_size so that check-all-partition-sizes + # accounts for the size of the patch. + sed -i'.bak' -e 's/^system_size=.*$$/system_size='"$$(( \ + $(call read-image-prop-dictionary,$(systemimage_intermediates)/generated_system_image_info.txt,system_size) + \ + $$($(call get-file-size,$(RECOVERY_FROM_BOOT_PATCH))) ))"'/' \ + $(systemimage_intermediates)/generated_system_image_info.txt +endif +endif +endif $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),\ $(call read-image-prop-dictionary,\ $(systemimage_intermediates)/generated_system_image_info.txt,system_size))