Allow space in BOARD_*_SIZE variables for dynamic partitions
Allow instances like:
BOARD_SUPER_PARTITION_SIZE := 4294967296 # 4GiB
Test: add trailing space to BOARD_SUPER_PARTITION_SIZE,
BOARD_(group)_SIZE, BOARD_*IMAGE_PARTITION_RESERVED_SIZE,
BOARD_SUPER_PARTITION_(device)_DEVICE_SIZE, build passes.
Fixes: 120042457
Change-Id: Ib7244e3fd2f782657c84cdb74e601ac96176571d
diff --git a/core/config.mk b/core/config.mk
index 77f5e6b..6b67e1a 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -1006,6 +1006,7 @@
# - 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 := $(strip $(BOARD_$(group)_SIZE))) \
$(if $(BOARD_$(group)_SIZE),,$(error BOARD_$(group)_SIZE must not be empty)) \
$(eval .KATI_READONLY := BOARD_$(group)_SIZE) \
$(eval BOARD_$(group)_PARTITION_LIST ?=) \
@@ -1032,7 +1033,7 @@
$(BOARD_$(group)_PARTITION_LIST))
.KATI_READONLY := BOARD_SUPER_PARTITION_PARTITION_LIST
-ifdef BOARD_SUPER_PARTITION_SIZE
+ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
# The metadata device must be specified manually for retrofitting.
@@ -1075,6 +1076,7 @@
.KATI_READONLY := BOARD_SUPER_PARTITION_METADATA_DEVICE
$(foreach device,$(call to-upper,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)), \
+ $(eval BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE := $(strip $(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE))) \
$(if $(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE),, \
$(error $(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE must not be empty))) \
$(eval .KATI_READONLY := BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE))
diff --git a/core/main.mk b/core/main.mk
index add8fd9..9fd1c35 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -410,7 +410,9 @@
# Typical build; include any Android.mk files we can find.
#
-
+# Before we go and include all of the module makefiles, strip values for easier
+# processing.
+$(call strip-product-vars)
# Before we go and include all of the module makefiles, mark the PRODUCT_*
# and ADDITIONAL*PROPERTIES values readonly so that they won't be modified.
$(call readonly-product-vars)
diff --git a/core/product.mk b/core/product.mk
index fbdd237..8497b28 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -404,7 +404,7 @@
WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY
# Logical partitions related variables.
-_product_stash_var_list += \
+_dynamic_partitions_var_list += \
BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE \
BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE \
BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE \
@@ -413,6 +413,9 @@
BOARD_SUPER_PARTITION_SIZE \
BOARD_SUPER_PARTITION_GROUPS \
+_product_stash_var_list += $(_dynamic_partitions_var_list)
+_product_strip_var_list := $(_dynamic_partitions_var_list)
+
#
# Mark the variables in _product_stash_var_list as readonly
#
@@ -423,6 +426,13 @@
)
endef
+#
+# Strip the variables in _product_strip_var_list
+#
+define strip-product-vars
+$(foreach v,$(_product_strip_var_list),$(eval $(v) := $(strip $($(v)))))
+endef
+
define add-to-product-copy-files-if-exists
$(if $(wildcard $(word 1,$(subst :, ,$(1)))),$(1))
endef