diff options
-rw-r--r-- | filesystem/android_device.go | 11 | ||||
-rw-r--r-- | filesystem/vbmeta.go | 18 | ||||
-rw-r--r-- | fsgen/vbmeta_partitions.go | 16 |
3 files changed, 33 insertions, 12 deletions
diff --git a/filesystem/android_device.go b/filesystem/android_device.go index 02bad0a3c..18276d43e 100644 --- a/filesystem/android_device.go +++ b/filesystem/android_device.go @@ -840,14 +840,25 @@ func (a *androidDevice) addMiscInfo(ctx android.ModuleContext) android.Path { Textf("echo avb_enable=true >> %s", miscInfo). Textf("&& echo avb_building_vbmeta_image=true >> %s", miscInfo). Textf("&& echo avb_avbtool=avbtool >> %s", miscInfo) + + var allChainedVbmetaPartitionTypes []string for _, vbmetaPartitionName := range a.partitionProps.Vbmeta_partitions { img := ctx.GetDirectDepProxyWithTag(vbmetaPartitionName, filesystemDepTag) if provider, ok := android.OtherModuleProvider(ctx, img, vbmetaPartitionProvider); ok { builder.Command().Text("cat").Input(provider.PropFileForMiscInfo).Textf(" >> %s", miscInfo) + if provider.FilesystemPartitionType != "" { // the top-level vbmeta.img + allChainedVbmetaPartitionTypes = append(allChainedVbmetaPartitionTypes, provider.FilesystemPartitionType) + } } else { ctx.ModuleErrorf("vbmeta dep %s does not set vbmetaPartitionProvider\n", vbmetaPartitionName) } } + // Determine the custom vbmeta partitions by removing system and vendor + customVbmetaPartitionTypes := android.RemoveListFromList(allChainedVbmetaPartitionTypes, []string{"system", "vendor"}) + builder.Command().Textf("echo avb_custom_vbmeta_images_partition_list=%s >> %s", + strings.Join(android.SortedUniqueStrings(customVbmetaPartitionTypes), " "), + miscInfo, + ) } if a.partitionProps.Boot_partition_name != nil { diff --git a/filesystem/vbmeta.go b/filesystem/vbmeta.go index d59a2aec5..e7a39bef7 100644 --- a/filesystem/vbmeta.go +++ b/filesystem/vbmeta.go @@ -55,6 +55,10 @@ type VbmetaProperties struct { // Name of the partition stored in vbmeta desc. Defaults to the name of this module. Partition_name *string + // Type of the `android_filesystem` for which the vbmeta.img is created. + // Examples are system, vendor, product. + Filesystem_partition_type *string + // Set the name of the output. Defaults to <module_name>.img. Stem *string @@ -118,6 +122,9 @@ type vbmetaPartitionInfo struct { // Name of the partition Name string + // Partition type of the correspdonding android_filesystem. + FilesystemPartitionType string + // Rollback index location, non-negative int RollbackIndexLocation int @@ -305,11 +312,12 @@ func (v *vbmeta) GenerateAndroidBuildActions(ctx android.ModuleContext) { }) android.SetProvider(ctx, vbmetaPartitionProvider, vbmetaPartitionInfo{ - Name: v.partitionName(), - RollbackIndexLocation: ril, - PublicKey: extractedPublicKey, - Output: output, - PropFileForMiscInfo: v.buildPropFileForMiscInfo(ctx), + Name: v.partitionName(), + FilesystemPartitionType: proptools.String(v.properties.Filesystem_partition_type), + RollbackIndexLocation: ril, + PublicKey: extractedPublicKey, + Output: output, + PropFileForMiscInfo: v.buildPropFileForMiscInfo(ctx), }) ctx.SetOutputFiles([]android.Path{output}, "") diff --git a/fsgen/vbmeta_partitions.go b/fsgen/vbmeta_partitions.go index 11f4bd013..594c40482 100644 --- a/fsgen/vbmeta_partitions.go +++ b/fsgen/vbmeta_partitions.go @@ -76,6 +76,7 @@ func (f *filesystemCreator) createVbmetaPartitions(ctx android.LoadHookContext, var chainedPartitionTypes []string for _, chainedName := range android.SortedKeys(partitionVars.ChainedVbmetaPartitions) { props := partitionVars.ChainedVbmetaPartitions[chainedName] + filesystemPartitionType := chainedName chainedName = "vbmeta_" + chainedName if len(props.Partitions) == 0 { continue @@ -123,13 +124,14 @@ func (f *filesystemCreator) createVbmetaPartitions(ctx android.LoadHookContext, filesystem.VbmetaFactory, ".", // Create in the root directory for now so its easy to get the key &filesystem.VbmetaProperties{ - Partition_name: proptools.StringPtr(chainedName), - Stem: proptools.StringPtr(chainedName + ".img"), - Private_key: proptools.StringPtr(props.Key), - Algorithm: &props.Algorithm, - Rollback_index: rollbackIndex, - Rollback_index_location: &ril, - Partitions: proptools.NewSimpleConfigurable(partitionModules), + Partition_name: proptools.StringPtr(chainedName), + Filesystem_partition_type: proptools.StringPtr(filesystemPartitionType), + Stem: proptools.StringPtr(chainedName + ".img"), + Private_key: proptools.StringPtr(props.Key), + Algorithm: &props.Algorithm, + Rollback_index: rollbackIndex, + Rollback_index_location: &ril, + Partitions: proptools.NewSimpleConfigurable(partitionModules), }, &struct { Name *string }{ |