diff options
author | 2025-01-13 23:14:11 +0000 | |
---|---|---|
committer | 2025-01-14 00:48:42 +0000 | |
commit | 983dd88657f91ec2236e501b2614d7e70a0d0d83 (patch) | |
tree | 0b94b56a69cbf95b68fe45a969228d4e7fd884b0 /filesystem/filesystem.go | |
parent | be83547f31bbbb2e161c3d9bd004507c03742f31 (diff) |
Allow building userdata partition in Soong
The soong vs make generated userdata images are still not bit identical,
but this change resolves execution time failure from build_image when
building userdata.img.
Implementation details:
- Introduce partition_size property to filesystem module
- Specify the correct mount point for userdata partition
Test: m out/soong/.intermediates/build/soong/fsgen/aosp_cf_x86_64_phone_generated_userdata_image/android_common/userdata.img
Bug: 388920173
Change-Id: I2c0945ce70d74c632ba241c8a93c60763cfe87e7
Diffstat (limited to 'filesystem/filesystem.go')
-rw-r--r-- | filesystem/filesystem.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go index 993c46e49..a31516043 100644 --- a/filesystem/filesystem.go +++ b/filesystem/filesystem.go @@ -218,6 +218,10 @@ type FilesystemProperties struct { // 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 { @@ -672,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())) @@ -809,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") |