From 9f263710ffbfd95ce28de2c2586ccd3356e133ad Mon Sep 17 00:00:00 2001 From: Seungjae Yoo Date: Thu, 16 Nov 2023 17:22:57 +0900 Subject: [PATCH] Support adding AVB properties into vbmeta module Bug: 285855436 Test: m Change-Id: I5b0e14783ac927365dd98718bf399e94ab76aa13 --- filesystem/vbmeta.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/filesystem/vbmeta.go b/filesystem/vbmeta.go index 63e0abaac..43a2f3712 100644 --- a/filesystem/vbmeta.go +++ b/filesystem/vbmeta.go @@ -63,6 +63,17 @@ type vbmetaProperties struct { // List of chained partitions that this vbmeta deletages the verification. Chained_partitions []chainedPartitionProperties + + // List of key-value pair of avb properties + Avb_properties []avbProperty +} + +type avbProperty struct { + // Key of given avb property + Key *string + + // Value of given avb property + Value *string } type chainedPartitionProperties struct { @@ -135,6 +146,20 @@ func (v *vbmeta) GenerateAndroidBuildActions(ctx android.ModuleContext) { } cmd.FlagWithArg("--rollback_index_location ", strconv.Itoa(ril)) + for _, avb_prop := range v.properties.Avb_properties { + key := proptools.String(avb_prop.Key) + if key == "" { + ctx.PropertyErrorf("avb_properties", "key must be specified") + continue + } + value := proptools.String(avb_prop.Value) + if value == "" { + ctx.PropertyErrorf("avb_properties", "value must be specified") + continue + } + cmd.FlagWithArg("--prop ", key+":"+value) + } + for _, p := range ctx.GetDirectDepsWithTag(vbmetaPartitionDep) { f, ok := p.(Filesystem) if !ok {