diff options
Diffstat (limited to 'filesystem/filesystem.go')
-rw-r--r-- | filesystem/filesystem.go | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go index b6b4cb78a..b9cb0769a 100644 --- a/filesystem/filesystem.go +++ b/filesystem/filesystem.go @@ -130,9 +130,13 @@ type FilesystemProperties struct { // checks, and will be used in the future for API surface checks. Partition_type *string - // file_contexts file to make image. Currently, only ext4 is supported. + // file_contexts file to make image. Currently, only ext4 is supported. These file contexts + // will be compiled with sefcontext_compile File_contexts *string `android:"path"` + // The selinux file contexts, after having already run them through sefcontext_compile + Precompiled_file_contexts *string `android:"path"` + // Base directory relative to root, to which deps are installed, e.g. "system". Default is "." // (root). Base_dir *string @@ -453,7 +457,7 @@ func (f *filesystem) validateVintfFragments(ctx android.ModuleContext) { } func (f *filesystem) appendToEntry(ctx android.ModuleContext, installedFile android.Path) { - partitionBaseDir := android.PathForModuleOut(ctx, "root", f.partitionName()).String() + "/" + partitionBaseDir := android.PathForModuleOut(ctx, "root", proptools.String(f.properties.Base_dir)).String() + "/" relPath, inTargetPartition := strings.CutPrefix(installedFile.String(), partitionBaseDir) if inTargetPartition { @@ -679,8 +683,15 @@ func (f *filesystem) buildPropFile(ctx android.ModuleContext) (android.Path, and addStr("avb_salt", f.salt()) } - if proptools.String(f.properties.File_contexts) != "" { + if f.properties.File_contexts != nil && f.properties.Precompiled_file_contexts != nil { + ctx.ModuleErrorf("file_contexts and precompiled_file_contexts cannot both be set") + } else if f.properties.File_contexts != nil { addPath("selinux_fc", f.buildFileContexts(ctx)) + } else if f.properties.Precompiled_file_contexts != nil { + src := android.PathForModuleSrc(ctx, *f.properties.Precompiled_file_contexts) + if src != nil { + addPath("selinux_fc", src) + } } if timestamp := proptools.String(f.properties.Fake_timestamp); timestamp != "" { addStr("timestamp", timestamp) @@ -1012,7 +1023,7 @@ func (f *filesystem) getLibsForLinkerConfig(ctx android.ModuleContext) ([]androi ctx.WalkDeps(func(child, parent android.Module) bool { for _, ps := range android.OtherModuleProviderOrDefault( ctx, child, android.InstallFilesProvider).PackagingSpecs { - if _, ok := deps[ps.RelPathInPackage()]; ok { + if _, ok := deps[ps.RelPathInPackage()]; ok && ps.Partition() == f.PartitionType() { modulesInPackageByModule[child] = true modulesInPackageByName[child.Name()] = true return true |