From 1d8d3bef47b716f318380e2022b60ae60627e124 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Tue, 29 Jan 2019 09:08:21 -0800 Subject: [PATCH] dynamic partitions: round partitions to BOARD_SUPER_PARTITION_ALIGNMENT For the worst minimum_io_size for the BOM for the flash device on the products, set BOARD_SUPER_PARTITION_ALIGNMENT so that we can in advance get a summary from the build that the update may fail. Test: build Bug: 122328872 Change-Id: I95515e58e5308b7a1e637fc8c8791c0fc61e81f2 --- core/Makefile | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/core/Makefile b/core/Makefile index ad9b452c1..309823c3f 100644 --- a/core/Makefile +++ b/core/Makefile @@ -3126,6 +3126,18 @@ define read-size-of-partitions $(foreach p,$(1),$(call read-image-prop-dictionary,$($(p)image_intermediates)/generated_$(p)_image_info.txt,$(p)_size)) endef +# round result to BOARD_SUPER_PARTITION_ALIGNMENT +#$(1): the calculated size +ifeq (,$(BOARD_SUPER_PARTITION_ALIGNMENT)) +define round-partition-size +$(1) +endef +else +define round-partition-size +$$((($(1)+$(BOARD_SUPER_PARTITION_ALIGNMENT)-1)/$(BOARD_SUPER_PARTITION_ALIGNMENT)*$(BOARD_SUPER_PARTITION_ALIGNMENT))) +endef +endif + define super-slot-suffix $(if $(filter true,$(AB_OTA_UPDATER)),$(if $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)),,_a)) endef @@ -3159,8 +3171,10 @@ endif # $(2): max size expression # $(3): list of partition names define check-sum-of-partition-sizes - partition_size_list="$(call read-size-of-partitions,$(3))"; \ - sum_sizes_expr=$$(sed -e 's/ /+/g' <<< "$${partition_size_list}"); \ + partition_size_list="$$(for i in $(call read-size-of-partitions,$(3)); do \ + echo $(call round-partition-size,$${i}); \ + done)"; \ + sum_sizes_expr=$$(tr '\n' '+' <<< "$${partition_size_list}" | sed 's/+$$//'); \ if [ $$(( $${sum_sizes_expr} )) -gt $$(( $(2) )) ]; then \ echo "The sum of sizes of [$(strip $(3))] is larger than $(strip $(1)):"; \ echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' "$(2)" '==' $$(( $(2) )); \