Skip to content
Snippets Groups Projects
Commit b06afd90 authored by Adriaan de Groot's avatar Adriaan de Groot
Browse files

[partition] Read minimum EFI size from GS

parent b7250854
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,10 @@ ...@@ -35,6 +35,10 @@
using Calamares::Partition::isPartitionFreeSpace; using Calamares::Partition::isPartitionFreeSpace;
using Calamares::Partition::isPartitionNew; using Calamares::Partition::isPartitionNew;
using Calamares::Units::operator""_MiB;
static constexpr qint64 efiSpecificationHardMinimumSize = 32_MiB;
namespace PartUtils namespace PartUtils
{ {
...@@ -500,6 +504,10 @@ isEfiFilesystemMinimumSize( const Partition* candidate ) ...@@ -500,6 +504,10 @@ isEfiFilesystemMinimumSize( const Partition* candidate )
{ {
return false; return false;
} }
if ( size < efiSpecificationHardMinimumSize )
{
return false;
}
if ( size >= efiFilesystemMinimumSize() ) if ( size >= efiFilesystemMinimumSize() )
{ {
...@@ -522,21 +530,19 @@ isEfiBootable( const Partition* candidate ) ...@@ -522,21 +530,19 @@ isEfiBootable( const Partition* candidate )
return flags.testFlag( KPM_PARTITION_FLAG_ESP ); return flags.testFlag( KPM_PARTITION_FLAG_ESP );
} }
using Calamares::Units::operator""_MiB;
static constexpr qint64 efiSpecificationHardMinimumSize = 32_MiB;
qint64 qint64
efiFilesystemRecommendedSize() efiFilesystemRecommendedSize()
{ {
const QString key = QStringLiteral( "efiSystemPartitionSize_i" );
qint64 uefisys_part_sizeB = 300_MiB; qint64 uefisys_part_sizeB = 300_MiB;
// The default can be overridden; the key used here comes // The default can be overridden; the key used here comes
// from the partition module Config.cpp // from the partition module Config.cpp
auto* gs = Calamares::JobQueue::instance()->globalStorage(); auto* gs = Calamares::JobQueue::instance()->globalStorage();
if ( gs->contains( "efiSystemPartitionSize_i" ) ) if ( gs->contains( key ) )
{ {
qint64 v = gs->value( "efiSystemPartitionSize_i" ).toLongLong(); qint64 v = gs->value( key ).toLongLong();
uefisys_part_sizeB = v > 0 ? v : 0; uefisys_part_sizeB = v > 0 ? v : 0;
} }
// There is a lower limit of what can be configured // There is a lower limit of what can be configured
...@@ -550,6 +556,24 @@ efiFilesystemRecommendedSize() ...@@ -550,6 +556,24 @@ efiFilesystemRecommendedSize()
qint64 qint64
efiFilesystemMinimumSize() efiFilesystemMinimumSize()
{ {
const QString key = QStringLiteral( "efiSystemPartitionMinimumSize_i" );
qint64 uefisys_part_sizeB = efiFilesystemRecommendedSize();
// The default can be overridden; the key used here comes
// from the partition module Config.cpp
auto* gs = Calamares::JobQueue::instance()->globalStorage();
if ( gs->contains( key ) )
{
qint64 v = gs->value( key ).toLongLong();
uefisys_part_sizeB = v > 0 ? v : 0;
}
// There is a lower limit of what can be configured
if ( uefisys_part_sizeB < efiSpecificationHardMinimumSize )
{
uefisys_part_sizeB = efiSpecificationHardMinimumSize;
}
return uefisys_part_sizeB;
return efiSpecificationHardMinimumSize; return efiSpecificationHardMinimumSize;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment