Soong support for rollback index.

avbtool already supports --rollback_index. Allow soong support as well
to enable images to include it in their targets.

Test: Builds
Test: avbtool info_image on a target built using rule `avb_add_hash_footer`
Bug: 296830692
Change-Id: Id32f30d026b01172c5dadc0698938acb2c2c8e35
This commit is contained in:
Shikha Panwar 2023-09-11 13:51:47 +00:00
parent 86b9b13607
commit e56c9017c1

View file

@ -68,6 +68,9 @@ type avbAddHashFooterProperties struct {
// List of properties to add to the footer // List of properties to add to the footer
Props []avbProp Props []avbProp
// The index used to prevent rollback of the image on device.
Rollback_index *int64
// Include descriptors from images // Include descriptors from images
Include_descriptors_from_images []string `android:"path,arch_variant"` Include_descriptors_from_images []string `android:"path,arch_variant"`
} }
@ -128,6 +131,14 @@ func (a *avbAddHashFooter) GenerateAndroidBuildActions(ctx android.ModuleContext
addAvbProp(ctx, cmd, prop) addAvbProp(ctx, cmd, prop)
} }
if a.properties.Rollback_index != nil {
rollbackIndex := proptools.Int(a.properties.Rollback_index)
if rollbackIndex < 0 {
ctx.PropertyErrorf("rollback_index", "Rollback index must be non-negative")
}
cmd.Flag(fmt.Sprintf(" --rollback_index %x", rollbackIndex))
}
cmd.FlagWithOutput("--image ", a.output) cmd.FlagWithOutput("--image ", a.output)
builder.Build("avbAddHashFooter", fmt.Sprintf("avbAddHashFooter %s", ctx.ModuleName())) builder.Build("avbAddHashFooter", fmt.Sprintf("avbAddHashFooter %s", ctx.ModuleName()))