summaryrefslogtreecommitdiff
path: root/filesystem/logical_partition.go
diff options
context:
space:
mode:
author Jiyong Park <jiyong@google.com> 2024-08-27 17:58:36 +0900
committer Jiyong Park <jiyong@google.com> 2024-08-27 18:00:40 +0900
commit43b157a2650d20efeb67db0fc3d6f4ccc795bf48 (patch)
tree46c4327bc73ce87c3c11a7a6bf2266a420864290 /filesystem/logical_partition.go
parent1282d272918875cd8a15ea8e1cc4ac917d164266 (diff)
logical_partition.groups.partitions.filesystem can be empty
This fixes a minor bug that filesystem image was always needed for a partition in a group. With this change, the filesystem image can be omitted (as is the case for Make). Bug: 339587835 Test: m nothing Change-Id: I2f87612ec824e1298e3bddea8a4b90932b438f41
Diffstat (limited to 'filesystem/logical_partition.go')
-rw-r--r--filesystem/logical_partition.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/filesystem/logical_partition.go b/filesystem/logical_partition.go
index e483fe472..988a57b08 100644
--- a/filesystem/logical_partition.go
+++ b/filesystem/logical_partition.go
@@ -146,9 +146,16 @@ func (l *logicalPartition) GenerateAndroidBuildActions(ctx android.ModuleContext
partitionNames[pName] = true
}
// Get size of the partition by reading the -size.txt file
- pSize := fmt.Sprintf("$(cat %s)", sparseImageSizes[pName])
+ var pSize string
+ if size, hasSize := sparseImageSizes[pName]; hasSize {
+ pSize = fmt.Sprintf("$(cat %s)", size)
+ } else {
+ pSize = "0"
+ }
cmd.FlagWithArg("--partition=", fmt.Sprintf("%s:readonly:%s:%s", pName, pSize, gName))
- cmd.FlagWithInput("--image="+pName+"=", sparseImages[pName])
+ if image, hasImage := sparseImages[pName]; hasImage {
+ cmd.FlagWithInput("--image="+pName+"=", image)
+ }
}
}
@@ -192,6 +199,9 @@ func (l *logicalPartition) GenerateAndroidBuildActions(ctx android.ModuleContext
// Add a rule that converts the filesystem for the given partition to the given rule builder. The
// path to the sparse file and the text file having the size of the partition are returned.
func sparseFilesystem(ctx android.ModuleContext, p partitionProperties, builder *android.RuleBuilder) (sparseImg android.OutputPath, sizeTxt android.OutputPath) {
+ if p.Filesystem == nil {
+ return
+ }
img := android.PathForModuleSrc(ctx, proptools.String(p.Filesystem))
name := proptools.String(p.Name)
sparseImg = android.PathForModuleOut(ctx, name+".img").OutputPath