diff options
-rw-r--r-- | android/variable.go | 2 | ||||
-rw-r--r-- | filesystem/android_device.go | 7 | ||||
-rw-r--r-- | fsgen/filesystem_creator.go | 23 |
3 files changed, 32 insertions, 0 deletions
diff --git a/android/variable.go b/android/variable.go index 7ac9f08e0..5bc0b297e 100644 --- a/android/variable.go +++ b/android/variable.go @@ -716,6 +716,8 @@ type PartitionVariables struct { ProductFsCompression string `json:",omitempty"` ReleaseToolsExtensionDir string `json:",omitempty"` + + BoardFastbootInfoFile string `json:",omitempty"` } func boolPtr(v bool) *bool { diff --git a/filesystem/android_device.go b/filesystem/android_device.go index 6718320e1..c0f0676af 100644 --- a/filesystem/android_device.go +++ b/filesystem/android_device.go @@ -87,6 +87,7 @@ type DeviceProperties struct { Ramdisk_node_list *string `android:"path"` Releasetools_extension *string `android:"path"` + FastbootInfo *string `android:"path"` } type androidDevice struct { @@ -621,6 +622,12 @@ func (a *androidDevice) copyMetadataToTargetZip(ctx android.ModuleContext, build } installedApexKeys = android.SortedUniquePaths(installedApexKeys) // Sort by keypath to match make builder.Command().Text("cat").Inputs(installedApexKeys).Textf(" >> %s/META/apexkeys.txt", targetFilesDir.String()) + // Copy fastboot-info.txt + if fastbootInfo := android.PathForModuleSrc(ctx, proptools.String(a.deviceProps.FastbootInfo)); fastbootInfo != nil { + // TODO (b/399788523): Autogenerate fastboot-info.txt if there is no source fastboot-info.txt + // https://cs.android.com/android/_/android/platform/build/+/80b9546f8f69e78b8fe1870e0e745d70fc18dfcd:core/Makefile;l=5831-5893;drc=077490384423dff9eac954da5c001c6f0be3fa6e;bpv=0;bpt=0 + builder.Command().Textf("cp").Input(fastbootInfo).Textf(" %s/META/fastboot-info.txt", targetFilesDir.String()) + } if a.partitionProps.Super_partition_name != nil { superPartition := ctx.GetDirectDepProxyWithTag(*a.partitionProps.Super_partition_name, superPartitionDepTag) diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go index 3d83706a3..d286c6641 100644 --- a/fsgen/filesystem_creator.go +++ b/fsgen/filesystem_creator.go @@ -340,6 +340,26 @@ func (f *filesystemCreator) createReleaseToolsFilegroup(ctx android.LoadHookCont return releaseToolsFilegroupName, true } +func (f *filesystemCreator) createFastbootInfoFilegroup(ctx android.LoadHookContext) (string, bool) { + fastbootInfoFile := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.BoardFastbootInfoFile + if fastbootInfoFile == "" { + return "", false + } + + fastbootInfoFilegroupName := generatedModuleName(ctx.Config(), "fastboot") + filegroupProps := &struct { + Name *string + Srcs []string + Visibility []string + }{ + Name: proptools.StringPtr(fastbootInfoFilegroupName), + Srcs: []string{fastbootInfoFile}, + Visibility: []string{"//visibility:public"}, + } + ctx.CreateModuleInDirectory(android.FileGroupFactory, ".", filegroupProps) + return fastbootInfoFilegroupName, true +} + func (f *filesystemCreator) createDeviceModule( ctx android.LoadHookContext, partitions allGeneratedPartitionData, @@ -413,6 +433,9 @@ func (f *filesystemCreator) createDeviceModule( if releaseTools, ok := f.createReleaseToolsFilegroup(ctx); ok { deviceProps.Releasetools_extension = proptools.StringPtr(":" + releaseTools) } + if fastbootInfo, ok := f.createFastbootInfoFilegroup(ctx); ok { + deviceProps.FastbootInfo = proptools.StringPtr(":" + fastbootInfo) + } ctx.CreateModule(filesystem.AndroidDeviceFactory, baseProps, partitionProps, deviceProps) } |