AVB: If building recovery.img, add AVB hash footer.
In some non-A/B setups, recovery.img is still being used. If AVB is enabled, we currently don't add a hash footer to recovery.img nor do we include the hash digest in vbmeta.img. This CL fixes that. This was tested on a build with the following settings TARGET_NO_RECOVERY := false BOARD_USES_RECOVERY_AS_BOOT := false BOARD_BUILD_SYSTEM_ROOT_IMAGE := false BOARD_RECOVERYIMAGE_PARTITION_SIZE := 33554432 BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS := --prop foo:bar and then it was verified using 'avbtool info_image' that recovery.img has a hash footer and a 'foo' property with the value 'bar'. This was also checked successfully for vbmeta.img. Test: See above. Bug: None Change-Id: I98124d5661ea768411416fa8d2a2ae6cc664fdc8
This commit is contained in:
@@ -500,15 +500,15 @@ def _BuildBootableImage(sourcedir, fs_config_file, info_dict=None,
|
||||
img_unsigned.close()
|
||||
img_keyblock.close()
|
||||
|
||||
# AVB: if enabled, calculate and add hash to boot.img.
|
||||
# AVB: if enabled, calculate and add hash to boot.img or recovery.img.
|
||||
if info_dict.get("avb_enable") == "true":
|
||||
avbtool = os.getenv('AVBTOOL') or info_dict["avb_avbtool"]
|
||||
part_size = info_dict["boot_size"]
|
||||
part_size = info_dict[partition_name + "_size"]
|
||||
cmd = [avbtool, "add_hash_footer", "--image", img.name,
|
||||
"--partition_size", str(part_size), "--partition_name",
|
||||
partition_name]
|
||||
AppendAVBSigningArgs(cmd, partition_name)
|
||||
args = info_dict.get("avb_boot_add_hash_footer_args")
|
||||
args = info_dict.get("avb_" + partition_name + "_add_hash_footer_args")
|
||||
if args and args.strip():
|
||||
cmd.extend(shlex.split(args))
|
||||
p = Run(cmd, stdout=subprocess.PIPE)
|
||||
|
Reference in New Issue
Block a user