summaryrefslogtreecommitdiff
path: root/filesystem/android_device.go
diff options
context:
space:
mode:
author Spandan Das <spandandas@google.com> 2025-03-24 21:08:48 +0000
committer Spandan Das <spandandas@google.com> 2025-03-24 21:29:03 +0000
commitf1153bd2f8a150711b7bfbd54b96667861cc7382 (patch)
treed468b74e1d28b41d381bce3ddea1aa960331d0d1 /filesystem/android_device.go
parent27452ec5b4e8a0e6e5e82c281b091033b7152dd8 (diff)
Build and dist updatepackage
Equivalent make code: https://cs.android.com/android/_/android/platform/build/+/577341036beabe1cf4dcc479b254b878b8963b8d:core/Makefile;l=7593-7620;drc=577341036beabe1cf4dcc479b254b878b8963b8d;bpv=1;bpt=0 Some custom partitions are not included in the updatepackage. Make determines by looking at a board config variable. To implement this exclusion in Soong, a new `No_flashall` property has been added to `android_filesystem`. Bug: 383902856 Test: Built img.zip files for both make and soong Test: verified that they contain the same no. of files. Change-Id: If4df40a7ceb2ef68de27fb44f9e8db4503695e4e
Diffstat (limited to 'filesystem/android_device.go')
-rw-r--r--filesystem/android_device.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/filesystem/android_device.go b/filesystem/android_device.go
index a25194261..56a681f6d 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
}