diff options
author | 2025-03-24 15:34:47 -0700 | |
---|---|---|
committer | 2025-03-24 15:34:47 -0700 | |
commit | dd87ef7feffcdcbda716508309c6e52d259388a4 (patch) | |
tree | 0628bed2ae42d053664a185ac76f9382efb65a8c /filesystem/android_device.go | |
parent | 3c3748a4fefa6c025d273220c8a347ce3ea1c440 (diff) | |
parent | f1153bd2f8a150711b7bfbd54b96667861cc7382 (diff) |
Merge "Build and dist updatepackage" into main
Diffstat (limited to 'filesystem/android_device.go')
-rw-r--r-- | filesystem/android_device.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/filesystem/android_device.go b/filesystem/android_device.go index 9a085a628..8b6ea4937 100644 --- a/filesystem/android_device.go +++ b/filesystem/android_device.go @@ -121,6 +121,7 @@ type androidDevice struct { rootDirForFsConfigTimestamp android.Path apkCertsInfo android.Path targetFilesZip android.Path + updatePackage android.Path } func AndroidDeviceFactory() android.Module { @@ -200,6 +201,7 @@ func (a *androidDevice) GenerateAndroidBuildActions(ctx android.ModuleContext) { a.miscInfo = a.addMiscInfo(ctx) a.buildTargetFilesZip(ctx, allInstalledModules) a.buildProguardZips(ctx, allInstalledModules) + a.buildUpdatePackage(ctx) var deps []android.Path if proptools.String(a.partitionProps.Super_partition_name) != "" { @@ -405,6 +407,9 @@ func (a *androidDevice) distFiles(ctx android.ModuleContext) { if a.targetFilesZip != nil { ctx.DistForGoalWithFilename("target-files-package", a.targetFilesZip, namePrefix+insertBeforeExtension(a.targetFilesZip.Base(), "-FILE_NAME_TAG_PLACEHOLDER")) } + if a.updatePackage != nil { + ctx.DistForGoalWithFilename("updatepackage", a.updatePackage, namePrefix+insertBeforeExtension(a.updatePackage.Base(), "-FILE_NAME_TAG_PLACEHOLDER")) + } } } @@ -948,6 +953,38 @@ func (a *androidDevice) addImgToTargetFiles(ctx android.ModuleContext, builder * Text(targetFilesDir) } +func (a *androidDevice) buildUpdatePackage(ctx android.ModuleContext) { + var exclusions []string + fsInfos := a.getFsInfos(ctx) + // Exclude the partitions that are not supported by flashall + for _, partition := range android.SortedKeys(fsInfos) { + if fsInfos[partition].NoFlashall { + exclusions = append(exclusions, fmt.Sprintf("IMAGES/%s.img", partition)) + exclusions = append(exclusions, fmt.Sprintf("IMAGES/%s.map", partition)) + } + } + + updatePackage := android.PathForModuleOut(ctx, "img.zip") + rule := android.NewRuleBuilder(pctx, ctx) + + buildSuperImage := ctx.Config().HostToolPath(ctx, "build_super_image") + zip2zip := ctx.Config().HostToolPath(ctx, "zip2zip") + + rule.Command(). + BuiltTool("img_from_target_files"). + Text("--additional IMAGES/VerifiedBootParams.textproto:VerifiedBootParams.textproto"). + FlagForEachArg("--exclude ", exclusions). + FlagWithArg("--build_super_image ", buildSuperImage.String()). + Implicit(buildSuperImage). + Implicit(zip2zip). + Input(a.targetFilesZip). + Output(updatePackage) + + rule.Build("updatepackage", "Building updatepackage") + + a.updatePackage = updatePackage +} + type ApexKeyPathInfo struct { ApexKeyPath android.Path } |