diff options
Diffstat (limited to 'filesystem/system_image.go')
-rw-r--r-- | filesystem/system_image.go | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/filesystem/system_image.go b/filesystem/system_image.go index 898987dbc..0d54ff585 100644 --- a/filesystem/system_image.go +++ b/filesystem/system_image.go @@ -17,27 +17,22 @@ package filesystem import ( "android/soong/android" "android/soong/linkerconfig" + + "github.com/google/blueprint/proptools" ) type systemImage struct { filesystem - - properties systemImageProperties } -type systemImageProperties struct { - // Path to the input linker config json file. - Linker_config_src *string `android:"path"` -} +var _ filesystemBuilder = (*systemImage)(nil) // android_system_image is a specialization of android_filesystem for the 'system' partition. // Currently, the only difference is the inclusion of linker.config.pb file which specifies // the provided and the required libraries to and from APEXes. func SystemImageFactory() android.Module { module := &systemImage{} - module.AddProperties(&module.properties) - module.filesystem.buildExtraFiles = module.buildExtraFiles - module.filesystem.filterPackagingSpec = module.filterPackagingSpec + module.filesystemBuilder = module initFilesystemModule(module, &module.filesystem) return module } @@ -46,30 +41,22 @@ func (s systemImage) FsProps() FilesystemProperties { return s.filesystem.properties } -func (s *systemImage) buildExtraFiles(ctx android.ModuleContext, root android.OutputPath) android.OutputPaths { - if s.filesystem.properties.Partition_type != nil { - ctx.PropertyErrorf("partition_type", "partition_type must be unset on an android_system_image module. It is assumed to be 'system'.") +func (s *systemImage) BuildLinkerConfigFile(ctx android.ModuleContext, builder *android.RuleBuilder, rebasedDir android.OutputPath) { + if !proptools.Bool(s.filesystem.properties.Linkerconfig.Gen_linker_config) { + return } - lc := s.buildLinkerConfigFile(ctx, root) - // Add more files if needed - return []android.OutputPath{lc} -} - -func (s *systemImage) buildLinkerConfigFile(ctx android.ModuleContext, root android.OutputPath) android.OutputPath { - input := android.PathForModuleSrc(ctx, android.String(s.properties.Linker_config_src)) - output := root.Join(ctx, "system", "etc", "linker.config.pb") provideModules, requireModules := s.getLibsForLinkerConfig(ctx) - builder := android.NewRuleBuilder(pctx, ctx) - linkerconfig.BuildLinkerConfig(ctx, builder, android.Paths{input}, provideModules, requireModules, output) - builder.Build("conv_linker_config", "Generate linker config protobuf "+output.String()) - return output + output := rebasedDir.Join(ctx, "etc", "linker.config.pb") + linkerconfig.BuildLinkerConfig(ctx, builder, android.PathsForModuleSrc(ctx, s.filesystem.properties.Linkerconfig.Linker_config_srcs), provideModules, requireModules, output) + + s.appendToEntry(ctx, output) } // Filter the result of GatherPackagingSpecs to discard items targeting outside "system" / "root" // partition. Note that "apex" module installs its contents to "apex"(fake partition) as well // for symbol lookup by imitating "activated" paths. -func (s *systemImage) filterPackagingSpec(ps android.PackagingSpec) bool { +func (s *systemImage) FilterPackagingSpec(ps android.PackagingSpec) bool { return !ps.SkipInstall() && (ps.Partition() == "system" || ps.Partition() == "root") } |