Build ramdisk with soong
This is the first step to build the ramdisk, it still has some diffs
with with the make-generated ramdisk though.
Bug: 378146476
Test: m soong_generated_ramdisk_filesystem_test
Change-Id: I767ea9d09e4d6413c2ec5af3120595e2001c9bb7
diff --git a/fsgen/fsgen_mutators.go b/fsgen/fsgen_mutators.go
index 4440c63..b6ba6c4 100644
--- a/fsgen/fsgen_mutators.go
+++ b/fsgen/fsgen_mutators.go
@@ -80,7 +80,7 @@
}
func generatedPartitions(ctx android.LoadHookContext) []string {
- generatedPartitions := []string{"system"}
+ generatedPartitions := []string{"system", "ramdisk"}
if ctx.DeviceConfig().SystemExtPath() == "system_ext" {
generatedPartitions = append(generatedPartitions, "system_ext")
}
@@ -171,6 +171,7 @@
"fs_config_files_odm_dlkm": defaultDepCandidateProps(ctx.Config()),
"odm_dlkm-build.prop": defaultDepCandidateProps(ctx.Config()),
},
+ "ramdisk": {},
},
fsDepsMutex: sync.Mutex{},
moduleToInstallationProps: map[string]installationProperties{},
@@ -205,29 +206,31 @@
}
func collectDepsMutator(mctx android.BottomUpMutatorContext) {
+ m := mctx.Module()
+ if m.Target().Os.Class != android.Device {
+ return
+ }
fsGenState := mctx.Config().Get(fsGenStateOnceKey).(*FsGenState)
- m := mctx.Module()
- if m.Target().Os.Class == android.Device && slices.Contains(fsGenState.depCandidates, mctx.ModuleName()) {
+ fsGenState.fsDepsMutex.Lock()
+ defer fsGenState.fsDepsMutex.Unlock()
+
+ if slices.Contains(fsGenState.depCandidates, mctx.ModuleName()) {
installPartition := m.PartitionTag(mctx.DeviceConfig())
- fsGenState.fsDepsMutex.Lock()
// Only add the module as dependency when:
// - its enabled
// - its namespace is included in PRODUCT_SOONG_NAMESPACES
if m.Enabled(mctx) && m.ExportedToMake() {
appendDepIfAppropriate(mctx, fsGenState.fsDeps[installPartition], installPartition)
}
- fsGenState.fsDepsMutex.Unlock()
}
// store the map of module to (required,overrides) even if the module is not in PRODUCT_PACKAGES.
// the module might be installed transitively.
- if m.Target().Os.Class == android.Device && m.Enabled(mctx) && m.ExportedToMake() {
- fsGenState.fsDepsMutex.Lock()
+ if m.Enabled(mctx) && m.ExportedToMake() {
fsGenState.moduleToInstallationProps[m.Name()] = installationProperties{
Required: m.RequiredModuleNames(mctx),
Overrides: m.Overrides(),
}
- fsGenState.fsDepsMutex.Unlock()
}
}