summaryrefslogtreecommitdiff
path: root/filesystem/filesystem.go
diff options
context:
space:
mode:
author Nikita Ioffe <ioffe@google.com> 2024-04-08 11:20:39 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-04-08 11:20:39 +0000
commit97d771adf4ba7fe651c775811278ea096a60a5fc (patch)
tree9d0dd08143befb53a1fd5c445938dc2d3ef28b41 /filesystem/filesystem.go
parentd22fcc425e32d7fef07a7b469ec1b1e82f03dc7d (diff)
parent2c8cdc61667fd5295504fb07de0c5b41f6868d5a (diff)
Merge "Add support for rollback_index to android_filesystem module" into main
Diffstat (limited to 'filesystem/filesystem.go')
-rw-r--r--filesystem/filesystem.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index e640c5dae..61127bf16 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -20,6 +20,7 @@ import (
"io"
"path/filepath"
"slices"
+ "strconv"
"strings"
"android/soong/android"
@@ -82,6 +83,9 @@ type filesystemProperties struct {
// avbtool. Default used by avbtool is sha1.
Avb_hash_algorithm *string
+ // The index used to prevent rollback of the image. Only used if use_avb is true.
+ Rollback_index *int64
+
// Name of the partition stored in vbmeta desc. Defaults to the name of this module.
Partition_name *string
@@ -352,6 +356,13 @@ func (f *filesystem) buildPropFile(ctx android.ModuleContext) (propFile android.
if hashAlgorithm := proptools.String(f.properties.Avb_hash_algorithm); hashAlgorithm != "" {
avb_add_hashtree_footer_args += " --hash_algorithm " + hashAlgorithm
}
+ if f.properties.Rollback_index != nil {
+ rollbackIndex := proptools.Int(f.properties.Rollback_index)
+ if rollbackIndex < 0 {
+ ctx.PropertyErrorf("rollback_index", "Rollback index must be non-negative")
+ }
+ avb_add_hashtree_footer_args += " --rollback_index " + strconv.Itoa(rollbackIndex)
+ }
securityPatchKey := "com.android.build." + f.partitionName() + ".security_patch"
securityPatchValue := ctx.Config().PlatformSecurityPatch()
avb_add_hashtree_footer_args += " --prop " + securityPatchKey + ":" + securityPatchValue