Autogenerate a soong module to build odm.img
Test: With https://r.android.com/3326400, notice files are the only
diffs for AOSP CF odm.img
Bug: 376755916
Change-Id: I847f0dc8317d9693de39fed19aeac4e7f8a70152
diff --git a/android/config.go b/android/config.go
index 8c4b5cd..616385a 100644
--- a/android/config.go
+++ b/android/config.go
@@ -1549,6 +1549,10 @@
return "odm"
}
+func (c *deviceConfig) BuildingOdmImage() bool {
+ return proptools.Bool(c.config.productVariables.BuildingOdmImage)
+}
+
func (c *deviceConfig) ProductPath() string {
if c.config.productVariables.ProductPath != nil {
return *c.config.productVariables.ProductPath
diff --git a/android/variable.go b/android/variable.go
index a386473..4cdf5fb 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -341,6 +341,7 @@
VendorPath *string `json:",omitempty"`
BuildingVendorImage *bool `json:",omitempty"`
OdmPath *string `json:",omitempty"`
+ BuildingOdmImage *bool `json:",omitempty"`
ProductPath *string `json:",omitempty"`
BuildingProductImage *bool `json:",omitempty"`
SystemExtPath *string `json:",omitempty"`
diff --git a/filesystem/android_device.go b/filesystem/android_device.go
index 68e6053..9071272 100644
--- a/filesystem/android_device.go
+++ b/filesystem/android_device.go
@@ -32,6 +32,8 @@
Product_partition_name *string
// Name of the Vendor partition filesystem module
Vendor_partition_name *string
+ // Name of the Odm partition filesystem module
+ Odm_partition_name *string
}
type androidDevice struct {
@@ -66,6 +68,7 @@
addDependencyIfDefined(a.partitionProps.System_ext_partition_name)
addDependencyIfDefined(a.partitionProps.Product_partition_name)
addDependencyIfDefined(a.partitionProps.Vendor_partition_name)
+ addDependencyIfDefined(a.partitionProps.Odm_partition_name)
}
func (a *androidDevice) GenerateAndroidBuildActions(ctx android.ModuleContext) {
diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go
index bf5dfd9..71af3f9 100644
--- a/fsgen/filesystem_creator.go
+++ b/fsgen/filesystem_creator.go
@@ -116,6 +116,9 @@
if ctx.DeviceConfig().BuildingProductImage() && ctx.DeviceConfig().ProductPath() == "product" {
generatedPartitions = append(generatedPartitions, "product")
}
+ if ctx.DeviceConfig().BuildingOdmImage() && ctx.DeviceConfig().OdmPath() == "odm" {
+ generatedPartitions = append(generatedPartitions, "odm")
+ }
return &FsGenState{
depCandidates: candidates,
@@ -144,7 +147,12 @@
"fs_config_dirs_vendor": defaultDepCandidateProps(ctx.Config()),
generatedModuleName(ctx.Config(), "vendor-build.prop"): defaultDepCandidateProps(ctx.Config()),
},
- "odm": newMultilibDeps(),
+ "odm": &map[string]*depCandidateProps{
+ // fs_config_* files are automatically installed for all products with odm partitions.
+ // https://cs.android.com/android/_/android/platform/build/+/e4849e87ab660b59a6501b3928693db065ee873b:tools/fs_config/Android.mk;l=34;drc=8d6481b92c4b4e9b9f31a61545b6862090fcc14b;bpv=1;bpt=0
+ "fs_config_files_odm": defaultDepCandidateProps(ctx.Config()),
+ "fs_config_dirs_odm": defaultDepCandidateProps(ctx.Config()),
+ },
"product": newMultilibDeps(),
"system_ext": &map[string]*depCandidateProps{
// VNDK apexes are automatically included.
@@ -418,6 +426,9 @@
if android.InList("product", f.properties.Generated_partition_types) {
partitionProps.Product_partition_name = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "product"))
}
+ if android.InList("odm", f.properties.Generated_partition_types) {
+ partitionProps.Odm_partition_name = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "odm"))
+ }
ctx.CreateModule(filesystem.AndroidDeviceFactory, baseProps, partitionProps)
}
@@ -461,6 +472,15 @@
},
}
fsProps.Base_dir = proptools.StringPtr("vendor")
+ case "odm":
+ fsProps.Symlinks = []filesystem.SymlinkDefinition{
+ filesystem.SymlinkDefinition{
+ Target: proptools.StringPtr("/odm_dlkm/lib/modules"),
+ Name: proptools.StringPtr("odm/lib/modules"),
+ },
+ }
+ fsProps.Base_dir = proptools.StringPtr("odm")
+
}
}
@@ -702,7 +722,7 @@
if !fsTypeSupported {
return ""
}
- if partitionType == "vendor" {
+ if partitionType == "vendor" || partitionType == "odm" {
return "" // TODO: Handle struct props
}