diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2020-12-09 07:07:04 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-12-09 07:07:04 +0000 |
commit | 749c16341a059688a1f322b9c5bc39ad82bcb47d (patch) | |
tree | 45df669b798343a228a23f50235f76c131744bf8 | |
parent | c45efb8c5cb33143753a496e0acff91917f0b4da (diff) | |
parent | 70c61bc6e91543709032ba443861ebfdeca17f54 (diff) | |
download | build-749c16341a059688a1f322b9c5bc39ad82bcb47d.tar.gz |
Merge changes I1deda85d,I43d7b2c6 am: 70c61bc6e9
Original change: https://android-review.googlesource.com/c/platform/build/+/1517621
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: Ic68d1d052d9fba1933ff68ac340cff6e7defdae9
-rwxr-xr-x | tools/releasetools/build_image.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py index 6487b9b8e2..fbed77d553 100755 --- a/tools/releasetools/build_image.py +++ b/tools/releasetools/build_image.py @@ -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,7 +427,16 @@ 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. - size = GetDiskUsage(in_dir) + # 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) # If not specified, give us 16MB margin for GetDiskUsage error ... |