diff options
Diffstat (limited to 'filesystem')
-rw-r--r-- | filesystem/filesystem.go | 23 | ||||
-rw-r--r-- | filesystem/system_image.go | 7 |
2 files changed, 25 insertions, 5 deletions
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go index 5add95441..5c7ef434f 100644 --- a/filesystem/filesystem.go +++ b/filesystem/filesystem.go @@ -312,6 +312,25 @@ func (f *filesystem) buildNonDepsFiles(ctx android.ModuleContext, builder *andro } } +func (f *filesystem) copyPackagingSpecs(ctx android.ModuleContext, builder *android.RuleBuilder, specs map[string]android.PackagingSpec, rootDir, rebasedDir android.WritablePath) []string { + rootDirSpecs := make(map[string]android.PackagingSpec) + rebasedDirSpecs := make(map[string]android.PackagingSpec) + + for rel, spec := range specs { + if spec.Partition() == "root" { + rootDirSpecs[rel] = spec + } else { + rebasedDirSpecs[rel] = spec + } + } + + dirsToSpecs := make(map[android.WritablePath]map[string]android.PackagingSpec) + dirsToSpecs[rootDir] = rootDirSpecs + dirsToSpecs[rebasedDir] = rebasedDirSpecs + + return f.CopySpecsToDirs(ctx, builder, dirsToSpecs) +} + func (f *filesystem) buildImageUsingBuildImage(ctx android.ModuleContext) android.OutputPath { rootDir := android.PathForModuleOut(ctx, "root").OutputPath rebasedDir := rootDir @@ -322,7 +341,7 @@ func (f *filesystem) buildImageUsingBuildImage(ctx android.ModuleContext) androi // Wipe the root dir to get rid of leftover files from prior builds builder.Command().Textf("rm -rf %s && mkdir -p %s", rootDir, rootDir) specs := f.gatherFilteredPackagingSpecs(ctx) - f.entries = f.CopySpecsToDir(ctx, builder, specs, rebasedDir) + f.entries = f.copyPackagingSpecs(ctx, builder, specs, rootDir, rebasedDir) f.buildNonDepsFiles(ctx, builder, rootDir) f.addMakeBuiltFiles(ctx, builder, rootDir) @@ -465,7 +484,7 @@ func (f *filesystem) buildCpioImage(ctx android.ModuleContext, compressed bool) // Wipe the root dir to get rid of leftover files from prior builds builder.Command().Textf("rm -rf %s && mkdir -p %s", rootDir, rootDir) specs := f.gatherFilteredPackagingSpecs(ctx) - f.entries = f.CopySpecsToDir(ctx, builder, specs, rebasedDir) + f.entries = f.copyPackagingSpecs(ctx, builder, specs, rootDir, rebasedDir) f.buildNonDepsFiles(ctx, builder, rootDir) f.buildFsverityMetadataFiles(ctx, builder, specs, rootDir, rebasedDir) diff --git a/filesystem/system_image.go b/filesystem/system_image.go index 15cacfb4f..69d922df9 100644 --- a/filesystem/system_image.go +++ b/filesystem/system_image.go @@ -94,9 +94,10 @@ func (s *systemImage) buildLinkerConfigFile(ctx android.ModuleContext, root andr return output } -// Filter the result of GatherPackagingSpecs to discard items targeting outside "system" partition. -// Note that "apex" module installs its contents to "apex"(fake partition) as well +// Filter the result of GatherPackagingSpecs to discard items targeting outside "system" / "root" +// partition. Note that "apex" module installs its contents to "apex"(fake partition) as well // for symbol lookup by imitating "activated" paths. func (s *systemImage) filterPackagingSpec(ps android.PackagingSpec) bool { - return s.filesystem.filterInstallablePackagingSpec(ps) && ps.Partition() == "system" + return s.filesystem.filterInstallablePackagingSpec(ps) && + (ps.Partition() == "system" || ps.Partition() == "root") } |