Add installable to prebuilt_kernel_modules

Some kernel prebuilt modules are only meant to be included in
android_filesystem module, not to be installed to the device. To support
such use case, adding installable property.

Bug: 305118971
Test: build
Change-Id: Ie945fe1f8a20a2a1fea9a44bc36f94dc73fa2a40
This commit is contained in:
Inseob Kim 2023-11-06 18:07:13 +09:00
parent 74639be8a7
commit 6a463f83d8

View file

@ -50,6 +50,9 @@ type prebuiltKernelModulesProperties struct {
// Kernel version that these modules are for. Kernel modules are installed to // Kernel version that these modules are for. Kernel modules are installed to
// /lib/modules/<kernel_version> directory in the corresponding partition. Default is "". // /lib/modules/<kernel_version> directory in the corresponding partition. Default is "".
Kernel_version *string Kernel_version *string
// Whether this module is directly installable to one of the partitions. Default is true
Installable *bool
} }
// prebuilt_kernel_modules installs a set of prebuilt kernel module files to the correct directory. // prebuilt_kernel_modules installs a set of prebuilt kernel module files to the correct directory.
@ -62,6 +65,10 @@ func prebuiltKernelModulesFactory() android.Module {
return module return module
} }
func (pkm *prebuiltKernelModules) installable() bool {
return proptools.BoolDefault(pkm.properties.Installable, true)
}
func (pkm *prebuiltKernelModules) KernelVersion() string { func (pkm *prebuiltKernelModules) KernelVersion() string {
return proptools.StringDefault(pkm.properties.Kernel_version, "") return proptools.StringDefault(pkm.properties.Kernel_version, "")
} }
@ -71,6 +78,9 @@ func (pkm *prebuiltKernelModules) DepsMutator(ctx android.BottomUpMutatorContext
} }
func (pkm *prebuiltKernelModules) GenerateAndroidBuildActions(ctx android.ModuleContext) { func (pkm *prebuiltKernelModules) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if !pkm.installable() {
pkm.SkipInstall()
}
modules := android.PathsForModuleSrc(ctx, pkm.properties.Srcs) modules := android.PathsForModuleSrc(ctx, pkm.properties.Srcs)
depmodOut := runDepmod(ctx, modules) depmodOut := runDepmod(ctx, modules)