diff options
Diffstat (limited to 'filesystem/filesystem.go')
| -rw-r--r-- | filesystem/filesystem.go | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go index 220a8c6a4..1ce6131aa 100644 --- a/filesystem/filesystem.go +++ b/filesystem/filesystem.go @@ -384,9 +384,17 @@ type InstalledFilesStruct struct { Json android.Path } +type InstalledModuleInfo struct { + Name string + Variation string +} + type FilesystemInfo struct { // The built filesystem image Output android.Path + // Returns the output file that is signed by avbtool. If this module is not signed, returns + // nil. + SignedOutputPath android.Path // An additional hermetic filesystem image. // e.g. this will contain inodes with pinned timestamps. // This will be copied to target_files.zip @@ -397,6 +405,9 @@ type FilesystemInfo struct { // to add a dependency on the Output file, as you cannot add dependencies on directories // in ninja. RootDir android.Path + // Extra root directories that are also built into the partition. Currently only used for + // including the recovery partition files into the vendor_boot image. + ExtraRootDirs android.Paths // The rebased staging directory used to build the output filesystem. If consuming this, make // sure to add a dependency on the Output file, as you cannot add dependencies on directories // in ninja. In many cases this is the same as RootDir, only in the system partition is it @@ -428,6 +439,8 @@ type FilesystemInfo struct { SelinuxFc android.Path FilesystemConfig android.Path + + Owners []InstalledModuleInfo } // FullInstallPathInfo contains information about the "full install" paths of all the files @@ -613,6 +626,7 @@ func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) { var outputHermetic android.WritablePath var buildImagePropFile android.Path var buildImagePropFileDeps android.Paths + var extraRootDirs android.Paths switch f.fsType(ctx) { case ext4Type, erofsType, f2fsType: buildImagePropFile, buildImagePropFileDeps = f.buildPropFile(ctx) @@ -626,9 +640,9 @@ func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) { f.buildImageUsingBuildImage(ctx, hermeticBuilder, buildImageParams{rootDir, propFileHermetic, buildImagePropFileDeps, outputHermetic}) mapFile = f.getMapFile(ctx) case compressedCpioType: - f.output = f.buildCpioImage(ctx, builder, rootDir, true) + f.output, extraRootDirs = f.buildCpioImage(ctx, builder, rootDir, true) case cpioType: - f.output = f.buildCpioImage(ctx, builder, rootDir, false) + f.output, extraRootDirs = f.buildCpioImage(ctx, builder, rootDir, false) default: return } @@ -656,10 +670,12 @@ func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) { } fsInfo := FilesystemInfo{ - Output: f.output, + Output: f.OutputPath(), + SignedOutputPath: f.SignedOutputPath(), OutputHermetic: outputHermetic, FileListFile: fileListFile, RootDir: rootDir, + ExtraRootDirs: extraRootDirs, RebasedDir: rebasedDir, MapFile: mapFile, ModuleName: ctx.ModuleName(), @@ -674,6 +690,7 @@ func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) { ErofsCompressHints: erofsCompressHints, SelinuxFc: f.selinuxFc, FilesystemConfig: f.generateFilesystemConfig(ctx, rootDir, rebasedDir), + Owners: f.gatherOwners(specs), } android.SetProvider(ctx, FilesystemProvider, fsInfo) @@ -1158,7 +1175,7 @@ func (f *filesystem) buildCpioImage( builder *android.RuleBuilder, rootDir android.OutputPath, compressed bool, -) android.Path { +) (android.Path, android.Paths) { if proptools.Bool(f.properties.Use_avb) { ctx.PropertyErrorf("use_avb", "signing compresed cpio image using avbtool is not supported."+ "Consider adding this to bootimg module and signing the entire boot image.") @@ -1198,7 +1215,7 @@ func (f *filesystem) buildCpioImage( // rootDir is not deleted. Might be useful for quick inspection. builder.Build("build_cpio_image", fmt.Sprintf("Creating filesystem %s", f.BaseModuleName())) - return output + return output, rootDirs } var validPartitions = []string{ @@ -1327,6 +1344,18 @@ func (f *filesystem) gatherFilteredPackagingSpecs(ctx android.ModuleContext) map return f.PackagingBase.GatherPackagingSpecsWithFilterAndModifier(ctx, f.filesystemBuilder.FilterPackagingSpec, f.filesystemBuilder.ModifyPackagingSpec) } +func (f *filesystem) gatherOwners(specs map[string]android.PackagingSpec) []InstalledModuleInfo { + var owners []InstalledModuleInfo + for _, p := range android.SortedKeys(specs) { + spec := specs[p] + owners = append(owners, InstalledModuleInfo{ + Name: spec.Owner(), + Variation: spec.Variation(), + }) + } + return owners +} + // Dexpreopt files are installed to system_other. Collect the packaingSpecs for the dexpreopt files // from this partition to export to the system_other partition later. func (f *filesystem) systemOtherFiles(ctx android.ModuleContext) map[string]android.PackagingSpec { @@ -1500,3 +1529,10 @@ func (f *filesystem) MakeVars(ctx android.MakeVarsModuleContext) { ctx.StrictRaw("SOONG_DEFINED_SYSTEM_IMAGE_PATH", f.output.String()) } } + +func setCommonFilesystemInfo(ctx android.ModuleContext, m Filesystem) { + android.SetProvider(ctx, FilesystemProvider, FilesystemInfo{ + Output: m.OutputPath(), + SignedOutputPath: m.SignedOutputPath(), + }) +} |