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
diff --git a/filesystem/android_device.go b/filesystem/android_device.go
index a251942..56a681f 100644
--- a/filesystem/android_device.go
+++ b/filesystem/android_device.go
@@ -121,6 +121,7 @@
rootDirForFsConfigTimestamp android.Path
apkCertsInfo android.Path
targetFilesZip android.Path
+ updatePackage android.Path
}
func AndroidDeviceFactory() android.Module {
@@ -200,6 +201,7 @@
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 @@
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 @@
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
}