diff options
author | 2025-01-15 17:32:37 +0900 | |
---|---|---|
committer | 2025-01-15 17:42:11 +0900 | |
commit | c7769d7e7ece747756ba62710ce280cfeaf64af3 (patch) | |
tree | bd024fbeca3945a6b546558d925b8256745c2f86 | |
parent | d60d5e1e5df5453da800c3ba145b1a87eb0a2c3a (diff) |
Make fsverity props configurable
Bug: 381019944
Test: build
Change-Id: I7389131a944ce477d5d49d01acbcacae2e6fecfe
-rw-r--r-- | filesystem/fsverity_metadata.go | 10 | ||||
-rw-r--r-- | fsgen/filesystem_creator.go | 12 |
2 files changed, 12 insertions, 10 deletions
diff --git a/filesystem/fsverity_metadata.go b/filesystem/fsverity_metadata.go index 91b8c570d..c3f19363e 100644 --- a/filesystem/fsverity_metadata.go +++ b/filesystem/fsverity_metadata.go @@ -20,6 +20,8 @@ import ( "strings" "android/soong/android" + + "github.com/google/blueprint/proptools" ) type fsverityProperties struct { @@ -27,10 +29,10 @@ type fsverityProperties struct { // will be generated and included to the filesystem image. // etc/security/fsverity/BuildManifest.apk will also be generated which contains information // about generated .fsv_meta files. - Inputs []string + Inputs proptools.Configurable[[]string] // APK libraries to link against, for etc/security/fsverity/BuildManifest.apk - Libs []string `android:"path"` + Libs proptools.Configurable[[]string] `android:"path"` } func (f *filesystem) writeManifestGeneratorListFile(ctx android.ModuleContext, outputPath android.WritablePath, matchedSpecs []android.PackagingSpec, rebasedDir android.OutputPath) { @@ -44,7 +46,7 @@ func (f *filesystem) writeManifestGeneratorListFile(ctx android.ModuleContext, o func (f *filesystem) buildFsverityMetadataFiles(ctx android.ModuleContext, builder *android.RuleBuilder, specs map[string]android.PackagingSpec, rootDir android.OutputPath, rebasedDir android.OutputPath) { match := func(path string) bool { - for _, pattern := range f.properties.Fsverity.Inputs { + for _, pattern := range f.properties.Fsverity.Inputs.GetOrDefault(ctx, nil) { if matched, err := filepath.Match(pattern, path); matched { return true } else if err != nil { @@ -124,7 +126,7 @@ func (f *filesystem) buildFsverityMetadataFiles(ctx android.ModuleContext, build apkPath := rebasedDir.Join(ctx, "etc", "security", "fsverity", fmt.Sprintf("BuildManifest%s.apk", apkNameSuffix)) idsigPath := rebasedDir.Join(ctx, "etc", "security", "fsverity", fmt.Sprintf("BuildManifest%s.apk.idsig", apkNameSuffix)) manifestTemplatePath := android.PathForSource(ctx, "system/security/fsverity/AndroidManifest.xml") - libs := android.PathsForModuleSrc(ctx, f.properties.Fsverity.Libs) + libs := android.PathsForModuleSrc(ctx, f.properties.Fsverity.Libs.GetOrDefault(ctx, nil)) minSdkVersion := ctx.Config().PlatformSdkCodename() if minSdkVersion == "REL" { diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go index 9aed460e3..cc369c7dd 100644 --- a/fsgen/filesystem_creator.go +++ b/fsgen/filesystem_creator.go @@ -279,7 +279,7 @@ func partitionSpecificFsProps(ctx android.EarlyModuleContext, fsProps *filesyste fsProps.Gen_aconfig_flags_pb = proptools.BoolPtr(true) // Identical to that of the aosp_shared_system_image if partitionVars.ProductFsverityGenerateMetadata { - fsProps.Fsverity.Inputs = []string{ + fsProps.Fsverity.Inputs = proptools.NewSimpleConfigurable([]string{ "etc/boot-image.prof", "etc/dirty-image-objects", "etc/preloaded-classes", @@ -287,8 +287,8 @@ func partitionSpecificFsProps(ctx android.EarlyModuleContext, fsProps *filesyste "framework/*", "framework/*/*", // framework/{arch} "framework/oat/*/*", // framework/oat/{arch} - } - fsProps.Fsverity.Libs = []string{":framework-res{.export-package.apk}"} + }) + fsProps.Fsverity.Libs = proptools.NewSimpleConfigurable([]string{":framework-res{.export-package.apk}"}) } fsProps.Symlinks = commonSymlinksFromRoot fsProps.Symlinks = append(fsProps.Symlinks, @@ -329,12 +329,12 @@ func partitionSpecificFsProps(ctx android.EarlyModuleContext, fsProps *filesyste fsProps.Stem = proptools.StringPtr("system.img") case "system_ext": if partitionVars.ProductFsverityGenerateMetadata { - fsProps.Fsverity.Inputs = []string{ + fsProps.Fsverity.Inputs = proptools.NewSimpleConfigurable([]string{ "framework/*", "framework/*/*", // framework/{arch} "framework/oat/*/*", // framework/oat/{arch} - } - fsProps.Fsverity.Libs = []string{":framework-res{.export-package.apk}"} + }) + fsProps.Fsverity.Libs = proptools.NewSimpleConfigurable([]string{":framework-res{.export-package.apk}"}) } fsProps.Security_patch = proptools.StringPtr(ctx.Config().PlatformSecurityPatch()) fsProps.Stem = proptools.StringPtr("system_ext.img") |