Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 41f781de authored by Mark Salyzyn's avatar Mark Salyzyn
Browse files

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
parent 68b081fd
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -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 fs_type.startswith("ext"):
      if verity_image_builder:
        size = verity_image_builder.CalculateDynamicPartitionSize(size)
      prop_dict["partition_size"] = str(size)
    if fs_type.startswith("ext"):
      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)