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

Commit 70c61bc6 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes I1deda85d,I43d7b2c6

* changes:
  calculation partition size use compressed image size
  add erofs to non partition spanning fs
parents 25405114 35f015ea
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -417,7 +417,7 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
  fs_type = prop_dict.get("fs_type", "")

  fs_spans_partition = True
  if fs_type.startswith("squash"):
  if fs_type.startswith("squash") or fs_type.startswith("erofs"):
    fs_spans_partition = False

  # Get a builder for creating an image that's to be verified by Verified Boot,
@@ -427,6 +427,15 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
  if (prop_dict.get("use_dynamic_partition_size") == "true" and
      "partition_size" not in prop_dict):
    # If partition_size is not defined, use output of `du' + reserved_size.
    # For compressed file system, it's better to use the compressed size to avoid wasting space.
    if fs_type.startswith("erofs"):
      tmp_dict = prop_dict.copy()
      if "erofs_sparse_flag" in tmp_dict:
        tmp_dict.pop("erofs_sparse_flag")
      BuildImageMkfs(in_dir, tmp_dict, out_file, target_out, fs_config)
      size = GetDiskUsage(out_file)
      os.remove(out_file)
    else:
      size = GetDiskUsage(in_dir)
    logger.info(
        "The tree size of %s is %d MB.", in_dir, size // BYTES_IN_MB)