diff options
Diffstat (limited to 'filesystem/android_device.go')
-rw-r--r-- | filesystem/android_device.go | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/filesystem/android_device.go b/filesystem/android_device.go index 005dc3439..78afbf587 100644 --- a/filesystem/android_device.go +++ b/filesystem/android_device.go @@ -111,6 +111,7 @@ type androidDevice struct { proguardUsageZip android.Path kernelConfig android.Path kernelVersion android.Path + miscInfo android.Path } func AndroidDeviceFactory() android.Module { @@ -186,6 +187,7 @@ func (a *androidDevice) GenerateAndroidBuildActions(ctx android.ModuleContext) { allInstalledModules := a.allInstalledModules(ctx) a.kernelConfig, a.kernelVersion = a.extractKernelVersionAndConfigs(ctx) + a.miscInfo = a.addMiscInfo(ctx) a.buildTargetFilesZip(ctx, allInstalledModules) a.buildProguardZips(ctx, allInstalledModules) @@ -646,6 +648,10 @@ func (a *androidDevice) copyMetadataToTargetZip(ctx android.ModuleContext, build if a.kernelVersion != nil { builder.Command().Textf("cp").Input(a.kernelVersion).Textf(" %s/META/", targetFilesDir.String()) } + // misc_info.txt + if a.miscInfo != nil { + builder.Command().Textf("cp").Input(a.miscInfo).Textf(" %s/META/", targetFilesDir.String()) + } if a.partitionProps.Super_partition_name != nil { superPartition := ctx.GetDirectDepProxyWithTag(*a.partitionProps.Super_partition_name, superPartitionDepTag) @@ -660,6 +666,43 @@ func (a *androidDevice) copyMetadataToTargetZip(ctx android.ModuleContext, build } +// A partial implementation of make's $PRODUCT_OUT/misc_info.txt +// https://cs.android.com/android/platform/superproject/main/+/main:build/make/core/Makefile;l=5894?q=misc_info.txt%20f:build%2Fmake%2Fcore%2FMakefile&ss=android%2Fplatform%2Fsuperproject%2Fmain +// This file is subsequently used by add_img_to_target_files to create additioanl metadata files like apex_info.pb +// TODO (b/399788119): Complete the migration of misc_info.txt +func (a *androidDevice) addMiscInfo(ctx android.ModuleContext) android.Path { + builder := android.NewRuleBuilder(pctx, ctx) + miscInfo := android.PathForModuleOut(ctx, "misc_info.txt") + builder.Command(). + Textf("rm -f %s", miscInfo). + Textf("&& echo recovery_api_version=%s >> %s", ctx.Config().VendorConfig("recovery").String("recovery_api_version"), miscInfo). + Textf("&& echo fstab_version=%s >> %s", ctx.Config().VendorConfig("recovery").String("recovery_fstab_version"), miscInfo). + ImplicitOutput(miscInfo) + + if a.partitionProps.Recovery_partition_name == nil { + builder.Command().Textf("echo no_recovery=true >> %s", miscInfo) + } + fsInfos := a.getFsInfos(ctx) + for _, partition := range android.SortedKeys(fsInfos) { + if fsInfos[partition].UseAvb { + builder.Command().Textf("echo 'avb_%s_hashtree_enable=true' >> %s", partition, miscInfo) + } + } + if len(a.partitionProps.Vbmeta_partitions) > 0 { + builder.Command(). + Textf("echo avb_enable=true >> %s", miscInfo). + Textf("&& echo avb_building_vbmeta_image=true >> %s", miscInfo). + Textf("&& echo avb_avbtool=avbtool >> %s", miscInfo) + } + if a.partitionProps.Boot_partition_name != nil { + builder.Command().Textf("echo boot_images=boot.img >> %s", miscInfo) + } + + builder.Build("misc_info", "Building misc_info") + + return miscInfo +} + type ApexKeyPathInfo struct { ApexKeyPath android.Path } |