diff --git a/src/modules/partition/PartitionViewStep.cpp b/src/modules/partition/PartitionViewStep.cpp index 3f57050aa..015aab2ce 100644 --- a/src/modules/partition/PartitionViewStep.cpp +++ b/src/modules/partition/PartitionViewStep.cpp @@ -445,7 +445,7 @@ PartitionViewStep::onLeave() QString message; QString description; - if ( !esp ) + if ( !esp || ( esp && !PartUtils::isEfiFilesystemSuitable( esp ) ) ) { message = tr( "No EFI system partition configured" ); description = tr( "An EFI system partition is necessary to start %1." diff --git a/src/modules/partition/core/PartUtils.cpp b/src/modules/partition/core/PartUtils.cpp index 22e84a09c..5b8572189 100644 --- a/src/modules/partition/core/PartUtils.cpp +++ b/src/modules/partition/core/PartUtils.cpp @@ -446,6 +446,34 @@ isEfiSystem() return QDir( "/sys/firmware/efi/efivars" ).exists(); } +bool +isEfiFilesystemSuitable(const Partition* candidate) +{ + auto type = candidate->fileSystem().type(); + auto size = candidate->capacity(); // bytes + + using CalamaresUtils::Units::operator""_MiB; + + switch( type ) + { + case FileSystem::Type::Fat32: + if ( size >= 300_MiB ) + { + return true; + } + cWarning() << "FAT32 filesystem is too small (" << size << "bytes)"; + return false; + case FileSystem::Type::Fat12: + case FileSystem::Type::Fat16: + cWarning() << "FAT12 and FAT16 are probably not supported by EFI"; + return false; + default: + cWarning() << "EFI boot partition must be FAT32"; + return false; + } +} + + bool isEfiBootable( const Partition* candidate ) { diff --git a/src/modules/partition/core/PartUtils.h b/src/modules/partition/core/PartUtils.h index 5e84e379b..6bf223921 100644 --- a/src/modules/partition/core/PartUtils.h +++ b/src/modules/partition/core/PartUtils.h @@ -82,6 +82,12 @@ OsproberEntryList runOsprober( DeviceModel* dm ); */ bool isEfiSystem(); +/** + * @brief Is the @p partition suitable as an EFI boot partition? + * Checks for filesystem type (FAT32) and size (300MiB at least). + */ +bool isEfiFilesystemSuitable( const Partition* candidate ); + /** * @brief Is the given @p partition bootable in EFI? Depending on * the partition table layout, this may mean different flags.