Using round_to_multiple() for --dynamic_partition_size
The rules of modulo on negative numbers depends on the
languages. To prevent confusion, using the existing
round_to_multiple() function to do the round-up.
Bug: None
Test: tree hugger
Change-Id: I062e9cb274275420ef6d043f9741a89bf115dc62
diff --git a/avbtool.py b/avbtool.py
index 5fb48b8..f944af4 100755
--- a/avbtool.py
+++ b/avbtool.py
@@ -3434,10 +3434,8 @@
original_image_size = image.image_size
if dynamic_partition_size:
- partition_size = original_image_size + max_metadata_size
-
- # Round up to block size.
- partition_size -= partition_size % -image.block_size
+ partition_size = round_to_multiple(
+ original_image_size + max_metadata_size, image.block_size)
max_image_size = partition_size - max_metadata_size
if partition_size % image.block_size != 0: