diff options
author | 2025-02-12 22:27:43 +0000 | |
---|---|---|
committer | 2025-02-12 22:27:43 +0000 | |
commit | f12ff9bfea1a78c7fd06ca0f240aafaca3b2f0c9 (patch) | |
tree | 3d6d3de9fa293a2d0068a297f36a2740a24b7060 | |
parent | 35b7874f19b6fd5610a16997ad5e0afa871eaf24 (diff) |
Copy selinux_fc file to target_files.zip
This CL introduces a new field in FilesystemInfo with the selinux_fc
path of the filesystem(s). android_device will copy this file to the
META subdirectory of target_files.zip
Test: Built soong target_files.zip
Bug: 388633394
Change-Id: Ia81bd2c2d90d6beb116d57adf53deb5736579c3a
-rw-r--r-- | filesystem/android_device.go | 4 | ||||
-rw-r--r-- | filesystem/filesystem.go | 15 |
2 files changed, 14 insertions, 5 deletions
diff --git a/filesystem/android_device.go b/filesystem/android_device.go index 514fd2816..eb967ad06 100644 --- a/filesystem/android_device.go +++ b/filesystem/android_device.go @@ -454,6 +454,10 @@ func (a *androidDevice) copyMetadataToTargetZip(ctx android.ModuleContext, build abOtaKeysSorted := android.SortedUniqueStrings(a.deviceProps.Ab_ota_keys) abOtaKeysSortedString := proptools.ShellEscape(strings.Join(abOtaKeysSorted, "\\n")) builder.Command().Textf("echo -e").Flag(abOtaKeysSortedString).Textf(" > %s/META/otakeys.txt", targetFilesDir.String()) + // selinuxfc + if a.getFsInfos(ctx)["system"].SelinuxFc != nil { + builder.Command().Textf("cp").Input(a.getFsInfos(ctx)["system"].SelinuxFc).Textf(" %s/META/file_contexts.bin", targetFilesDir.String()) + } } } diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go index c3c06bd58..0381951ca 100644 --- a/filesystem/filesystem.go +++ b/filesystem/filesystem.go @@ -90,6 +90,8 @@ type filesystem struct { entries []string filesystemBuilder filesystemBuilder + + selinuxFc android.Path } type filesystemBuilder interface { @@ -417,6 +419,8 @@ type FilesystemInfo struct { // Path to compress hints file for erofs filesystems // This will be nil for other fileystems like ext4 ErofsCompressHints android.Path + + SelinuxFc android.Path } // FullInstallPathInfo contains information about the "full install" paths of all the files @@ -660,6 +664,7 @@ func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) { Json: installedFileJson, }, ErofsCompressHints: erofsCompressHints, + SelinuxFc: f.selinuxFc, } android.SetProvider(ctx, FilesystemProvider, fsInfo) @@ -1006,12 +1011,12 @@ func (f *filesystem) buildPropFile(ctx android.ModuleContext) (android.Path, and 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)) + f.selinuxFc = 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) - } + f.selinuxFc = android.PathForModuleSrc(ctx, *f.properties.Precompiled_file_contexts) + } + if f.selinuxFc != nil { + addPath("selinux_fc", f.selinuxFc) } if timestamp := proptools.String(f.properties.Fake_timestamp); timestamp != "" { addStr("timestamp", timestamp) |