diff options
author | 2025-01-13 23:14:11 +0000 | |
---|---|---|
committer | 2025-01-14 00:48:42 +0000 | |
commit | 983dd88657f91ec2236e501b2614d7e70a0d0d83 (patch) | |
tree | 0b94b56a69cbf95b68fe45a969228d4e7fd884b0 /fsgen/filesystem_creator.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 'fsgen/filesystem_creator.go')
-rw-r--r-- | fsgen/filesystem_creator.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go index 9d61a60a2..8dfbd6499 100644 --- a/fsgen/filesystem_creator.go +++ b/fsgen/filesystem_creator.go @@ -374,8 +374,14 @@ func partitionSpecificFsProps(ctx android.EarlyModuleContext, fsProps *filesyste fsProps.Security_patch = proptools.StringPtr(partitionVars.OdmSecurityPatch) fsProps.Stem = proptools.StringPtr("odm.img") case "userdata": - fsProps.Base_dir = proptools.StringPtr("data") fsProps.Stem = proptools.StringPtr("userdata.img") + if vars, ok := partitionVars.PartitionQualifiedVariables["userdata"]; ok { + parsed, err := strconv.ParseInt(vars.BoardPartitionSize, 10, 64) + if err != nil { + panic(fmt.Sprintf("Partition size must be an int, got %s", vars.BoardPartitionSize)) + } + fsProps.Partition_size = &parsed + } case "ramdisk": // Following the logic in https://cs.android.com/android/platform/superproject/main/+/c3c5063df32748a8806ce5da5dd0db158eab9ad9:build/make/core/Makefile;l=1307 fsProps.Dirs = android.NewSimpleConfigurable([]string{ @@ -822,7 +828,13 @@ func generateFsProps(ctx android.EarlyModuleContext, partitionType string) (*fil fsProps.Is_auto_generated = proptools.BoolPtr(true) if partitionType != "system" { - fsProps.Mount_point = proptools.StringPtr(partitionType) + mountPoint := proptools.StringPtr(partitionType) + // https://cs.android.com/android/platform/superproject/main/+/main:build/make/tools/releasetools/build_image.py;l=1012;drc=3f576a753594bad3fc838ccb8b1b72f7efac1d50 + if partitionType == "userdata" { + mountPoint = proptools.StringPtr("data") + } + fsProps.Mount_point = mountPoint + } partitionSpecificFsProps(ctx, fsProps, partitionVars, partitionType) |