From 9f9ac4e8a05b4a5d2ad5b483e868534eea828a4a Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Wed, 1 Nov 2023 10:12:03 -0700 Subject: [PATCH] Fix prebuilt boot image hermetic build Break when we find a working salt, certain devices have boot image containing both the kernel and ramdisk, resulting in the ramdisk being used as salt. Since core/Makefile uses kernel as salt, update python code to match. Bug: 293313353 Test: th Change-Id: I68b5a8c2f0747ddf68f775bc2a6c5db46eb7eb64 --- tools/releasetools/common.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index d97611cbdd..cc102673a9 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -1908,8 +1908,11 @@ def _SignBootableImage(image_path, prebuilt_name, partition_name, for filename in ["kernel", "ramdisk", "vendor_ramdisk00"]: path = os.path.join(tmpdir, filename) if os.path.exists(path) and os.path.getsize(path): + print("Using {} as salt for avb footer of {}".format( + filename, partition_name)) with open(path, "rb") as fp: salt = sha256(fp.read()).hexdigest() + break AppendAVBSigningArgs(cmd, partition_name, salt) args = info_dict.get("avb_" + partition_name + "_add_hash_footer_args") if args and args.strip():