diff --git a/src/modules/partition/core/PartUtils.cpp b/src/modules/partition/core/PartUtils.cpp index 8fe13f505..54f971f4e 100644 --- a/src/modules/partition/core/PartUtils.cpp +++ b/src/modules/partition/core/PartUtils.cpp @@ -447,31 +447,40 @@ isEfiSystem() } bool -isEfiFilesystemSuitable(const Partition* candidate) +isEfiFilesystemSuitableType( const Partition* candidate ) { auto type = candidate->fileSystem().type(); + + switch ( type ) + { + case FileSystem::Type::Fat32: + return true; +#ifdef WITH_KPMCORE4API + case FileSystem::Type::Fat12: +#endif + 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 +isEfiFilesystemSuitableSize( const Partition* candidate ) +{ auto size = candidate->capacity(); // bytes using CalamaresUtils::Units::operator""_MiB; - - switch( type ) + if ( size >= 300_MiB ) { - case FileSystem::Type::Fat32: - if ( size >= 300_MiB ) - { - return true; - } - cWarning() << "FAT32 filesystem for EFI is too small (" << size << "bytes)"; - return false; -#ifdef WITH_KPMCORE4API - case FileSystem::Type::Fat12: -#endif - 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; + return true; + } + else + { + cWarning() << "Filesystem for EFI is too small (" << size << "bytes)"; + return false; } } @@ -508,6 +517,15 @@ isEfiBootable( const Partition* candidate ) #endif } +// TODO: this is configurable via the config file **already** +size_t +efiFilesystemMinimumSize() +{ + using CalamaresUtils::Units::operator""_MiB; + return 300_MiB; +} + + QString canonicalFilesystemName( const QString& fsName, FileSystem::Type* fsType ) { diff --git a/src/modules/partition/core/PartUtils.h b/src/modules/partition/core/PartUtils.h index 6bf223921..dd4efc867 100644 --- a/src/modules/partition/core/PartUtils.h +++ b/src/modules/partition/core/PartUtils.h @@ -84,9 +84,24 @@ bool isEfiSystem(); /** * @brief Is the @p partition suitable as an EFI boot partition? - * Checks for filesystem type (FAT32) and size (300MiB at least). + * Checks for filesystem type (FAT32). */ -bool isEfiFilesystemSuitable( const Partition* candidate ); +bool isEfiFilesystemSuitableType( const Partition* candidate ); + +/** + * @brief Is the @p partition suitable as an EFI boot partition? + * Checks for filesystem size (300MiB, see efiFilesystemMinimumSize). + */ +bool isEfiFilesystemSuitableSize( const Partition* candidate ); + +/** @brief Returns the minimum size of an EFI boot partition. + * + * This is determined as 300MiB, based on the FAT32 standard + * and EFI documentation (and not a little discussion in Calamares + * issues about what works, what is effective, and what is mandated + * by the standard and how all of those are different). + */ +size_t efiFilesystemMinimumSize(); /** * @brief Is the given @p partition bootable in EFI? Depending on