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

Commit 9da0bd95 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "build_image: right size image problems."

parents 68b081fd 41f781de
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)