am 6ddc3600
: Merge "build_image.py: Verity support for flashing non partition spanning fs"
* commit '6ddc3600659d4517c416ce3b06e4ccee14042030': build_image.py: Verity support for flashing non partition spanning fs
This commit is contained in:
commit
347195da2e
1 changed files with 20 additions and 3 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue