[partition] Introduce check for EFI partition type-and-size

Re-use the existing message about partition type and size,
since I don't want to introduce another message with all the
specifics; give a works-always message instead.

The check itself is also straightforward, avoiding all of the
nuances and technically-this-might-work cases: FAT32, 300MiB+.

FIXES #607
main
Adriaan de Groot 4 years ago
parent b5c56fd579
commit a4fadcd9be

@ -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."

@ -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 )
{

@ -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.

Loading…
Cancel
Save