Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1179602 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "1:1 mapping between prebuilt_kernel_modules and _dlkm filesystem modules" into main

parents e877cee1 7b25a519
Loading
Loading
Loading
Loading
+19 −29
Original line number Diff line number Diff line
@@ -231,39 +231,29 @@ 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.
// The input `kernelModules` is a space separated list of .ko files in the workspace. This will be partitioned per directory
// and a `prebuilt_kernel_modules` will be created per partition.
// These autogenerated modules will be subsequently added to the deps of the top level *_dlkm android_filesystem
// 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) {
	// Partition the files per directory
	dirToFiles := map[string][]string{}
	for _, kernelModule := range kernelModules {
		dir := filepath.Dir(kernelModule)
		base := filepath.Base(kernelModule)
		dirToFiles[dir] = append(dirToFiles[dir], base)
	}
	// Create a prebuilt_kernel_modules module per partition
	fsGenState := ctx.Config().Get(fsGenStateOnceKey).(*FsGenState)
	for index, dir := range android.SortedKeys(dirToFiles) {
		name := generatedModuleName(ctx.Config(), fmt.Sprintf("%s-kernel-modules-%s", partitionType, strconv.Itoa(index)))
	name := generatedModuleName(ctx.Config(), fmt.Sprintf("%s-kernel-modules", partitionType))
	props := &struct {
		Name *string
		Srcs []string
	}{
		Name: proptools.StringPtr(name),
			Srcs: dirToFiles[dir],
		Srcs: kernelModules,
	}
	kernelModule := ctx.CreateModuleInDirectory(
		kernel.PrebuiltKernelModulesFactory,
			dir,
		".", // create in root directory for now
		props,
	)
	kernelModule.HideFromMake()
	// Add to deps
	(*fsGenState.fsDeps[partitionType])[name] = defaultDepCandidateProps(ctx.Config())
}
}

// Create a build_prop and android_info module. This will be used to create /vendor/build.prop
func (f *filesystemCreator) createVendorBuildProp(ctx android.LoadHookContext) {