summaryrefslogtreecommitdiff
path: root/filesystem/filesystem.go
diff options
context:
space:
mode:
Diffstat (limited to 'filesystem/filesystem.go')
-rw-r--r--filesystem/filesystem.go43
1 files changed, 39 insertions, 4 deletions
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index 846e2e5e4..fd1c784ec 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -455,6 +455,17 @@ type FilesystemInfo struct {
HasFsverity bool
PropFileForMiscInfo android.Path
+
+ // Additional avb and partition size information.
+ // `system_other` will use this information of `system` dep for misc_info.txt processing.
+ PartitionSize *int64
+ UseAvb bool
+ AvbAlgorithm string
+ AvbHashAlgorithm string
+ AvbKey android.Path
+ PartitionName string
+ // HasOrIsRecovery returns true for recovery and for ramdisks with a recovery partition.
+ HasOrIsRecovery bool
}
// FullInstallPathInfo contains information about the "full install" paths of all the files
@@ -711,6 +722,17 @@ func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) {
Owners: f.gatherOwners(specs),
HasFsverity: f.properties.Fsverity.Inputs.GetOrDefault(ctx, nil) != nil,
PropFileForMiscInfo: propFileForMiscInfo,
+ PartitionSize: f.properties.Partition_size,
+ PartitionName: f.partitionName(),
+ HasOrIsRecovery: f.hasOrIsRecovery(ctx),
+ }
+ if proptools.Bool(f.properties.Use_avb) {
+ fsInfo.UseAvb = true
+ fsInfo.AvbAlgorithm = proptools.StringDefault(f.properties.Avb_algorithm, "SHA256_RSA4096")
+ fsInfo.AvbHashAlgorithm = proptools.StringDefault(f.properties.Avb_hash_algorithm, "sha256")
+ if f.properties.Avb_private_key != nil {
+ fsInfo.AvbKey = android.PathForModuleSrc(ctx, *f.properties.Avb_private_key)
+ }
}
android.SetProvider(ctx, FilesystemProvider, fsInfo)
@@ -1160,10 +1182,6 @@ func (f *filesystem) buildPropFileForMiscInfo(ctx android.ModuleContext) android
if proptools.Bool(f.properties.Use_avb) {
addStr("avb_"+f.partitionName()+"_hashtree_enable", "true")
- if f.properties.Avb_private_key != nil {
- key := android.PathForModuleSrc(ctx, *f.properties.Avb_private_key)
- addStr("avb_"+f.partitionName()+"_key_path", key.String())
- }
addStr("avb_"+f.partitionName()+"_add_hashtree_footer_args", strings.TrimSpace(f.getAvbAddHashtreeFooterArgs(ctx)))
}
@@ -1175,6 +1193,10 @@ func (f *filesystem) buildPropFileForMiscInfo(ctx android.ModuleContext) android
// effect as <partition name>_disable_sparse.
if f.properties.Partition_size == nil {
addStr(f.partitionName()+"_disable_sparse", "true")
+ } else if f.partitionName() == "userdata" {
+ // Add userdata's partition size to misc_info.txt.
+ // userdata has been special-cased to make the make packaging misc_info.txt implementation
+ addStr("userdata_size", strconv.FormatInt(*f.properties.Partition_size, 10))
}
fst := f.fsType(ctx)
@@ -1286,6 +1308,19 @@ func includeFilesInstalledFiles(ctx android.ModuleContext) (ret []depset.DepSet[
return
}
+func (f *filesystem) hasOrIsRecovery(ctx android.ModuleContext) bool {
+ if f.partitionName() == "recovery" {
+ return true
+ }
+ ret := false
+ ctx.VisitDirectDepsWithTag(interPartitionInstallDependencyTag, func(m android.Module) {
+ if fsProvider, ok := android.OtherModuleProvider(ctx, m, FilesystemProvider); ok && fsProvider.PartitionName == "recovery" {
+ ret = true
+ }
+ })
+ return ret
+}
+
func (f *filesystem) buildCpioImage(
ctx android.ModuleContext,
builder *android.RuleBuilder,