Revert "Build vbmeta partitions with soong"
Revert submission 3341139-vbmeta_partitions_in_soong
Reason for revert: DroidMonitor: Potential culprit for http://b/377943457.
Reverted changes: /q/submissionid:3341139-vbmeta_partitions_in_soong
Change-Id: I7a3aeacc91f17832688ee4d917cdee34db5d4a1b
diff --git a/filesystem/android_device.go b/filesystem/android_device.go
index 2645dc4..9071272 100644
--- a/filesystem/android_device.go
+++ b/filesystem/android_device.go
@@ -34,8 +34,6 @@
Vendor_partition_name *string
// Name of the Odm partition filesystem module
Odm_partition_name *string
- // The vbmeta partition and its "chained" partitions
- Vbmeta_partitions []string
}
type androidDevice struct {
@@ -48,6 +46,7 @@
module := &androidDevice{}
module.AddProperties(&module.partitionProps)
android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon)
+
return module
}
@@ -70,9 +69,6 @@
addDependencyIfDefined(a.partitionProps.Product_partition_name)
addDependencyIfDefined(a.partitionProps.Vendor_partition_name)
addDependencyIfDefined(a.partitionProps.Odm_partition_name)
- for _, vbmetaPartition := range a.partitionProps.Vbmeta_partitions {
- ctx.AddDependency(ctx.Module(), filesystemDepTag, vbmetaPartition)
- }
}
func (a *androidDevice) GenerateAndroidBuildActions(ctx android.ModuleContext) {
diff --git a/filesystem/vbmeta.go b/filesystem/vbmeta.go
index 6a3fc1f..0bae479 100644
--- a/filesystem/vbmeta.go
+++ b/filesystem/vbmeta.go
@@ -25,19 +25,19 @@
)
func init() {
- android.RegisterModuleType("vbmeta", VbmetaFactory)
+ android.RegisterModuleType("vbmeta", vbmetaFactory)
}
type vbmeta struct {
android.ModuleBase
- properties VbmetaProperties
+ properties vbmetaProperties
output android.OutputPath
installDir android.InstallPath
}
-type VbmetaProperties struct {
+type vbmetaProperties struct {
// Name of the partition stored in vbmeta desc. Defaults to the name of this module.
Partition_name *string
@@ -50,8 +50,9 @@
// Algorithm that avbtool will use to sign this vbmeta image. Default is SHA256_RSA4096.
Algorithm *string
- // The rollback index. If unspecified, the rollback index is from PLATFORM_SECURITY_PATCH
- Rollback_index *int64
+ // File whose content will provide the rollback index. If unspecified, the rollback index
+ // is from PLATFORM_SECURITY_PATCH
+ Rollback_index_file *string `android:"path"`
// Rollback index location of this vbmeta image. Must be 0, 1, 2, etc. Default is 0.
Rollback_index_location *int64
@@ -61,7 +62,7 @@
Partitions proptools.Configurable[[]string]
// List of chained partitions that this vbmeta deletages the verification.
- Chained_partitions []ChainedPartitionProperties
+ Chained_partitions []chainedPartitionProperties
// List of key-value pair of avb properties
Avb_properties []avbProperty
@@ -75,7 +76,7 @@
Value *string
}
-type ChainedPartitionProperties struct {
+type chainedPartitionProperties struct {
// Name of the chained partition
Name *string
@@ -94,7 +95,7 @@
}
// vbmeta is the partition image that has the verification information for other partitions.
-func VbmetaFactory() android.Module {
+func vbmetaFactory() android.Module {
module := &vbmeta{}
module.AddProperties(&module.properties)
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
@@ -216,12 +217,15 @@
// Returns the embedded shell command that prints the rollback index
func (v *vbmeta) rollbackIndexCommand(ctx android.ModuleContext) string {
- if v.properties.Rollback_index != nil {
- return fmt.Sprintf("%d", *v.properties.Rollback_index)
+ var cmd string
+ if v.properties.Rollback_index_file != nil {
+ f := android.PathForModuleSrc(ctx, proptools.String(v.properties.Rollback_index_file))
+ cmd = "cat " + f.String()
} else {
- // Take the first line and remove the newline char
- return "$(date -d 'TZ=\"GMT\" " + ctx.Config().PlatformSecurityPatch() + "' +%s | head -1 | tr -d '\n'" + ")"
+ cmd = "date -d 'TZ=\"GMT\" " + ctx.Config().PlatformSecurityPatch() + "' +%s"
}
+ // Take the first line and remove the newline char
+ return "$(" + cmd + " | head -1 | tr -d '\n'" + ")"
}
// Extract public keys from chained_partitions.private_key. The keys are indexed with the partition