Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4c103754 authored by Hridya Valsaraju's avatar Hridya Valsaraju Committed by android-build-merger
Browse files

Merge "Print a warning when sum of sizes of logical partitions an OEM-set...

Merge "Print a warning when sum of sizes of logical partitions an OEM-set limit" am: f1e61651 am: 9f72c850 am: 0606ded2
am: 4b086632

Change-Id: I1c4cb0126f949453baedbe9e1855a8538398f24c
parents a867e198 4b086632
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -3396,6 +3396,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
@@ -3430,6 +3434,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}); \
@@ -3440,6 +3446,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;
@@ -3449,7 +3460,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)), \