From e6f3063317e059ef4f2c056459ab3a5b4b7ef17f Mon Sep 17 00:00:00 2001 From: Shikha Panwar Date: Wed, 21 Dec 2022 12:54:45 +0000 Subject: [PATCH] Expose avb_hash_algorithm as a property. When avb_hash_algorithm is set, for filesystem type build targets, add_hashtree_footer will be called with the appropriate --hash_algorithm flag. Bug: 262892300i Test: Build succeeds Change-Id: If2f9c9aa1e98314b3d3e2f8bf25c1bab193f908e --- filesystem/filesystem.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go index 1365d4a58..e123f24f9 100644 --- a/filesystem/filesystem.go +++ b/filesystem/filesystem.go @@ -72,6 +72,9 @@ type filesystemProperties struct { // Hash and signing algorithm for avbtool. Default is SHA256_RSA4096. Avb_algorithm *string + // Hash and signing algorithm for avbtool. Default is SHA256_RSA4096. + Avb_hash_algorithm *string + // Name of the partition stored in vbmeta desc. Defaults to the name of this module. Partition_name *string @@ -333,7 +336,11 @@ func (f *filesystem) buildPropFile(ctx android.ModuleContext) (propFile android. addStr("avb_algorithm", algorithm) key := android.PathForModuleSrc(ctx, proptools.String(f.properties.Avb_private_key)) addPath("avb_key_path", key) - addStr("avb_add_hashtree_footer_args", "--do_not_generate_fec") + avb_add_hashtree_footer_args := "--do_not_generate_fec" + if hashAlgorithm := proptools.String(f.properties.Avb_hash_algorithm); hashAlgorithm != "" { + avb_add_hashtree_footer_args += " --hash_algorithm " + hashAlgorithm + } + addStr("avb_add_hashtree_footer_args", avb_add_hashtree_footer_args) partitionName := proptools.StringDefault(f.properties.Partition_name, f.Name()) addStr("partition_name", partitionName) addStr("avb_salt", f.salt())