Allow custom boot_signer and verity_signer.
Bug: 21701163
Change-Id: I85e75fd3a166a9f6a7859ebf81dee73322dc2798
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index cbcad6d..6c526c8 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -25,9 +25,12 @@
import subprocess
import sys
import commands
+import common
import shutil
import tempfile
+OPTIONS = common.OPTIONS
+
FIXED_SALT = "aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7"
def RunCommand(cmd):
@@ -55,6 +58,7 @@
def GetVerityMetadataSize(partition_size):
cmd = "system/extras/verity/build_verity_metadata.py -s %d"
cmd %= partition_size
+
status, output = commands.getstatusoutput(cmd)
if status:
print output
@@ -162,7 +166,11 @@
image_size = prop_dict["partition_size"]
block_dev = prop_dict["verity_block_device"]
signer_key = prop_dict["verity_key"] + ".pk8"
- signer_path = prop_dict["verity_signer_cmd"]
+ if OPTIONS.verity_signer_path is not None:
+ signer_path = OPTIONS.verity_signer_path + ' '
+ signer_path += ' '.join(OPTIONS.verity_signer_args)
+ else:
+ signer_path = prop_dict["verity_signer_cmd"]
# make a tempdir
tempdir_name = tempfile.mkdtemp(suffix="_verity_images")
@@ -240,6 +248,7 @@
# 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:
return False