Create an empty system_ext partition for aosp_cf_*
Cuttlefish uses erofs, which is now supported. With this CL, empty
system and system_ext filesystem soong modules will be created
This CL also makes ext4 the default fs. If
`BOARD_$PARTITION_IMAGE_FILE_SYSTEM_TYPE` is empty, ext4 will be used.
Bug: 372487849
Test: lunch aosp_cf_x86_64_phone-trunk_staging-userdebug && m nothing
Test: verified that soong modules are created for system and system_ext
Change-Id: Ib4eecb63e86a09a45853279c1afce5c26e5202d4
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index 87c6381..1ab07a2 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -198,6 +198,10 @@
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 @@
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
@@ -220,6 +223,11 @@
ctx.PropertyErrorf("type", "%q not supported", typeStr)
return unknown
}
+
+}
+
+func (f *filesystem) fsType(ctx android.ModuleContext) fsType {
+ return GetFsTypeFromString(ctx, proptools.StringDefault(f.properties.Type, "ext4"))
}
func (f *filesystem) installFileName() string {
diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go
index 7db70e8..5ab1b9b 100644
--- a/fsgen/filesystem_creator.go
+++ b/fsgen/filesystem_creator.go
@@ -59,7 +59,7 @@
}
func (f *filesystemCreator) createInternalModules(ctx android.LoadHookContext) {
- for _, partitionType := range []string{"system"} {
+ for _, partitionType := range []string{"system", "system_ext"} {
if f.createPartition(ctx, partitionType) {
f.properties.Generated_partition_types = append(f.properties.Generated_partition_types, partitionType)
} else {
@@ -88,11 +88,14 @@
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)
}
@@ -128,11 +131,13 @@
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
}