[partition] Document how the configurable EFI size is coordinated

This commit is contained in:
Adriaan de Groot 2021-09-28 18:22:56 +02:00
parent 05f287ebbb
commit d556dae415
4 changed files with 24 additions and 7 deletions

View File

@ -235,16 +235,18 @@ fillGSConfigurationEFI( Calamares::GlobalStorage* gs, const QVariantMap& configu
if ( configurationMap.contains( "efiSystemPartitionSize" ) ) if ( configurationMap.contains( "efiSystemPartitionSize" ) )
{ {
const QString sizeString = CalamaresUtils::getString( configurationMap, "efiSystemPartitionSize" ); const QString sizeString = CalamaresUtils::getString( configurationMap, "efiSystemPartitionSize" );
CalamaresUtils::Partition::PartitionSize part_size = CalamaresUtils::Partition::PartitionSize( sizeString ); CalamaresUtils::Partition::PartitionSize part_size
if ( part_size.isValid() ) = CalamaresUtils::Partition::PartitionSize( sizeString );
if (part_size.isValid())
{ {
gs->insert( "efiSystemPartitionSize", sizeString ); // Insert once as string, once as a size-in-bytes;
gs->insert( "efiSystemPartitionSize_i", part_size.toBytes() ); // changes to these keys should be synchronized with PartUtils.cpp
gs->insert( "efiSystemPartitionSize", sizeString );
gs->insert( "efiSystemPartitionSize_i", part_size.toBytes());
if ( part_size.toBytes() != PartUtils::efiFilesystemMinimumSize() ) if (part_size.toBytes() != PartUtils::efiFilesystemMinimumSize())
{ {
cWarning() << "EFI partition size" << sizeString << "has been adjusted to" cWarning() << "EFI partition size" << sizeString << "has been adjusted to" << PartUtils::efiFilesystemMinimumSize() << "bytes";
<< PartUtils::efiFilesystemMinimumSize() << "bytes";
} }
} }
else else

View File

@ -527,6 +527,9 @@ efiFilesystemMinimumSize()
using CalamaresUtils::Units::operator""_MiB; using CalamaresUtils::Units::operator""_MiB;
auto uefisys_part_sizeB = 300_MiB; auto uefisys_part_sizeB = 300_MiB;
// The default can be overridden; the key used here comes
// 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( "efiSystemPartitionSize_i" ) )
{ {

View File

@ -100,6 +100,12 @@ bool isEfiFilesystemSuitableSize( const Partition* candidate );
* and EFI documentation (and not a little discussion in Calamares * and EFI documentation (and not a little discussion in Calamares
* issues about what works, what is effective, and what is mandated * issues about what works, what is effective, and what is mandated
* by the standard and how all of those are different). * by the standard and how all of those are different).
*
* This can be configured through the `partition.conf` file,
* key *efiSystemPartitionSize*, which will then apply to both
* automatic partitioning **and** the warning for manual partitioning.
*
* A minimum of 32MiB (which is bonkers-small) is enforced.
*/ */
size_t efiFilesystemMinimumSize(); size_t efiFilesystemMinimumSize();

View File

@ -10,6 +10,12 @@ efiSystemPartition: "/boot/efi"
# This optional setting specifies the size of the EFI system partition. # This optional setting specifies the size of the EFI system partition.
# If nothing is specified, the default size of 300MiB will be used. # If nothing is specified, the default size of 300MiB will be used.
#
# This size applies both to automatic partitioning and the checks
# during manual partitioning. A minimum of 32MiB is enforced,
# 300MiB is the default, M is treated as MiB, and if you really want
# one-million (10^6) bytes, use MB.
#
# efiSystemPartitionSize: 300M # efiSystemPartitionSize: 300M
# This optional setting specifies the name of the EFI system partition (see # This optional setting specifies the name of the EFI system partition (see