Remove three board_avb_* args from META/misc_info.txt.
board_avb_algorithm and board_avb_key_path are overlapping with
avb_signing_args. In core/Makefile, only avb_signing_args (i.e.
INTERNAL_AVB_SIGNING_ARGS) will be used in the AVB-signing command. It
covers the contents in board_avb_{algorithm,key_path}. We should do the
same thing in tools/releasetools to avoid potential inconsistency.
This CL cleans up the logic in tools/releasetools, by always using
avb_signing_args. This also allows easier signing key replacement (so we
can replace the key/algorithm/signer in 'avb_signing_args').
board_avb_system_add_hashtree_footer_args is unused in releasetools
script, and the same information has been covered by
system_avb_add_hashtree_footer_args. This CL removes this arg as well.
Test: `m dist`. Then a) check the removed three args no longer exist in
META/misc_info.txt; b) check that rebuilding images with
add_img_to_target_files.py uses the same parameters.
Change-Id: I7db890b5c942de5b6868d8d1ebf937586d4729c0
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index c022d24..652fadf 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -345,16 +345,6 @@
print("%-25s = (%s) %s" % (k, type(v).__name__, v))
-def AppendAVBSigningArgs(cmd):
- """Append signing arguments for avbtool."""
- keypath = OPTIONS.info_dict.get("board_avb_key_path", None)
- algorithm = OPTIONS.info_dict.get("board_avb_algorithm", None)
- if not keypath or not algorithm:
- algorithm = "SHA256_RSA4096"
- keypath = "external/avb/test/data/testkey_rsa4096.pem"
- cmd.extend(["--key", keypath, "--algorithm", algorithm])
-
-
def _BuildBootableImage(sourcedir, fs_config_file, info_dict=None,
has_ramdisk=False, two_step_image=False):
"""Build a bootable image from the specified sourcedir.
@@ -491,12 +481,12 @@
# AVB: if enabled, calculate and add hash to boot.img.
if info_dict.get("board_avb_enable", None) == "true":
- avbtool = os.getenv('AVBTOOL') or OPTIONS.info_dict["avb_avbtool"]
- part_size = info_dict.get("boot_size", None)
+ avbtool = os.getenv('AVBTOOL') or info_dict["avb_avbtool"]
+ part_size = info_dict["boot_size"]
cmd = [avbtool, "add_hash_footer", "--image", img.name,
"--partition_size", str(part_size), "--partition_name", "boot"]
- AppendAVBSigningArgs(cmd)
- args = info_dict.get("board_avb_boot_add_hash_footer_args", None)
+ cmd.extend(shlex.split(info_dict["avb_signing_args"]))
+ args = info_dict.get("board_avb_boot_add_hash_footer_args")
if args and args.strip():
cmd.extend(shlex.split(args))
p = Run(cmd, stdout=subprocess.PIPE)