diff options
| author | 2024-10-14 18:41:18 +0000 | |
|---|---|---|
| committer | 2024-10-14 19:23:08 +0000 | |
| commit | 7a46f6c4247a912ed4cb21e1cabeda6ff67b9c23 (patch) | |
| tree | 91817a6ac4b09644f033c26873e47e5d7bbb2be1 | |
| parent | 8017cca9eaabc14ffda4c8fcfc04b5ef7c047ace (diff) | |
Reland "Create an empty system_ext partition for aosp_cf_*"
This relands https://r.android.com/3304080, with the following fixes
- Skip system_ext if the product (e.g. aosp_x86_64) does not support
system_ext
- Remove analysis error from GetFsTypeFromString if the fs type is
unsupported. Since we are autogenerating partitions now, internal
module creation should be skipped instead of erroring out. `fsType`
will raise an error for handcrafted filesystem modules that explicitly
set fs type to an unsupported type.
Test: presubmits
Test: lunch aosp_x86_64-trunk_staging-userdebug && m nothing
Change-Id: I83e0c266aa3dc2ab830c0636e1a89d00f6906968
| -rw-r--r-- | filesystem/filesystem.go | 17 | ||||
| -rw-r--r-- | fsgen/filesystem_creator.go | 23 |
2 files changed, 30 insertions, 10 deletions
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go index 1e816a752..8c59df371 100644 --- a/filesystem/filesystem.go +++ b/filesystem/filesystem.go @@ -198,6 +198,10 @@ const ( unknown ) +func (fs fsType) IsUnknown() bool { + return fs == unknown +} + type FilesystemInfo struct { // A text file containing the list of paths installed on the partition. FileListFile android.Path @@ -205,8 +209,7 @@ type FilesystemInfo struct { var FilesystemProvider = blueprint.NewProvider[FilesystemInfo]() -func (f *filesystem) fsType(ctx android.ModuleContext) fsType { - typeStr := proptools.StringDefault(f.properties.Type, "ext4") +func GetFsTypeFromString(ctx android.EarlyModuleContext, typeStr string) fsType { switch typeStr { case "ext4": return ext4Type @@ -217,11 +220,19 @@ func (f *filesystem) fsType(ctx android.ModuleContext) fsType { case "cpio": return cpioType default: - ctx.PropertyErrorf("type", "%q not supported", typeStr) return unknown } } +func (f *filesystem) fsType(ctx android.ModuleContext) fsType { + typeStr := proptools.StringDefault(f.properties.Type, "ext4") + fsType := GetFsTypeFromString(ctx, typeStr) + if fsType == unknown { + ctx.PropertyErrorf("type", "%q not supported", typeStr) + } + return fsType +} + func (f *filesystem) installFileName() string { return f.BaseModuleName() + ".img" } diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go index ed0c390ba..169722025 100644 --- a/fsgen/filesystem_creator.go +++ b/fsgen/filesystem_creator.go @@ -114,7 +114,11 @@ func filesystemCreatorFactory() android.Module { } func (f *filesystemCreator) createInternalModules(ctx android.LoadHookContext) { - for _, partitionType := range []string{"system"} { + partitionTypes := []string{"system"} + if ctx.DeviceConfig().SystemExtPath() == "system_ext" { // system_ext exists + partitionTypes = append(partitionTypes, "system_ext") + } + for _, partitionType := range partitionTypes { if f.createPartition(ctx, partitionType) { f.properties.Generated_partition_types = append(f.properties.Generated_partition_types, partitionType) } else { @@ -143,11 +147,14 @@ func (f *filesystemCreator) createDeviceModule(ctx android.LoadHookContext) { Name: proptools.StringPtr(f.generatedModuleName(ctx.Config(), "device")), } - // Currently, only the system partition module is created. + // Currently, only the system and system_ext partition module is created. partitionProps := &filesystem.PartitionNameProperties{} if android.InList("system", f.properties.Generated_partition_types) { partitionProps.System_partition_name = proptools.StringPtr(f.generatedModuleNameForPartition(ctx.Config(), "system")) } + if android.InList("system_ext", f.properties.Generated_partition_types) { + partitionProps.System_ext_partition_name = proptools.StringPtr(f.generatedModuleNameForPartition(ctx.Config(), "system_ext")) + } ctx.CreateModule(filesystem.AndroidDeviceFactory, baseProps, partitionProps) } @@ -183,11 +190,13 @@ func (f *filesystemCreator) createPartition(ctx android.LoadHookContext, partiti fsProps.Partition_name = proptools.StringPtr(partitionType) // BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE - fsProps.Type = proptools.StringPtr(specificPartitionVars.BoardFileSystemType) - if *fsProps.Type != "ext4" { - // TODO(b/372522486): Support other FS types. - // Currently the android_filesystem module type only supports ext4: - // https://cs.android.com/android/platform/superproject/main/+/main:build/soong/filesystem/filesystem.go;l=416;drc=98047cfd07944b297a12d173453bc984806760d2 + fsType := specificPartitionVars.BoardFileSystemType + if fsType == "" { + fsType = "ext4" //default + } + fsProps.Type = proptools.StringPtr(fsType) + if filesystem.GetFsTypeFromString(ctx, *fsProps.Type).IsUnknown() { + // Currently the android_filesystem module type only supports a handful of FS types like ext4, erofs return false } |