[partition] Disentangle questions of suitability of ESP
- split into size, type, flags so the warning message can be tailored to what is wrong.
This commit is contained in:
parent
7d08770806
commit
6324fa3eb9
@ -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 )
|
||||
{
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user