[partition] Use the configured EFI size
The `partition.conf` file contains an EFI-size. The default is 300MiB, but distributions might like to use a bigger (or smaller) value. Apply the configuration consistently everywhere where we need "the size of the EFI partition". Extend the internal method to look at the configured size.
This commit is contained in:
parent
90eb0cd844
commit
05f287ebbb
@ -13,6 +13,7 @@
|
||||
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
#include "partition/PartitionSize.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Variant.h"
|
||||
|
||||
@ -233,7 +234,23 @@ fillGSConfigurationEFI( Calamares::GlobalStorage* gs, const QVariantMap& configu
|
||||
// Read and parse key efiSystemPartitionSize
|
||||
if ( configurationMap.contains( "efiSystemPartitionSize" ) )
|
||||
{
|
||||
gs->insert( "efiSystemPartitionSize", CalamaresUtils::getString( configurationMap, "efiSystemPartitionSize" ) );
|
||||
const QString sizeString = CalamaresUtils::getString( configurationMap, "efiSystemPartitionSize" );
|
||||
CalamaresUtils::Partition::PartitionSize part_size = CalamaresUtils::Partition::PartitionSize( sizeString );
|
||||
if ( part_size.isValid() )
|
||||
{
|
||||
gs->insert( "efiSystemPartitionSize", sizeString );
|
||||
gs->insert( "efiSystemPartitionSize_i", part_size.toBytes() );
|
||||
|
||||
if ( part_size.toBytes() != PartUtils::efiFilesystemMinimumSize() )
|
||||
{
|
||||
cWarning() << "EFI partition size" << sizeString << "has been adjusted to"
|
||||
<< PartUtils::efiFilesystemMinimumSize() << "bytes";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cWarning() << "EFI partition size" << sizeString << "is invalid, ignored";
|
||||
}
|
||||
}
|
||||
|
||||
// Read and parse key efiSystemPartitionName
|
||||
|
@ -471,8 +471,12 @@ bool
|
||||
isEfiFilesystemSuitableSize( const Partition* candidate )
|
||||
{
|
||||
auto size = candidate->capacity(); // bytes
|
||||
if ( size <= 0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( size >= efiFilesystemMinimumSize() )
|
||||
if ( size_t( size ) >= efiFilesystemMinimumSize() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -521,7 +525,19 @@ size_t
|
||||
efiFilesystemMinimumSize()
|
||||
{
|
||||
using CalamaresUtils::Units::operator""_MiB;
|
||||
return 300_MiB;
|
||||
|
||||
auto uefisys_part_sizeB = 300_MiB;
|
||||
auto* gs = Calamares::JobQueue::instance()->globalStorage();
|
||||
if ( gs->contains( "efiSystemPartitionSize_i" ) )
|
||||
{
|
||||
uefisys_part_sizeB = gs->value( "efiSystemPartitionSize_i" ).toLongLong();
|
||||
}
|
||||
// There is a lower limit of what can be configured
|
||||
if ( uefisys_part_sizeB < 32_MiB )
|
||||
{
|
||||
uefisys_part_sizeB = 32_MiB;
|
||||
}
|
||||
return uefisys_part_sizeB;
|
||||
}
|
||||
|
||||
|
||||
|
@ -118,14 +118,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO
|
||||
|
||||
if ( isEfi )
|
||||
{
|
||||
int uefisys_part_sizeB = 300_MiB;
|
||||
if ( gs->contains( "efiSystemPartitionSize" ) )
|
||||
{
|
||||
CalamaresUtils::Partition::PartitionSize part_size
|
||||
= CalamaresUtils::Partition::PartitionSize( gs->value( "efiSystemPartitionSize" ).toString() );
|
||||
uefisys_part_sizeB = part_size.toBytes( dev->capacity() );
|
||||
}
|
||||
|
||||
size_t uefisys_part_sizeB = PartUtils::efiFilesystemMinimumSize();
|
||||
qint64 efiSectorCount = CalamaresUtils::bytesToSectors( uefisys_part_sizeB, dev->logicalSize() );
|
||||
Q_ASSERT( efiSectorCount > 0 );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user