summaryrefslogtreecommitdiff
path: root/filesystem/filesystem.go
diff options
context:
space:
mode:
Diffstat (limited to 'filesystem/filesystem.go')
-rw-r--r--filesystem/filesystem.go107
1 files changed, 72 insertions, 35 deletions
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index d4ea6a34c..065acbdd2 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"
)
@@ -208,11 +209,6 @@ type FilesystemProperties struct {
// Install aconfig_flags.pb file for the modules installed in this partition.
Gen_aconfig_flags_pb *bool
- // List of names of other filesystem partitions to import their aconfig flags from.
- // This is used for the system partition to import system_ext's aconfig flags, as currently
- // those are considered one "container": aosp/3261300
- Import_aconfig_flags_from []string
-
Fsverity fsverityProperties
// If this property is set to true, the filesystem will call ctx.UncheckedModule(), causing
@@ -359,9 +355,6 @@ func (f *filesystem) DepsMutator(ctx android.BottomUpMutatorContext) {
if f.properties.Android_filesystem_deps.System_ext != nil {
ctx.AddDependency(ctx.Module(), interPartitionDependencyTag, proptools.String(f.properties.Android_filesystem_deps.System_ext))
}
- for _, partition := range f.properties.Import_aconfig_flags_from {
- ctx.AddDependency(ctx.Module(), importAconfigDependencyTag, partition)
- }
for _, partition := range f.properties.Include_files_of {
ctx.AddDependency(ctx.Module(), interPartitionInstallDependencyTag, partition)
}
@@ -432,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
@@ -444,6 +437,10 @@ type FilesystemInfo struct {
FilesystemConfig android.Path
Owners []InstalledModuleInfo
+
+ UseAvb bool
+
+ HasFsverity bool
}
// FullInstallPathInfo contains information about the "full install" paths of all the files
@@ -474,11 +471,7 @@ type FullInstallPathInfo struct {
var FilesystemProvider = blueprint.NewProvider[FilesystemInfo]()
-type FilesystemDefaultsInfo struct {
- // Identifies which partition this is for //visibility:any_system_image (and others) visibility
- // checks, and will be used in the future for API surface checks.
- PartitionType string
-}
+type FilesystemDefaultsInfo struct{}
var FilesystemDefaultsInfoProvider = blueprint.NewProvider[FilesystemDefaultsInfo]()
@@ -551,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,
@@ -576,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) {
@@ -659,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 {
@@ -684,18 +684,25 @@ 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)
+ android.SetProvider(ctx, android.PartitionTypeInfoProvider, android.PartitionTypeInfo{
+ PartitionType: f.PartitionType(),
+ })
+
f.fileListFile = fileListFile
if proptools.Bool(f.properties.Unchecked_module) {
@@ -703,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 {
@@ -822,11 +837,12 @@ func validatePartitionType(ctx android.ModuleContext, p partition) {
}
ctx.VisitDirectDepsProxyWithTag(android.DefaultsDepTag, func(m android.ModuleProxy) {
- if fdm, ok := android.OtherModuleProvider(ctx, m, FilesystemDefaultsInfoProvider); ok {
- if p.PartitionType() != fdm.PartitionType {
+ if _, ok := android.OtherModuleProvider(ctx, m, FilesystemDefaultsInfoProvider); ok {
+ partitionInfo := android.OtherModuleProviderOrDefault(ctx, m, android.PartitionTypeInfoProvider)
+ if p.PartitionType() != partitionInfo.PartitionType {
ctx.PropertyErrorf("partition_type",
"%s doesn't match with the partition type %s of the filesystem default module %s",
- p.PartitionType(), fdm.PartitionType, m.Name())
+ p.PartitionType(), partitionInfo.PartitionType, m.Name())
}
}
})
@@ -886,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,
+ })
+ }
}
}
@@ -1171,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,
@@ -1413,7 +1449,8 @@ var _ partition = (*filesystemDefaults)(nil)
func (f *filesystemDefaults) GenerateAndroidBuildActions(ctx android.ModuleContext) {
validatePartitionType(ctx, f)
- android.SetProvider(ctx, FilesystemDefaultsInfoProvider, FilesystemDefaultsInfo{
+ android.SetProvider(ctx, FilesystemDefaultsInfoProvider, FilesystemDefaultsInfo{})
+ android.SetProvider(ctx, android.PartitionTypeInfoProvider, android.PartitionTypeInfo{
PartitionType: f.PartitionType(),
})
}