summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2019-06-10 18:17:40 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2019-06-10 18:17:40 +0000
commitf1e61651e08ef7ffbc56f5ec23a8231dc44c98f0 (patch)
treecdd2e43a3b64243eef445d528d24b83f8ca7ba78
parent69324709f867d6a93859d2f68b3be943e06c8ec3 (diff)
parent6fab18a7eb6ff45f9c2a0e4d13f989ab2f10e6bb (diff)
Merge "Print a warning when sum of sizes of logical partitions an OEM-set limit"
-rw-r--r--core/Makefile16
1 files changed, 15 insertions, 1 deletions
diff --git a/core/Makefile b/core/Makefile
index c6c4621911..bd40bcf7cf 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -3395,6 +3395,10 @@ define super-slot-suffix
$(if $(filter true,$(AB_OTA_UPDATER)),$(if $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)),,_a))
endef
+ifndef BOARD_SUPER_PARTITION_WARN_LIMIT
+BOARD_SUPER_PARTITION_WARN_LIMIT := $$(($(BOARD_SUPER_PARTITION_SIZE) * 95 / 100))
+endif
+
droid_targets: check-all-partition-sizes
.PHONY: check-all-partition-sizes check-all-partition-sizes-nodeps
@@ -3429,6 +3433,8 @@ endif
# $(1): human-readable max size string
# $(2): max size expression
# $(3): list of partition names
+# $(4): human-readable warn size string
+# $(5): warn size expression
define check-sum-of-partition-sizes
partition_size_list="$$(for i in $(call read-size-of-partitions,$(3)); do \
echo $(call round-partition-size,$${i}); \
@@ -3439,6 +3445,11 @@ define check-sum-of-partition-sizes
echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' "$(2)" '==' $$(( $(2) )); \
exit 1; \
else \
+ if [[ ! -z "$(5)" ]] && [ $$(( $${sum_sizes_expr} )) -gt $$(( $(5) )) ]; then \
+ echo "!!!! WARNING !!!! The sum of sizes of [$(strip $(3))] is larger than $(strip $(4)):"; \
+ echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' "$(5)" '==' $$(( $(5) )); \
+ echo "Super partition is" $$(( $$(( $$(( $${sum_sizes_expr} )) * 100)) / $$(( $(2) )) )) "percent occupied!"; \
+ fi; \
echo "The sum of sizes of [$(strip $(3))] is within $(strip $(1)):"; \
echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '<=' "$(2)" '==' $$(( $(2) )); \
fi;
@@ -3448,7 +3459,10 @@ define check-all-partition-sizes-target
# Check sum(all partitions) <= super partition (/ 2 for A/B devices launched with dynamic partitions)
$(if $(BOARD_SUPER_PARTITION_SIZE),$(if $(BOARD_SUPER_PARTITION_PARTITION_LIST), \
$(call check-sum-of-partition-sizes,BOARD_SUPER_PARTITION_SIZE$(if $(call super-slot-suffix), / 2), \
- $(BOARD_SUPER_PARTITION_SIZE)$(if $(call super-slot-suffix), / 2),$(BOARD_SUPER_PARTITION_PARTITION_LIST))))
+ $(BOARD_SUPER_PARTITION_SIZE)$(if $(call super-slot-suffix), / 2),$(BOARD_SUPER_PARTITION_PARTITION_LIST), \
+ BOARD_SUPER_PARTITION_WARN_LIMIT$(if $(call super-slot-suffix), / 2), \
+ $(BOARD_SUPER_PARTITION_WARN_LIMIT)$(if $(call super-slot-suffix), / 2)) \
+ ))
# For each group, check sum(partitions in group) <= group size
$(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \