Support "updatable groups".
* BOARD_SUPER_PARTITION_GROUPS defines a list of "updatable groups". Each updatable group is a group of partitions that share the same pool of free spaces. * For each group in BOARD_SUPER_PARTITION_GROUPS, a BOARD_{GROUP}_SIZE and BOARD_{GROUP}_PARTITION_PARTITION_LIST may be defined. - BOARD_{GROUP}_SIZE: The maximum sum of sizes of all partitions in the group. If empty, no limit is enforced on the sum of sizes for this group. - BOARD_{GROUP}_PARTITION_PARTITION_LIST: the list of partitions that belongs to this group. If empty, no partitions belong to this group, and the sum of sizes is effectively 0. * BOARD_SUPER_PARTITION_PARTITION_LIST should not be defined by the device. It is now computed from all BOARD_{GROUP}_PARTITION_PARTITION_LIST. * Each 'updatable group' has its own pool of space for its partitions to grow into. Enforce the following: * sum(all partitions) <= super partition (/ 2 for A/B) * For each group, sum(partitions in group) <= group size * sum(all group sizes) <= super partition (/ 2 for A/B) Test: builds Bug: 111610495 Change-Id: I072b011714ec31a1d8813cc75edd27da3c6ff39a Merged-In: I072b011714ec31a1d8813cc75edd27da3c6ff39a
This commit is contained in:
parent
f4328b08f6
commit
b43012f0ad
|
@ -2917,7 +2917,7 @@ endef
|
||||||
ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
|
ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
|
||||||
|
|
||||||
# BOARD_SUPER_PARTITION_SIZE must be defined to build super image.
|
# BOARD_SUPER_PARTITION_SIZE must be defined to build super image.
|
||||||
ifdef BOARD_SUPER_PARTITION_SIZE
|
ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
|
||||||
|
|
||||||
INSTALLED_SUPERIMAGE_TARGET := $(PRODUCT_OUT)/super.img
|
INSTALLED_SUPERIMAGE_TARGET := $(PRODUCT_OUT)/super.img
|
||||||
INSTALLED_SUPERIMAGE_EMPTY_TARGET := $(PRODUCT_OUT)/super_empty.img
|
INSTALLED_SUPERIMAGE_EMPTY_TARGET := $(PRODUCT_OUT)/super_empty.img
|
||||||
|
@ -2978,32 +2978,61 @@ ifeq (,$(TARGET_BUILD_APPS))
|
||||||
# Do not check for apps-only build
|
# Do not check for apps-only build
|
||||||
|
|
||||||
ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
|
ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
|
||||||
ifdef BOARD_SUPER_PARTITION_SIZE
|
|
||||||
ifdef BOARD_SUPER_PARTITION_PARTITION_LIST
|
|
||||||
|
|
||||||
droid_targets: check_android_partition_sizes
|
droid_targets: check-all-partition-sizes
|
||||||
|
|
||||||
.PHONY: check_android_partition_sizes
|
.PHONY: check-all-partition-sizes check-all-partition-sizes-nodeps
|
||||||
|
|
||||||
# Add image dependencies so that generated_*_image_info.txt are written before checking.
|
# Add image dependencies so that generated_*_image_info.txt are written before checking.
|
||||||
check_android_partition_sizes: $(call images-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))
|
check-all-partition-sizes: $(call images-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))
|
||||||
|
|
||||||
check_android_partition_sizes:
|
# $(1): human-readable max size string
|
||||||
partition_size_list="$(call read-size-of-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))"; \
|
# $(2): max size expression
|
||||||
sum_sizes_expr=$$(sed -e 's/ /+/g' <<< "$${partition_size_list}"); \
|
# $(3): list of partition names
|
||||||
max_size_tail=$(if $(filter true,$(AB_OTA_UPDATER))," / 2"); \
|
define check-sum-of-partition-sizes
|
||||||
max_size_expr=$(BOARD_SUPER_PARTITION_SIZE)$${max_size_tail}; \
|
partition_size_list="$(call read-size-of-partitions,$(3))"; \
|
||||||
if [ $$(( $${sum_sizes_expr} )) -gt $$(( $${max_size_expr} )) ]; then \
|
sum_sizes_expr=$$(sed -e 's/ /+/g' <<< "$${partition_size_list}"); \
|
||||||
echo "The sum of sizes of all logical partitions is larger than BOARD_SUPER_PARTITION_SIZE$${max_size_tail}:"; \
|
if [ $$(( $${sum_sizes_expr} )) -gt $$(( $(2) )) ]; then \
|
||||||
echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' $${max_size_expr} '==' $$(( $${max_size_expr} )); \
|
echo "The sum of sizes of [$(strip $(3))] is larger than $(strip $(1)):"; \
|
||||||
exit 1; \
|
echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' "$(2)" '==' $$(( $(2) )); \
|
||||||
else \
|
exit 1; \
|
||||||
echo "The sum of sizes of all logical partitions is within BOARD_SUPER_PARTITION_SIZE$${max_size_tail}:"; \
|
else \
|
||||||
echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '<=' $${max_size_expr} '==' $$(( $${max_size_expr} )); \
|
echo "The sum of sizes of [$(strip $(3))] is within $(strip $(1)):"; \
|
||||||
fi
|
echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '<=' "$(2)" '==' $$(( $(2) )); \
|
||||||
|
fi
|
||||||
|
endef
|
||||||
|
|
||||||
|
define check-all-partition-sizes-target
|
||||||
|
# Check sum(all partitions) <= super partition (/ 2 for A/B)
|
||||||
|
$(if $(BOARD_SUPER_PARTITION_SIZE),$(if $(BOARD_SUPER_PARTITION_PARTITION_LIST), \
|
||||||
|
$(call check-sum-of-partition-sizes,BOARD_SUPER_PARTITION_SIZE$(if $(filter true,$(AB_OTA_UPDATER)), / 2), \
|
||||||
|
$(BOARD_SUPER_PARTITION_SIZE)$(if $(filter true,$(AB_OTA_UPDATER)), / 2),$(BOARD_SUPER_PARTITION_PARTITION_LIST))))
|
||||||
|
|
||||||
|
# For each group, check sum(partitions in group) <= group size
|
||||||
|
$(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \
|
||||||
|
$(if $(BOARD_$(group)_SIZE),$(if $(BOARD_$(group)_PARTITION_LIST), \
|
||||||
|
$(call check-sum-of-partition-sizes,BOARD_$(group)_SIZE,$(BOARD_$(group)_SIZE),$(BOARD_$(group)_PARTITION_LIST)))))
|
||||||
|
|
||||||
|
# Check sum(all group sizes) <= super partition (/ 2 for A/B)
|
||||||
|
if [[ ! -z $(BOARD_SUPER_PARTITION_SIZE) ]]; then \
|
||||||
|
group_size_list="$(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)),$(BOARD_$(group)_SIZE))"; \
|
||||||
|
sum_sizes_expr=$$(sed -e 's/ /+/g' <<< "$${group_size_list}"); \
|
||||||
|
max_size_tail=$(if $(filter true,$(AB_OTA_UPDATER))," / 2"); \
|
||||||
|
max_size_expr="$(BOARD_SUPER_PARTITION_SIZE)$${max_size_tail}"; \
|
||||||
|
if [ $$(( $${sum_sizes_expr} )) -gt $$(( $${max_size_expr} )) ]; then \
|
||||||
|
echo "The sum of sizes of [$(strip $(BOARD_SUPER_PARTITION_GROUPS))] is larger than BOARD_SUPER_PARTITION_SIZE$${max_size_tail}:"; \
|
||||||
|
echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' $${max_size_expr} '==' $$(( $${max_size_expr} )); \
|
||||||
|
exit 1; \
|
||||||
|
else \
|
||||||
|
echo "The sum of sizes of [$(strip $(BOARD_SUPER_PARTITION_GROUPS))] is within BOARD_SUPER_PARTITION_SIZE$${max_size_tail}:"; \
|
||||||
|
echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '<=' $${max_size_expr} '==' $$(( $${max_size_expr} )); \
|
||||||
|
fi \
|
||||||
|
fi
|
||||||
|
endef
|
||||||
|
|
||||||
|
check-all-partition-sizes check-all-partition-sizes-nodeps:
|
||||||
|
$(call check-all-partition-sizes-target)
|
||||||
|
|
||||||
endif # BOARD_SUPER_PARTITION_PARTITION_LIST
|
|
||||||
endif # BOARD_SUPER_PARTITION_SIZE
|
|
||||||
endif # PRODUCT_BUILD_SUPER_PARTITION
|
endif # PRODUCT_BUILD_SUPER_PARTITION
|
||||||
|
|
||||||
endif # TARGET_BUILD_APPS
|
endif # TARGET_BUILD_APPS
|
||||||
|
@ -3603,7 +3632,7 @@ endif
|
||||||
ifdef BUILT_VENDOR_MATRIX
|
ifdef BUILT_VENDOR_MATRIX
|
||||||
$(hide) cp $(BUILT_VENDOR_MATRIX) $(zip_root)/META/vendor_matrix.xml
|
$(hide) cp $(BUILT_VENDOR_MATRIX) $(zip_root)/META/vendor_matrix.xml
|
||||||
endif
|
endif
|
||||||
ifdef BOARD_SUPER_PARTITION_SIZE
|
ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
|
||||||
$(hide) echo "super_size=$(BOARD_SUPER_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
|
$(hide) echo "super_size=$(BOARD_SUPER_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
|
||||||
$(hide) echo "lpmake=$(notdir $(LPMAKE))" >> $(zip_root)/META/misc_info.txt
|
$(hide) echo "lpmake=$(notdir $(LPMAKE))" >> $(zip_root)/META/misc_info.txt
|
||||||
$(hide) echo -n "lpmake_args=" >> $(zip_root)/META/misc_info.txt
|
$(hide) echo -n "lpmake_args=" >> $(zip_root)/META/misc_info.txt
|
||||||
|
|
|
@ -1011,16 +1011,42 @@ endif
|
||||||
endif # PRODUCT_USE_DYNAMIC_PARTITION_SIZE
|
endif # PRODUCT_USE_DYNAMIC_PARTITION_SIZE
|
||||||
|
|
||||||
ifeq ($(PRODUCT_BUILD_SUPER_PARTITION),true)
|
ifeq ($(PRODUCT_BUILD_SUPER_PARTITION),true)
|
||||||
ifdef BOARD_SUPER_PARTITION_PARTITION_LIST
|
|
||||||
# BOARD_SUPER_PARTITION_PARTITION_LIST: a list of the following tokens
|
# BOARD_SUPER_PARTITION_GROUPS defines a list of "updatable groups". Each updatable group is a
|
||||||
|
# group of partitions that share the same pool of free spaces.
|
||||||
|
# For each group in BOARD_SUPER_PARTITION_GROUPS, a BOARD_{GROUP}_SIZE and
|
||||||
|
# BOARD_{GROUP}_PARTITION_PARTITION_LIST may be defined.
|
||||||
|
# - BOARD_{GROUP}_SIZE: The maximum sum of sizes of all partitions in the group.
|
||||||
|
# If empty, no limit is enforced on the sum of sizes for this group.
|
||||||
|
# - BOARD_{GROUP}_PARTITION_PARTITION_LIST: the list of partitions that belongs to this group.
|
||||||
|
# If empty, no partitions belong to this group, and the sum of sizes is effectively 0.
|
||||||
|
$(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \
|
||||||
|
$(eval BOARD_$(group)_SIZE ?=) \
|
||||||
|
$(eval .KATI_READONLY := BOARD_$(group)_SIZE) \
|
||||||
|
$(eval BOARD_$(group)_PARTITION_LIST ?=) \
|
||||||
|
$(eval .KATI_READONLY := BOARD_$(group)_PARTITION_LIST) \
|
||||||
|
)
|
||||||
|
|
||||||
|
# BOARD_*_PARTITION_LIST: a list of the following tokens
|
||||||
valid_super_partition_list := system vendor product product_services
|
valid_super_partition_list := system vendor product product_services
|
||||||
ifneq (,$(filter-out $(valid_super_partition_list),$(BOARD_SUPER_PARTITION_PARTITION_LIST)))
|
$(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \
|
||||||
$(error BOARD_SUPER_PARTITION_PARTITION_LIST contains invalid partition name \
|
$(if $(filter-out $(valid_super_partition_list),$(BOARD_$(group)_PARTITION_LIST)), \
|
||||||
($(filter-out $(valid_super_partition_list),$(BOARD_SUPER_PARTITION_PARTITION_LIST))). \
|
$(error BOARD_$(group)_PARTITION_LIST contains invalid partition name \
|
||||||
Valid names are $(valid_super_partition_list))
|
$(filter-out $(valid_super_partition_list),$(BOARD_$(group)_PARTITION_LIST)). \
|
||||||
endif
|
Valid names are $(valid_super_partition_list))))
|
||||||
valid_super_partition_list :=
|
valid_super_partition_list :=
|
||||||
endif # BOARD_SUPER_PARTITION_PARTITION_LIST
|
|
||||||
|
|
||||||
|
# Define BOARD_SUPER_PARTITION_PARTITION_LIST, the sum of all BOARD_*_PARTITION_LIST
|
||||||
|
ifdef BOARD_SUPER_PARTITION_PARTITION_LIST
|
||||||
|
$(error BOARD_SUPER_PARTITION_PARTITION_LIST should not be defined, but computed from \
|
||||||
|
BOARD_SUPER_PARTITION_GROUPS and BOARD_*_PARTITION_LIST)
|
||||||
|
endif
|
||||||
|
BOARD_SUPER_PARTITION_PARTITION_LIST := \
|
||||||
|
$(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \
|
||||||
|
$(BOARD_$(group)_PARTITION_LIST))
|
||||||
|
.KATI_READONLY := BOARD_SUPER_PARTITION_PARTITION_LIST
|
||||||
|
|
||||||
endif # PRODUCT_BUILD_SUPER_PARTITION
|
endif # PRODUCT_BUILD_SUPER_PARTITION
|
||||||
|
|
||||||
# ###############################################################
|
# ###############################################################
|
||||||
|
|
|
@ -408,7 +408,7 @@ _product_stash_var_list += \
|
||||||
BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE \
|
BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE \
|
||||||
BOARD_PRODUCT_SERVICESIMAGE_PARTITION_RESERVED_SIZE \
|
BOARD_PRODUCT_SERVICESIMAGE_PARTITION_RESERVED_SIZE \
|
||||||
BOARD_SUPER_PARTITION_SIZE \
|
BOARD_SUPER_PARTITION_SIZE \
|
||||||
BOARD_SUPER_PARTITION_PARTITION_LIST \
|
BOARD_SUPER_PARTITION_GROUPS \
|
||||||
|
|
||||||
#
|
#
|
||||||
# Mark the variables in _product_stash_var_list as readonly
|
# Mark the variables in _product_stash_var_list as readonly
|
||||||
|
|
Loading…
Reference in New Issue