Merge "Consider search_path to locate avb_*_key_path files" am: 11dc247ba9

am: 1e8961033e

Change-Id: I1a93f474f069b6a573006602a27d9e0aaa4cc0c2
This commit is contained in:
Daniel Mentz 2019-08-26 12:57:47 -07:00 committed by android-build-merger
commit 8442059d9f
1 changed files with 8 additions and 0 deletions

View File

@ -616,6 +616,10 @@ def AppendAVBSigningArgs(cmd, partition):
"""Append signing arguments for avbtool."""
# e.g., "--key path/to/signing_key --algorithm SHA256_RSA4096"
key_path = OPTIONS.info_dict.get("avb_" + partition + "_key_path")
if key_path and not os.path.exists(key_path) and OPTIONS.search_path:
new_key_path = os.path.join(OPTIONS.search_path, key_path)
if os.path.exists(new_key_path):
key_path = new_key_path
algorithm = OPTIONS.info_dict.get("avb_" + partition + "_algorithm")
if key_path and algorithm:
cmd.extend(["--key", key_path, "--algorithm", algorithm])
@ -668,6 +672,10 @@ def GetAvbChainedPartitionArg(partition, info_dict, key=None):
"""
if key is None:
key = info_dict["avb_" + partition + "_key_path"]
if key and not os.path.exists(key) and OPTIONS.search_path:
new_key_path = os.path.join(OPTIONS.search_path, key)
if os.path.exists(new_key_path):
key = new_key_path
pubkey_path = ExtractAvbPublicKey(info_dict["avb_avbtool"], key)
rollback_index_location = info_dict[
"avb_" + partition + "_rollback_index_location"]