summaryrefslogtreecommitdiff
path: root/filesystem/filesystem.go
diff options
context:
space:
mode:
Diffstat (limited to 'filesystem/filesystem.go')
-rw-r--r--filesystem/filesystem.go17
1 files changed, 16 insertions, 1 deletions
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index 1861d8e7a..a31516043 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -215,6 +215,13 @@ type FilesystemProperties struct {
// Additional dependencies used for building android products
Android_filesystem_deps AndroidFilesystemDeps
+
+ // Name of the output. Default is $(module_name).img
+ Stem *string
+
+ // The size of the partition on the device. It will be a build error if this built partition
+ // image exceeds this size.
+ Partition_size *int64
}
type AndroidFilesystemDeps struct {
@@ -392,7 +399,7 @@ func (f *filesystem) fsType(ctx android.ModuleContext) fsType {
}
func (f *filesystem) installFileName() string {
- return f.BaseModuleName() + ".img"
+ return proptools.StringDefault(f.properties.Stem, f.BaseModuleName()+".img")
}
func (f *filesystem) partitionName() string {
@@ -669,6 +676,10 @@ func (f *filesystem) buildImageUsingBuildImage(ctx android.ModuleContext) (andro
copyImageFileToProductOut(ctx, builder, f.partitionName(), output)
}
+ if f.properties.Partition_size != nil {
+ assertMaxImageSize(builder, output, *f.properties.Partition_size, false)
+ }
+
// rootDir is not deleted. Might be useful for quick inspection.
builder.Build("build_filesystem_image", fmt.Sprintf("Creating filesystem %s", f.BaseModuleName()))
@@ -806,6 +817,10 @@ func (f *filesystem) buildPropFile(ctx android.ModuleContext) (android.Path, and
}
f.checkFsTypePropertyError(ctx, fst, fsTypeStr(fst))
+ if f.properties.Partition_size != nil {
+ addStr("partition_size", strconv.FormatInt(*f.properties.Partition_size, 10))
+ }
+
propFilePreProcessing := android.PathForModuleOut(ctx, "prop_pre_processing")
android.WriteFileRuleVerbatim(ctx, propFilePreProcessing, propFileString.String())
propFile := android.PathForModuleOut(ctx, "prop")