Check super size for factory OTA at build time

For VAB launched device, factory OTA will write system_other
partition to the super image. So we want to check that
sum(dynamic partitions) + system_other + overhead <= super at
build time.

Since we don't know the overhead at build time, we might instead
check sum(all partitions) < super.

Bug: 185809374
Test: m check-all-partition-sizes, unittests
Change-Id: Ia7ba5999d23924a1927e9a9463856a4d0ea90c20
Merged-In: Ia7ba5999d23924a1927e9a9463856a4d0ea90c20
(cherry-picked from commit 294ec7d9e5)

Change-Id: I479d1b399a1639b595ae5d7f1481c771a3439e51
This commit is contained in:
Tianjie
2021-05-13 15:44:43 -07:00
parent 33e79ba41e
commit 16bcac122f
3 changed files with 30 additions and 6 deletions

View File

@@ -223,9 +223,15 @@ class DynamicPartitionSizeChecker(object):
error_limit = Expression(
"BOARD_SUPER_PARTITION_ERROR_LIMIT{}".format(size_limit_suffix),
int(info_dict["super_partition_error_limit"]) // num_slots)
self._CheckSumOfPartitionSizes(
max_size, info_dict["dynamic_partition_list"].strip().split(),
warn_limit, error_limit)
partitions_in_super = info_dict["dynamic_partition_list"].strip().split()
# In the vab case, factory OTA will allocate space on super to install
# the system_other partition. So add system_other to the partition list.
if DeviceType.Get(self.info_dict) == DeviceType.VAB and (
"system_other_image" in info_dict or
"system_other_image_size" in info_dict):
partitions_in_super.append("system_other")
self._CheckSumOfPartitionSizes(max_size, partitions_in_super,
warn_limit, error_limit)
groups = info_dict.get("super_partition_groups", "").strip().split()