build_image: right size image problems.

Neglected to correct for filesystem size in estimate for verity.

To keep build space optimized and make sure that the existing image
does not confuse the tools, remove the out_file after the test build
image phase.

Test: build
Bug: 111302946
Change-Id: I360775d862d02a721d061bbc43e8b4e2f03bd01e
This commit is contained in:
Mark Salyzyn
2018-11-07 07:40:31 -08:00
parent 68b081fd5a
commit 41f781de9e

View File

@@ -262,10 +262,10 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
size += int(prop_dict.get("partition_reserved_size", BYTES_IN_MB * 16))
# Round this up to a multiple of 4K so that avbtool works
size = common.RoundUpTo4K(size)
if verity_image_builder:
size = verity_image_builder.CalculateDynamicPartitionSize(size)
prop_dict["partition_size"] = str(size)
if fs_type.startswith("ext"):
if verity_image_builder:
size = verity_image_builder.CalculateDynamicPartitionSize(size)
prop_dict["partition_size"] = str(size)
if "extfs_inode_count" not in prop_dict:
prop_dict["extfs_inode_count"] = str(GetInodeUsage(in_dir))
logger.info(
@@ -274,6 +274,7 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
prop_dict["mount_point"] = original_mount_point
BuildImage(in_dir, prop_dict, out_file, target_out)
fs_dict = GetFilesystemCharacteristics(out_file)
os.remove(out_file)
block_size = int(fs_dict.get("Block size", "4096"))
free_size = int(fs_dict.get("Free blocks", "0")) * block_size
reserved_size = int(prop_dict.get("partition_reserved_size", 0))
@@ -294,6 +295,9 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
prop_dict["partition_size"] = str(size)
logger.info(
"Allocating %d Inodes for %s.", inodes, out_file)
if verity_image_builder:
size = verity_image_builder.CalculateDynamicPartitionSize(size)
prop_dict["partition_size"] = str(size)
logger.info(
"Allocating %d MB for %s.", size // BYTES_IN_MB, out_file)