diff options
author | 2025-01-15 21:12:36 +0000 | |
---|---|---|
committer | 2025-01-15 22:39:07 +0000 | |
commit | 29d44884a007ebf2046a3e6bb1412381f47cbeaf (patch) | |
tree | b8a9e7510733fa450b82fc8e2a0a76377cb97b01 /filesystem/android_device.go | |
parent | 2da9d9abca8e1a355f8b9fcbb3ae550bfb40a8b6 (diff) |
Create a partial META/ subdir in soong target_files.zip
This CL adds the following files to META/
- update_engine_config.txt
- zucchini_config.txt
- liblz4.so
Bug: 388633394
Test: Built the target_files.zip locally and diffed META/ subdir between
make and soong
Change-Id: Iad635e1382362929beecbc1c9d89e314eddcc90f
Diffstat (limited to 'filesystem/android_device.go')
-rw-r--r-- | filesystem/android_device.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/filesystem/android_device.go b/filesystem/android_device.go index e340602cd..eb2e0367a 100644 --- a/filesystem/android_device.go +++ b/filesystem/android_device.go @@ -68,6 +68,8 @@ type DeviceProperties struct { // one will be determined based on the lunch product. TODO: Figure out how to make this // blueprint:"mutated" and still set it from filesystem_creator Main_device *bool + + Ab_ota_updater *bool } type androidDevice struct { @@ -94,9 +96,13 @@ type partitionDepTagType struct { type superPartitionDepTagType struct { blueprint.BaseDependencyTag } +type targetFilesMetadataDepTagType struct { + blueprint.BaseDependencyTag +} var superPartitionDepTag superPartitionDepTagType var filesystemDepTag partitionDepTagType +var targetFilesMetadataDepTag targetFilesMetadataDepTagType func (a *androidDevice) DepsMutator(ctx android.BottomUpMutatorContext) { addDependencyIfDefined := func(dep *string) { @@ -124,6 +130,11 @@ func (a *androidDevice) DepsMutator(ctx android.BottomUpMutatorContext) { for _, vbmetaPartition := range a.partitionProps.Vbmeta_partitions { ctx.AddDependency(ctx.Module(), filesystemDepTag, vbmetaPartition) } + a.addDepsForTargetFilesMetadata(ctx) +} + +func (a *androidDevice) addDepsForTargetFilesMetadata(ctx android.BottomUpMutatorContext) { + ctx.AddFarVariationDependencies(ctx.Config().BuildOSTarget.Variations(), targetFilesMetadataDepTag, "liblz4") // host variant } func (a *androidDevice) GenerateAndroidBuildActions(ctx android.ModuleContext) { @@ -326,6 +337,7 @@ func (a *androidDevice) buildTargetFilesZip(ctx android.ModuleContext) { } a.copyImagesToTargetZip(ctx, builder, targetFilesDir) + a.copyMetadataToTargetZip(ctx, builder, targetFilesDir) builder.Command(). BuiltTool("soong_zip"). @@ -373,6 +385,19 @@ func (a *androidDevice) copyImagesToTargetZip(ctx android.ModuleContext, builder } } +func (a *androidDevice) copyMetadataToTargetZip(ctx android.ModuleContext, builder *android.RuleBuilder, targetFilesDir android.WritablePath) { + // Create a META/ subdirectory + builder.Command().Textf("mkdir -p %s/META", targetFilesDir.String()) + if proptools.Bool(a.deviceProps.Ab_ota_updater) { + ctx.VisitDirectDepsProxyWithTag(targetFilesMetadataDepTag, func(child android.ModuleProxy) { + info, _ := android.OtherModuleProvider(ctx, child, android.OutputFilesProvider) + builder.Command().Textf("cp").Inputs(info.DefaultOutputFiles).Textf(" %s/META/", targetFilesDir.String()) + }) + } + builder.Command().Textf("cp").Input(android.PathForSource(ctx, "external/zucchini/version_info.h")).Textf(" %s/META/zucchini_config.txt", targetFilesDir.String()) + builder.Command().Textf("cp").Input(android.PathForSource(ctx, "system/update_engine/update_engine.conf")).Textf(" %s/META/update_engine_config.txt", targetFilesDir.String()) +} + func (a *androidDevice) getFilesystemInfo(ctx android.ModuleContext, depName string) FilesystemInfo { fsMod := ctx.GetDirectDepProxyWithTag(depName, filesystemDepTag) fsInfo, ok := android.OtherModuleProvider(ctx, fsMod, FilesystemProvider) |