diff options
author | 2024-10-31 19:29:58 +0000 | |
---|---|---|
committer | 2024-10-31 19:29:58 +0000 | |
commit | 3ab5fcd266917104f7425323f6b5c1b7c42cdf1a (patch) | |
tree | 9bb5df15c1c3d76d03ae57e664d1aefae6ae2c13 /fsgen/filesystem_creator.go | |
parent | 33b1010060cb9cd9d1e4ca77c8ac16f4655e2b36 (diff) | |
parent | 312cc4116281539b6c64edf02bc72cde9175c807 (diff) |
Merge changes from topic "vendor_linker_config_soong" into main
* changes:
Create linker_config_srcs for autogenerated vendor partition
Add linker.config.pb support to android_filesystem
Diffstat (limited to 'fsgen/filesystem_creator.go')
-rw-r--r-- | fsgen/filesystem_creator.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go index 766176d5a..e470e91ca 100644 --- a/fsgen/filesystem_creator.go +++ b/fsgen/filesystem_creator.go @@ -17,6 +17,7 @@ package fsgen import ( "crypto/sha256" "fmt" + "path/filepath" "slices" "strconv" "strings" @@ -473,6 +474,10 @@ func (f *filesystemCreator) createPartition(ctx android.LoadHookContext, partiti return false } + if partitionType == "vendor" { + fsProps.Linker_config_srcs = f.createLinkerConfigSourceFilegroups(ctx) + } + var module android.Module if partitionType == "system" { module = ctx.CreateModule(filesystem.SystemImageFactory, baseProps, fsProps) @@ -504,6 +509,37 @@ func (f *filesystemCreator) createPartition(ctx android.LoadHookContext, partiti return true } +// createLinkerConfigSourceFilegroups creates filegroup modules to generate linker.config.pb for _vendor_ +// It creates a filegroup for each file in PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS. +// The filegroup modules are then added to `linker_config_srcs` of the autogenerated vendor `android_filesystem`. +func (f *filesystemCreator) createLinkerConfigSourceFilegroups(ctx android.LoadHookContext) []string { + ret := []string{} + partitionVars := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse + if linkerConfigSrcs := android.FirstUniqueStrings(partitionVars.VendorLinkerConfigSrcs); len(linkerConfigSrcs) > 0 { + // Create a filegroup, and add `:<filegroup_name>` to ret. + for index, linkerConfigSrc := range linkerConfigSrcs { + dir := filepath.Dir(linkerConfigSrc) + base := filepath.Base(linkerConfigSrc) + fgName := generatedModuleName(ctx.Config(), "vendor-linker-config-src"+strconv.Itoa(index)) + srcs := []string{base} + fgProps := &struct { + Name *string + Srcs proptools.Configurable[[]string] + }{ + Name: proptools.StringPtr(fgName), + Srcs: proptools.NewSimpleConfigurable(srcs), + } + ctx.CreateModuleInDirectory( + android.FileGroupFactory, + dir, + fgProps, + ) + ret = append(ret, ":"+fgName) + } + } + return ret +} + type filesystemBaseProperty struct { Name *string Compile_multilib *string |