summaryrefslogtreecommitdiff
path: root/filesystem/filesystem.go
diff options
context:
space:
mode:
Diffstat (limited to 'filesystem/filesystem.go')
-rw-r--r--filesystem/filesystem.go80
1 files changed, 60 insertions, 20 deletions
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index 35fdd00a3..d5188d7c2 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -30,6 +30,7 @@ import (
"android/soong/linkerconfig"
"github.com/google/blueprint"
+ "github.com/google/blueprint/depset"
"github.com/google/blueprint/proptools"
)
@@ -424,8 +425,8 @@ type FilesystemInfo struct {
FullInstallPaths []FullInstallPathInfo
- // Installed files list
- InstalledFiles InstalledFilesStruct
+ // Installed files dep set of this module and its dependency filesystem modules
+ InstalledFilesDepSet depset.DepSet[InstalledFilesStruct]
// Path to compress hints file for erofs filesystems
// This will be nil for other fileystems like ext4
@@ -438,6 +439,8 @@ type FilesystemInfo struct {
Owners []InstalledModuleInfo
UseAvb bool
+
+ HasFsverity bool
}
// FullInstallPathInfo contains information about the "full install" paths of all the files
@@ -541,13 +544,13 @@ func (f *filesystem) ModifyPackagingSpec(ps *android.PackagingSpec) {
}
}
-func buildInstalledFiles(ctx android.ModuleContext, partition string, rootDir android.Path, image android.Path) (txt android.ModuleOutPath, json android.ModuleOutPath) {
+func buildInstalledFiles(ctx android.ModuleContext, partition string, rootDir android.Path, image android.Path) InstalledFilesStruct {
fileName := "installed-files"
if len(partition) > 0 {
fileName += fmt.Sprintf("-%s", partition)
}
- txt = android.PathForModuleOut(ctx, fmt.Sprintf("%s.txt", fileName))
- json = android.PathForModuleOut(ctx, fmt.Sprintf("%s.json", fileName))
+ txt := android.PathForModuleOut(ctx, fmt.Sprintf("%s.txt", fileName))
+ json := android.PathForModuleOut(ctx, fmt.Sprintf("%s.json", fileName))
ctx.Build(pctx, android.BuildParams{
Rule: installedFilesJsonRule,
@@ -566,7 +569,10 @@ func buildInstalledFiles(ctx android.ModuleContext, partition string, rootDir an
Description: "Installed file list txt",
})
- return txt, json
+ return InstalledFilesStruct{
+ Txt: txt,
+ Json: json,
+ }
}
func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) {
@@ -649,11 +655,15 @@ func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) {
fileListFile := android.PathForModuleOut(ctx, "fileList")
android.WriteFileRule(ctx, fileListFile, f.installedFilesList())
- partitionName := f.partitionName()
- if partitionName == "system" {
- partitionName = ""
+ var partitionNameForInstalledFiles string
+ switch f.partitionName() {
+ case "system":
+ partitionNameForInstalledFiles = ""
+ case "vendor_ramdisk":
+ partitionNameForInstalledFiles = "vendor-ramdisk"
+ default:
+ partitionNameForInstalledFiles = f.partitionName()
}
- installedFileTxt, installedFileJson := buildInstalledFiles(ctx, partitionName, rootDir, f.output)
var erofsCompressHints android.Path
if f.properties.Erofs.Compress_hints != nil {
@@ -674,15 +684,17 @@ func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) {
BuildImagePropFileDeps: buildImagePropFileDeps,
SpecsForSystemOther: f.systemOtherFiles(ctx),
FullInstallPaths: fullInstallPaths,
- InstalledFiles: InstalledFilesStruct{
- Txt: installedFileTxt,
- Json: installedFileJson,
- },
+ InstalledFilesDepSet: depset.New(
+ depset.POSTORDER,
+ []InstalledFilesStruct{buildInstalledFiles(ctx, partitionNameForInstalledFiles, rootDir, f.output)},
+ includeFilesInstalledFiles(ctx),
+ ),
ErofsCompressHints: erofsCompressHints,
SelinuxFc: f.selinuxFc,
FilesystemConfig: f.generateFilesystemConfig(ctx, rootDir, rebasedDir),
Owners: f.gatherOwners(specs),
UseAvb: proptools.Bool(f.properties.Use_avb),
+ HasFsverity: f.properties.Fsverity.Inputs.GetOrDefault(ctx, nil) != nil,
}
android.SetProvider(ctx, FilesystemProvider, fsInfo)
@@ -698,6 +710,14 @@ func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) {
}
f.setVbmetaPartitionProvider(ctx)
+
+ // Dump metadata that can not be done in android/compliance-metadata.go
+ complianceMetadataInfo := ctx.ComplianceMetadataInfo()
+ filesContained := make([]string, 0, len(fullInstallPaths))
+ for _, file := range fullInstallPaths {
+ filesContained = append(filesContained, file.FullInstallPath.String())
+ }
+ complianceMetadataInfo.SetFilesContained(filesContained)
}
func (f *filesystem) fileystemStagingDirTimestamp(ctx android.ModuleContext) android.WritablePath {
@@ -882,13 +902,24 @@ func (f *filesystem) buildNonDepsFiles(
builder.Command().Text("mkdir -p").Text(filepath.Dir(dst.String()))
builder.Command().Text("ln -sf").Text(proptools.ShellEscape(target)).Text(dst.String())
f.appendToEntry(ctx, dst)
- // Only add the fullInstallPath logic for files in the rebased dir. The root dir
- // is harder to install to.
- if strings.HasPrefix(name, rebasedPrefix) {
+ // Add the fullInstallPath logic for files in the rebased dir, and for non-rebased files in "system" partition
+ // the fullInstallPath is changed to "root" which aligns to the behavior in Make.
+ if f.PartitionType() == "system" {
+ installPath := android.PathForModuleInPartitionInstall(ctx, f.PartitionType(), strings.TrimPrefix(name, rebasedPrefix))
+ if !strings.HasPrefix(name, rebasedPrefix) {
+ installPath = android.PathForModuleInPartitionInstall(ctx, "root", name)
+ }
*fullInstallPaths = append(*fullInstallPaths, FullInstallPathInfo{
- FullInstallPath: android.PathForModuleInPartitionInstall(ctx, f.PartitionType(), strings.TrimPrefix(name, rebasedPrefix)),
+ FullInstallPath: installPath,
SymlinkTarget: target,
})
+ } else {
+ if strings.HasPrefix(name, rebasedPrefix) {
+ *fullInstallPaths = append(*fullInstallPaths, FullInstallPathInfo{
+ FullInstallPath: android.PathForModuleInPartitionInstall(ctx, f.PartitionType(), strings.TrimPrefix(name, rebasedPrefix)),
+ SymlinkTarget: target,
+ })
+ }
}
}
@@ -1167,6 +1198,15 @@ func includeFilesRootDir(ctx android.ModuleContext) (rootDirs android.Paths, par
return rootDirs, partitions
}
+func includeFilesInstalledFiles(ctx android.ModuleContext) (ret []depset.DepSet[InstalledFilesStruct]) {
+ ctx.VisitDirectDepsWithTag(interPartitionInstallDependencyTag, func(m android.Module) {
+ if fsProvider, ok := android.OtherModuleProvider(ctx, m, FilesystemProvider); ok {
+ ret = append(ret, fsProvider.InstalledFilesDepSet)
+ }
+ })
+ return
+}
+
func (f *filesystem) buildCpioImage(
ctx android.ModuleContext,
builder *android.RuleBuilder,
@@ -1429,7 +1469,7 @@ func (f *filesystem) getLibsForLinkerConfig(ctx android.ModuleContext) ([]androi
deps := f.gatherFilteredPackagingSpecs(ctx)
ctx.WalkDepsProxy(func(child, parent android.ModuleProxy) bool {
- if !android.OtherModuleProviderOrDefault(ctx, child, android.CommonModuleInfoKey).Enabled {
+ if !android.OtherModuleProviderOrDefault(ctx, child, android.CommonModuleInfoProvider).Enabled {
return false
}
for _, ps := range android.OtherModuleProviderOrDefault(
@@ -1450,7 +1490,7 @@ func (f *filesystem) getLibsForLinkerConfig(ctx android.ModuleContext) ([]androi
var requireModules []android.ModuleProxy
ctx.WalkDepsProxy(func(child, parent android.ModuleProxy) bool {
- if !android.OtherModuleProviderOrDefault(ctx, child, android.CommonModuleInfoKey).Enabled {
+ if !android.OtherModuleProviderOrDefault(ctx, child, android.CommonModuleInfoProvider).Enabled {
return false
}
_, parentInPackage := modulesInPackageByModule[parent]