summaryrefslogtreecommitdiffstats
path: root/tools/releasetools
diff options
context:
space:
mode:
authorMohamad Ayyash <mkayyash@google.com>2015-04-02 18:37:05 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-04-02 18:37:05 +0000
commite71b55606e2d0820f4a743f6c0e6b524f2354919 (patch)
tree4b91a3830143ca9d7bc4057411fa60757fc40c50 /tools/releasetools
parent8f7338d9b145379ea9c51b7e551509a2d8f0f24e (diff)
parent347195da2ea801db95cf201fa7516bf392dc005a (diff)
downloadbuild-e71b55606e2d0820f4a743f6c0e6b524f2354919.zip
build-e71b55606e2d0820f4a743f6c0e6b524f2354919.tar.gz
build-e71b55606e2d0820f4a743f6c0e6b524f2354919.tar.bz2
am 347195da: am 6ddc3600: Merge "build_image.py: Verity support for flashing non partition spanning fs"
* commit '347195da2ea801db95cf201fa7516bf392dc005a': build_image.py: Verity support for flashing non partition spanning fs
Diffstat (limited to 'tools/releasetools')
-rwxr-xr-xtools/releasetools/build_image.py23
1 files changed, 20 insertions, 3 deletions
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index 33540d2..04ced09 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -231,11 +231,14 @@ def BuildImage(in_dir, prop_dict, out_file):
fs_type = prop_dict.get("fs_type", "")
run_fsck = False
+ fs_spans_partition = True
+ if fs_type.startswith("squash"):
+ fs_spans_partition = False
+
is_verity_partition = "verity_block_device" in prop_dict
verity_supported = prop_dict.get("verity") == "true"
- # adjust the partition size to make room for the hashes if this is to be
- # verified
- if verity_supported and is_verity_partition:
+ # adjust the partition size to make room for the hashes if this is to be verified
+ if verity_supported and is_verity_partition and fs_spans_partition:
partition_size = int(prop_dict.get("partition_size"))
adjusted_size = AdjustPartitionSizeForVerity(partition_size)
if not adjusted_size:
@@ -301,6 +304,20 @@ def BuildImage(in_dir, prop_dict, out_file):
if exit_code != 0:
return False
+ if not fs_spans_partition:
+ mount_point = prop_dict.get("mount_point")
+ partition_size = int(prop_dict.get("partition_size"))
+ image_size = os.stat(out_file).st_size
+ if image_size > partition_size:
+ print "Error: %s image size of %d is larger than partition size of %d" % (mount_point, image_size, partition_size)
+ return False
+ if verity_supported and is_verity_partition:
+ if 2 * image_size - AdjustPartitionSizeForVerity(image_size) > partition_size:
+ print "Error: No more room on %s to fit verity data" % mount_point
+ return False
+ prop_dict["original_partition_size"] = prop_dict["partition_size"]
+ prop_dict["partition_size"] = str(image_size)
+
# create the verified image if this is to be verified
if verity_supported and is_verity_partition:
if not MakeVerityEnabledImage(out_file, prop_dict):