Build system_other image in soong-only builds
This just builds an empty system_other image for now, the dexpreopt
files will be added in a followup change.
Bug: 390269431
Test: m --soong-only
Change-Id: Ic4a9bcb8b7ba1eb4444b3339d6c0b0cdfd485714
diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go
index d00ebb2..6166074 100644
--- a/fsgen/filesystem_creator.go
+++ b/fsgen/filesystem_creator.go
@@ -156,6 +156,23 @@
}
}
+ var systemOtherImageName string
+ if buildingSystemOtherImage(partitionVars) {
+ systemModule := generatedModuleNameForPartition(ctx.Config(), "system")
+ systemOtherImageName = generatedModuleNameForPartition(ctx.Config(), "system_other")
+ ctx.CreateModule(
+ filesystem.SystemOtherImageFactory,
+ &filesystem.SystemOtherImageProperties{
+ System_image: &systemModule,
+ },
+ &struct {
+ Name *string
+ }{
+ Name: proptools.StringPtr(systemOtherImageName),
+ },
+ )
+ }
+
for _, x := range createVbmetaPartitions(ctx, finalSoongGeneratedPartitions) {
f.properties.Vbmeta_module_names = append(f.properties.Vbmeta_module_names, x.moduleName)
f.properties.Vbmeta_partition_names = append(f.properties.Vbmeta_partition_names, x.partitionName)
@@ -163,7 +180,7 @@
var superImageSubpartitions []string
if buildingSuperImage(partitionVars) {
- superImageSubpartitions = createSuperImage(ctx, finalSoongGeneratedPartitions, partitionVars)
+ superImageSubpartitions = createSuperImage(ctx, finalSoongGeneratedPartitions, partitionVars, systemOtherImageName)
f.properties.Super_image = ":" + generatedModuleNameForPartition(ctx.Config(), "super")
}
@@ -183,6 +200,12 @@
return generatedModuleName(cfg, fmt.Sprintf("%s_image", partitionType))
}
+func buildingSystemOtherImage(partitionVars android.PartitionVariables) bool {
+ // TODO: Recreate this logic from make instead of just depending on the final result variable:
+ // https://cs.android.com/android/platform/superproject/main/+/main:build/make/core/board_config.mk;l=429;drc=15a0df840e7093f65518003ab80cf24a3d9e8e6a
+ return partitionVars.BuildingSystemOtherImage
+}
+
func (f *filesystemCreator) createBootloaderFilegroup(ctx android.LoadHookContext) (string, bool) {
bootloaderPath := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.PrebuiltBootloader
if len(bootloaderPath) == 0 {
diff --git a/fsgen/super_img.go b/fsgen/super_img.go
index 5c23868..e353688 100644
--- a/fsgen/super_img.go
+++ b/fsgen/super_img.go
@@ -27,7 +27,12 @@
return partitionVars.ProductBuildSuperPartition
}
-func createSuperImage(ctx android.LoadHookContext, partitions []string, partitionVars android.PartitionVariables) []string {
+func createSuperImage(
+ ctx android.LoadHookContext,
+ partitions []string,
+ partitionVars android.PartitionVariables,
+ systemOtherImageName string,
+) []string {
baseProps := &struct {
Name *string
}{
@@ -79,6 +84,10 @@
}
superImageProps.Partition_groups = partitionGroupsInfo
+ if systemOtherImageName != "" {
+ superImageProps.System_other_partition = proptools.StringPtr(systemOtherImageName)
+ }
+
var superImageSubpartitions []string
partitionNameProps := &filesystem.SuperImagePartitionNameProperties{}
if android.InList("system", partitions) {