summaryrefslogtreecommitdiff
path: root/filesystem/filesystem.go
diff options
context:
space:
mode:
author Cole Faust <colefaust@google.com> 2024-12-04 17:19:19 -0800
committer Cole Faust <colefaust@google.com> 2024-12-05 10:10:52 -0800
commit0d467050d57747f2e53d1fdf93e9dde8944bae61 (patch)
tree497338049a2737b137f32a349729734d9218fe1e /filesystem/filesystem.go
parent8759130e8748bac58be78217c3f5f5224ce1eb32 (diff)
Add selinux contexts to autogenerated partitions
Filesystems had a selinux_contexts property that then compiled the selinux contexts. But in make, it uses the result of the file_contexts_bin_gen module, which already runs the compilation step. Add a precompiled_file_contexts property to accept that compiled file. Also add 2 missing symlinks to the system partition. Bug: 381120092 Test: diff'd make and soong build_image prop files Change-Id: Ia0681fa4afe43675b730eaf0857dc6b15771534e
Diffstat (limited to 'filesystem/filesystem.go')
-rw-r--r--filesystem/filesystem.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index b6b4cb78a..35c1b94e6 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
@@ -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)