Autogenerate vendor_dlkm and odm_dlkm
vendor_dlkm has a depdedency on system_dlkm, and its prebuilt kernel
modules will be listed as deps.
Bug: 377562851
Bug: 377563262
Test: m soong_generated_vendor_dlkm_filesystem_test
NOTICE and /lib/modules/modules.blocklist missing
Test: m soong_generated_odm_dlkm_filesystem_test
NOTICE file missing
Test: verified that modules.dep,modules.load are bit identical between
kati and soong for AOSP CF
Change-Id: If037430313cf10f661bc2bc7bdd468ca3707b2f3
diff --git a/android/variable.go b/android/variable.go
index 037037d..af2a551 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -628,8 +628,16 @@
ProductCopyFiles map[string]string `json:",omitempty"`
- BuildingSystemDlkmImage bool `json:",omitempty"`
- SystemKernelModules []string `json:",omitempty"`
+ BuildingSystemDlkmImage bool `json:",omitempty"`
+ SystemKernelModules []string `json:",omitempty"`
+ SystemKernelBlocklistFile string `json:",omitempty"`
+ SystemKernelLoadModules []string `json:",omitempty"`
+ BuildingVendorDlkmImage bool `json:",omitempty"`
+ VendorKernelModules []string `json:",omitempty"`
+ VendorKernelBlocklistFile string `json:",omitempty"`
+ BuildingOdmDlkmImage bool `json:",omitempty"`
+ OdmKernelModules []string `json:",omitempty"`
+ OdmKernelBlocklistFile string `json:",omitempty"`
}
func boolPtr(v bool) *bool {
diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go
index 5f6475a..9cada0b 100644
--- a/fsgen/filesystem_creator.go
+++ b/fsgen/filesystem_creator.go
@@ -211,6 +211,14 @@
}
}
+var (
+ dlkmPartitions = []string{
+ "system_dlkm",
+ "vendor_dlkm",
+ "odm_dlkm",
+ }
+)
+
// Creates a soong module to build the given partition. Returns false if we can't support building
// it.
func (f *filesystemCreator) createPartition(ctx android.LoadHookContext, partitionType string) bool {
@@ -226,9 +234,8 @@
fsProps.Linkerconfig.Linker_config_srcs = f.createLinkerConfigSourceFilegroups(ctx, partitionType)
}
- if partitionType == "system_dlkm" {
- kernelModules := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.SystemKernelModules
- f.createPrebuiltKernelModules(ctx, partitionType, kernelModules)
+ if android.InList(partitionType, dlkmPartitions) {
+ f.createPrebuiltKernelModules(ctx, partitionType)
}
var module android.Module
@@ -249,24 +256,46 @@
// createPrebuiltKernelModules creates `prebuilt_kernel_modules`. These modules will be added to deps of the
// autogenerated *_dlkm filsystem modules. Each _dlkm partition should have a single prebuilt_kernel_modules dependency.
// This ensures that the depmod artifacts (modules.* installed in /lib/modules/) are generated with a complete view.
-
-// The input `kernelModules` is a space separated list of .ko files in the workspace.
-func (f *filesystemCreator) createPrebuiltKernelModules(ctx android.LoadHookContext, partitionType string, kernelModules []string) {
+func (f *filesystemCreator) createPrebuiltKernelModules(ctx android.LoadHookContext, partitionType string) {
fsGenState := ctx.Config().Get(fsGenStateOnceKey).(*FsGenState)
name := generatedModuleName(ctx.Config(), fmt.Sprintf("%s-kernel-modules", partitionType))
props := &struct {
Name *string
Srcs []string
+ System_deps []string
System_dlkm_specific *bool
- Vendor_dlkm_specific *bool // TODO (b/377562851)
- Odm_dlkm_specific *bool // TODO (b/377563262)
+ Vendor_dlkm_specific *bool
+ Odm_dlkm_specific *bool
+ Load_by_default *bool
}{
Name: proptools.StringPtr(name),
- Srcs: kernelModules,
}
- if partitionType == "system_dlkm" {
+ switch partitionType {
+ case "system_dlkm":
+ props.Srcs = ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.SystemKernelModules
props.System_dlkm_specific = proptools.BoolPtr(true)
+ if len(ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.SystemKernelLoadModules) == 0 {
+ // Create empty modules.load file for system
+ // https://source.corp.google.com/h/googleplex-android/platform/build/+/ef55daac9954896161b26db4f3ef1781b5a5694c:core/Makefile;l=695-700;drc=549fe2a5162548bd8b47867d35f907eb22332023;bpv=1;bpt=0
+ props.Load_by_default = proptools.BoolPtr(false)
+ }
+ case "vendor_dlkm":
+ props.Srcs = ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.VendorKernelModules
+ if len(ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.SystemKernelModules) > 0 {
+ props.System_deps = []string{":" + generatedModuleName(ctx.Config(), "system_dlkm-kernel-modules") + "{.modules}"}
+ }
+ props.Vendor_dlkm_specific = proptools.BoolPtr(true)
+ case "odm_dlkm":
+ props.Srcs = ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.OdmKernelModules
+ props.Odm_dlkm_specific = proptools.BoolPtr(true)
+ default:
+ ctx.ModuleErrorf("DLKM is not supported for %s\n", partitionType)
}
+
+ if len(props.Srcs) == 0 {
+ return // do not generate `prebuilt_kernel_modules` if there are no sources
+ }
+
kernelModule := ctx.CreateModuleInDirectory(
kernel.PrebuiltKernelModulesFactory,
".", // create in root directory for now
diff --git a/fsgen/fsgen_mutators.go b/fsgen/fsgen_mutators.go
index 2d4ad79..4440c63 100644
--- a/fsgen/fsgen_mutators.go
+++ b/fsgen/fsgen_mutators.go
@@ -99,6 +99,13 @@
if ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.BuildingSystemDlkmImage {
generatedPartitions = append(generatedPartitions, "system_dlkm")
}
+ if ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.BuildingVendorDlkmImage {
+ generatedPartitions = append(generatedPartitions, "vendor_dlkm")
+ }
+ if ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.BuildingOdmDlkmImage {
+ generatedPartitions = append(generatedPartitions, "odm_dlkm")
+ }
+
return generatedPartitions
}
@@ -154,6 +161,16 @@
// build props are automatically added to `ALL_DEFAULT_INSTALLED_MODULES`
"system_dlkm-build.prop": defaultDepCandidateProps(ctx.Config()),
},
+ "vendor_dlkm": {
+ "fs_config_dirs_vendor_dlkm": defaultDepCandidateProps(ctx.Config()),
+ "fs_config_files_vendor_dlkm": defaultDepCandidateProps(ctx.Config()),
+ "vendor_dlkm-build.prop": defaultDepCandidateProps(ctx.Config()),
+ },
+ "odm_dlkm": {
+ "fs_config_dirs_odm_dlkm": defaultDepCandidateProps(ctx.Config()),
+ "fs_config_files_odm_dlkm": defaultDepCandidateProps(ctx.Config()),
+ "odm_dlkm-build.prop": defaultDepCandidateProps(ctx.Config()),
+ },
},
fsDepsMutex: sync.Mutex{},
moduleToInstallationProps: map[string]installationProperties{},