Loading android/variable.go +10 −2 Original line number Diff line number Diff line Loading @@ -629,6 +629,14 @@ type PartitionVariables struct { 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 { Loading fsgen/filesystem_creator.go +39 −10 Original line number Diff line number Diff line Loading @@ -211,6 +211,14 @@ func partitionSpecificFsProps(fsProps *filesystem.FilesystemProperties, partitio } } 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 { Loading @@ -226,9 +234,8 @@ func (f *filesystemCreator) createPartition(ctx android.LoadHookContext, partiti 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 Loading @@ -249,24 +256,46 @@ func (f *filesystemCreator) createPartition(ctx android.LoadHookContext, partiti // 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 Loading fsgen/fsgen_mutators.go +17 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,13 @@ func generatedPartitions(ctx android.LoadHookContext) []string { 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 } Loading Loading @@ -154,6 +161,16 @@ func createFsGenState(ctx android.LoadHookContext, generatedPrebuiltEtcModuleNam // 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{}, Loading Loading
android/variable.go +10 −2 Original line number Diff line number Diff line Loading @@ -629,6 +629,14 @@ type PartitionVariables struct { 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 { Loading
fsgen/filesystem_creator.go +39 −10 Original line number Diff line number Diff line Loading @@ -211,6 +211,14 @@ func partitionSpecificFsProps(fsProps *filesystem.FilesystemProperties, partitio } } 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 { Loading @@ -226,9 +234,8 @@ func (f *filesystemCreator) createPartition(ctx android.LoadHookContext, partiti 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 Loading @@ -249,24 +256,46 @@ func (f *filesystemCreator) createPartition(ctx android.LoadHookContext, partiti // 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 Loading
fsgen/fsgen_mutators.go +17 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,13 @@ func generatedPartitions(ctx android.LoadHookContext) []string { 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 } Loading Loading @@ -154,6 +161,16 @@ func createFsGenState(ctx android.LoadHookContext, generatedPrebuiltEtcModuleNam // 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{}, Loading