Add aftltool is a signing parameter

Right now we assert that the aftltool should exist since the one
in aosp won't work due to grpc dependencies.

Bug: 147870995
Test: build
Change-Id: Iabb2c375167572a965493a7648fdc1abe287af67
This commit is contained in:
Tianjie 2020-04-01 12:20:21 -07:00
parent a3541df291
commit 0f3074566c
2 changed files with 10 additions and 4 deletions

View File

@ -77,6 +77,7 @@ class Options(object):
self.boot_signer_args = [] self.boot_signer_args = []
self.verity_signer_path = None self.verity_signer_path = None
self.verity_signer_args = [] self.verity_signer_args = []
self.aftl_tool_path = None
self.aftl_server = None self.aftl_server = None
self.aftl_key_path = None self.aftl_key_path = None
self.aftl_manufacturer_key_path = None self.aftl_manufacturer_key_path = None
@ -935,6 +936,7 @@ def AddAftlInclusionProof(output_image):
"""Appends the aftl inclusion proof to the vbmeta image.""" """Appends the aftl inclusion proof to the vbmeta image."""
# Ensure the other AFTL parameters are set as well. # Ensure the other AFTL parameters are set as well.
assert OPTIONS.aftl_tool_path is not None, 'No aftl tool provided.'
assert OPTIONS.aftl_key_path is not None, 'No AFTL key provided.' assert OPTIONS.aftl_key_path is not None, 'No AFTL key provided.'
assert OPTIONS.aftl_manufacturer_key_path is not None, \ assert OPTIONS.aftl_manufacturer_key_path is not None, \
'No AFTL manufacturer key provided.' 'No AFTL manufacturer key provided.'
@ -943,7 +945,8 @@ def AddAftlInclusionProof(output_image):
os.rename(output_image, vbmeta_image) os.rename(output_image, vbmeta_image)
build_info = BuildInfo(OPTIONS.info_dict) build_info = BuildInfo(OPTIONS.info_dict)
version_incremental = build_info.GetBuildProp("ro.build.version.incremental") version_incremental = build_info.GetBuildProp("ro.build.version.incremental")
aftl_cmd = ["aftltool", "make_icp_from_vbmeta", aftltool = OPTIONS.aftl_tool_path
aftl_cmd = [aftltool, "make_icp_from_vbmeta",
"--vbmeta_image_path", vbmeta_image, "--vbmeta_image_path", vbmeta_image,
"--output", output_image, "--output", output_image,
"--version_incremental", version_incremental, "--version_incremental", version_incremental,
@ -1876,9 +1879,9 @@ def ParseOptions(argv,
"java_path=", "java_args=", "android_jar_path=", "public_key_suffix=", "java_path=", "java_args=", "android_jar_path=", "public_key_suffix=",
"private_key_suffix=", "boot_signer_path=", "boot_signer_args=", "private_key_suffix=", "boot_signer_path=", "boot_signer_args=",
"verity_signer_path=", "verity_signer_args=", "device_specific=", "verity_signer_path=", "verity_signer_args=", "device_specific=",
"extra=", "logfile=", "aftl_server=", "aftl_key_path=", "extra=", "logfile=", "aftl_tool_path=", "aftl_server=",
"aftl_manufacturer_key_path=", "aftl_signer_helper="] + "aftl_key_path=", "aftl_manufacturer_key_path=",
list(extra_long_opts)) "aftl_signer_helper="] + list(extra_long_opts))
except getopt.GetoptError as err: except getopt.GetoptError as err:
Usage(docstring) Usage(docstring)
print("**", str(err), "**") print("**", str(err), "**")
@ -1916,6 +1919,8 @@ def ParseOptions(argv,
OPTIONS.verity_signer_path = a OPTIONS.verity_signer_path = a
elif o in ("--verity_signer_args",): elif o in ("--verity_signer_args",):
OPTIONS.verity_signer_args = shlex.split(a) OPTIONS.verity_signer_args = shlex.split(a)
elif o in ("--aftl_tool_path",):
OPTIONS.aftl_tool_path = a
elif o in ("--aftl_server",): elif o in ("--aftl_server",):
OPTIONS.aftl_server = a OPTIONS.aftl_server = a
elif o in ("--aftl_key_path",): elif o in ("--aftl_key_path",):

View File

@ -1417,6 +1417,7 @@ class CommonUtilsTest(test_utils.ReleaseToolsTestCase):
'6285659:userdebug/dev-keys' '6285659:userdebug/dev-keys'
} }
} }
common.OPTIONS.aftl_tool_path = "aftltool"
common.OPTIONS.aftl_server = "log.endpoints.aftl-dev.cloud.goog:9000" common.OPTIONS.aftl_server = "log.endpoints.aftl-dev.cloud.goog:9000"
common.OPTIONS.aftl_key_path = os.path.join(testdata_dir, common.OPTIONS.aftl_key_path = os.path.join(testdata_dir,
'test_transparency_key.pub') 'test_transparency_key.pub')