diff options
author | 2025-01-09 18:11:59 +0000 | |
---|---|---|
committer | 2025-01-10 00:32:29 +0000 | |
commit | e51ff957ad1fb2ecc03d82e293069c764c014c3c (patch) | |
tree | e2e70201dffff69547953f0095ccde8eb19ab7f3 | |
parent | 41692ce4861588107d0db45dae059f53c6405c01 (diff) |
Add android-info.txt to OTA/ subdir of target_files.zip
This information will be provided by an explicit `Android_info` property
on `andorid_device`. An alternative would be to propagate this
information from vendor_partition dependency, but that might run into
issues if android_info.txt is no longer used a prop file input for
building vendor's build.prop file
Test: diff'd target_files.zip of make and soong
Fixes: 388633397
Change-Id: Iaacffd0526b6ce7a7ce1566774753d4e20d9f9a2
-rw-r--r-- | android/android_info.go | 1 | ||||
-rw-r--r-- | filesystem/android_device.go | 7 | ||||
-rw-r--r-- | fsgen/filesystem_creator.go | 18 |
3 files changed, 20 insertions, 6 deletions
diff --git a/android/android_info.go b/android/android_info.go index f2cbc65bd..225c8f0ae 100644 --- a/android/android_info.go +++ b/android/android_info.go @@ -81,6 +81,7 @@ func (p *androidInfoModule) GenerateAndroidBuildActions(ctx ModuleContext) { }) ctx.SetOutputFiles(Paths{androidInfoProp}, "") + ctx.SetOutputFiles(Paths{androidInfoTxt}, ".txt") builder := NewRuleBuilder(pctx, ctx) builder.Command().Text("touch").Output(timestamp) diff --git a/filesystem/android_device.go b/filesystem/android_device.go index 4b615bc51..406f47cbe 100644 --- a/filesystem/android_device.go +++ b/filesystem/android_device.go @@ -57,6 +57,8 @@ type PartitionNameProperties struct { type DeviceProperties struct { // Path to the prebuilt bootloader that would be copied to PRODUCT_OUT Bootloader *string `android:"path"` + // Path to android-info.txt file containing board specific info. + Android_info *string `android:"path"` } type androidDevice struct { @@ -231,6 +233,11 @@ func (a *androidDevice) buildTargetFilesZip(ctx android.ModuleContext) { } } + if a.deviceProps.Android_info != nil { + builder.Command().Textf("mkdir -p %s/OTA", targetFilesDir) + builder.Command().Textf("cp %s %s/OTA/android-info.txt", android.PathForModuleSrc(ctx, proptools.String(a.deviceProps.Android_info)), targetFilesDir) + } + builder.Command(). BuiltTool("soong_zip"). Text("-d"). diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go index 376c5d968..590d33ae4 100644 --- a/fsgen/filesystem_creator.go +++ b/fsgen/filesystem_creator.go @@ -128,6 +128,8 @@ func (f *filesystemCreator) createInternalModules(ctx android.LoadHookContext) { f.properties.Unsupported_partition_types = append(f.properties.Unsupported_partition_types, partitionType) } } + // Create android_info.prop + f.createAndroidInfo(ctx) partitionVars := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse dtbImg := createDtbImgFilegroup(ctx) @@ -206,9 +208,11 @@ func (f *filesystemCreator) createDeviceModule( vbmetaPartitions []string, ) { baseProps := &struct { - Name *string + Name *string + Android_info *string }{ - Name: proptools.StringPtr(generatedModuleName(ctx.Config(), "device")), + Name: proptools.StringPtr(generatedModuleName(ctx.Config(), "device")), + Android_info: proptools.StringPtr(":" + generatedModuleName(ctx.Config(), "android_info.prop{.txt}")), } // Currently, only the system and system_ext partition module is created. @@ -600,8 +604,8 @@ func (f *filesystemCreator) createPrebuiltKernelModules(ctx android.LoadHookCont (*fsGenState.fsDeps[partitionType])[name] = defaultDepCandidateProps(ctx.Config()) } -// Create a build_prop and android_info module. This will be used to create /vendor/build.prop -func (f *filesystemCreator) createVendorBuildProp(ctx android.LoadHookContext) { +// Create an android_info module. This will be used to create /vendor/build.prop +func (f *filesystemCreator) createAndroidInfo(ctx android.LoadHookContext) { // Create a android_info for vendor // The board info files might be in a directory outside the root soong namespace, so create // the module in "." @@ -625,7 +629,9 @@ func (f *filesystemCreator) createVendorBuildProp(ctx android.LoadHookContext) { androidInfoProps, ) androidInfoProp.HideFromMake() - // Create a build prop for vendor +} + +func (f *filesystemCreator) createVendorBuildProp(ctx android.LoadHookContext) { vendorBuildProps := &struct { Name *string Vendor *bool @@ -638,7 +644,7 @@ func (f *filesystemCreator) createVendorBuildProp(ctx android.LoadHookContext) { Vendor: proptools.BoolPtr(true), Stem: proptools.StringPtr("build.prop"), Product_config: proptools.StringPtr(":product_config"), - Android_info: proptools.StringPtr(":" + androidInfoProp.Name()), + Android_info: proptools.StringPtr(":" + generatedModuleName(ctx.Config(), "android_info.prop")), Licenses: []string{"Android-Apache-2.0"}, } vendorBuildProp := ctx.CreateModule( |