Make fsverity props configurable
Bug: 381019944 Test: build Change-Id: I7389131a944ce477d5d49d01acbcacae2e6fecfe
This commit is contained in:
parent
1b297b02d2
commit
cd34413b9d
2 changed files with 12 additions and 10 deletions
|
|
@ -20,6 +20,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
|
|
||||||
|
"github.com/google/blueprint/proptools"
|
||||||
)
|
)
|
||||||
|
|
||||||
type fsverityProperties struct {
|
type fsverityProperties struct {
|
||||||
|
|
@ -27,10 +29,10 @@ type fsverityProperties struct {
|
||||||
// will be generated and included to the filesystem image.
|
// will be generated and included to the filesystem image.
|
||||||
// etc/security/fsverity/BuildManifest.apk will also be generated which contains information
|
// etc/security/fsverity/BuildManifest.apk will also be generated which contains information
|
||||||
// about generated .fsv_meta files.
|
// about generated .fsv_meta files.
|
||||||
Inputs []string
|
Inputs proptools.Configurable[[]string]
|
||||||
|
|
||||||
// APK libraries to link against, for etc/security/fsverity/BuildManifest.apk
|
// 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) {
|
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) {
|
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 {
|
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 {
|
if matched, err := filepath.Match(pattern, path); matched {
|
||||||
return true
|
return true
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
|
|
@ -112,7 +114,7 @@ func (f *filesystem) buildFsverityMetadataFiles(ctx android.ModuleContext, build
|
||||||
apkPath := rebasedDir.Join(ctx, "etc", "security", "fsverity", fmt.Sprintf("BuildManifest%s.apk", apkNameSuffix))
|
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))
|
idsigPath := rebasedDir.Join(ctx, "etc", "security", "fsverity", fmt.Sprintf("BuildManifest%s.apk.idsig", apkNameSuffix))
|
||||||
manifestTemplatePath := android.PathForSource(ctx, "system/security/fsverity/AndroidManifest.xml")
|
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()
|
minSdkVersion := ctx.Config().PlatformSdkCodename()
|
||||||
if minSdkVersion == "REL" {
|
if minSdkVersion == "REL" {
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@ func partitionSpecificFsProps(ctx android.EarlyModuleContext, fsProps *filesyste
|
||||||
fsProps.Gen_aconfig_flags_pb = proptools.BoolPtr(true)
|
fsProps.Gen_aconfig_flags_pb = proptools.BoolPtr(true)
|
||||||
// Identical to that of the aosp_shared_system_image
|
// Identical to that of the aosp_shared_system_image
|
||||||
if partitionVars.ProductFsverityGenerateMetadata {
|
if partitionVars.ProductFsverityGenerateMetadata {
|
||||||
fsProps.Fsverity.Inputs = []string{
|
fsProps.Fsverity.Inputs = proptools.NewSimpleConfigurable([]string{
|
||||||
"etc/boot-image.prof",
|
"etc/boot-image.prof",
|
||||||
"etc/dirty-image-objects",
|
"etc/dirty-image-objects",
|
||||||
"etc/preloaded-classes",
|
"etc/preloaded-classes",
|
||||||
|
|
@ -232,8 +232,8 @@ func partitionSpecificFsProps(ctx android.EarlyModuleContext, fsProps *filesyste
|
||||||
"framework/*",
|
"framework/*",
|
||||||
"framework/*/*", // framework/{arch}
|
"framework/*/*", // framework/{arch}
|
||||||
"framework/oat/*/*", // framework/oat/{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}"})
|
||||||
}
|
}
|
||||||
// Most of the symlinks and directories listed here originate from create_root_structure.mk,
|
// Most of the symlinks and directories listed here originate from create_root_structure.mk,
|
||||||
// but the handwritten generic system image also recreates them:
|
// but the handwritten generic system image also recreates them:
|
||||||
|
|
@ -377,12 +377,12 @@ func partitionSpecificFsProps(ctx android.EarlyModuleContext, fsProps *filesyste
|
||||||
})
|
})
|
||||||
case "system_ext":
|
case "system_ext":
|
||||||
if partitionVars.ProductFsverityGenerateMetadata {
|
if partitionVars.ProductFsverityGenerateMetadata {
|
||||||
fsProps.Fsverity.Inputs = []string{
|
fsProps.Fsverity.Inputs = proptools.NewSimpleConfigurable([]string{
|
||||||
"framework/*",
|
"framework/*",
|
||||||
"framework/*/*", // framework/{arch}
|
"framework/*/*", // framework/{arch}
|
||||||
"framework/oat/*/*", // framework/oat/{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}"})
|
||||||
}
|
}
|
||||||
case "product":
|
case "product":
|
||||||
fsProps.Gen_aconfig_flags_pb = proptools.BoolPtr(true)
|
fsProps.Gen_aconfig_flags_pb = proptools.BoolPtr(true)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue