From 7a46f6c4247a912ed4cb21e1cabeda6ff67b9c23 Mon Sep 17 00:00:00 2001 From: Spandan Das Date: Mon, 14 Oct 2024 18:41:18 +0000 Subject: 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 --- filesystem/filesystem.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'filesystem/filesystem.go') 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" } -- cgit v1.2.3-59-g8ed1b