[partition] Allow a configurable EFI System Partition size
As requested, this commit adds a new configuration option to the partition.conf file, name `efiSystemPartitionSize`. When this option is absent, the default size of 300MiB will be used. Fixes #1090 Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
This commit is contained in:
parent
a5258f07a1
commit
982840bafd
@ -536,6 +536,15 @@ parseSizeString( const QString& sizeString, SizeUnit* unit )
|
||||
return value;
|
||||
}
|
||||
|
||||
qint64
|
||||
parseSizeString( const QString& sizeString, qint64 totalSize )
|
||||
{
|
||||
SizeUnit unit;
|
||||
double value = parseSizeString( sizeString, &unit );
|
||||
|
||||
return sizeToBytes( value, unit, totalSize );
|
||||
}
|
||||
|
||||
qint64
|
||||
sizeToSectors( double size, SizeUnit unit, qint64 totalSectors, qint64 logicalSize )
|
||||
{
|
||||
|
@ -107,6 +107,14 @@ QString findFS( QString fsName, FileSystem::Type* fsType );
|
||||
*/
|
||||
double parseSizeString( const QString& sizeString, SizeUnit* unit );
|
||||
|
||||
/**
|
||||
* @brief Parse a partition size string and return its value in bytes.
|
||||
* @param sizeString the string to parse.
|
||||
* @param totalSize the size of the selected drive (used when the size is expressed in %)
|
||||
* @return the size value in bytes.
|
||||
*/
|
||||
qint64 parseSizeString( const QString& sizeString, qint64 totalSize );
|
||||
|
||||
/**
|
||||
* @brief Convert a partition size to a sectors count.
|
||||
* @param size the partition size.
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "utils/Units.h"
|
||||
#include "utils/NamedEnum.h"
|
||||
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
@ -84,6 +85,7 @@ swapSuggestion( const qint64 availableSpaceB, Choices::SwapChoice swap )
|
||||
void
|
||||
doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionOptions o )
|
||||
{
|
||||
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
|
||||
QString defaultFsType = o.defaultFsType;
|
||||
if ( FileSystem::typeForName( defaultFsType ) == FileSystem::Unknown )
|
||||
defaultFsType = "ext4";
|
||||
@ -92,10 +94,18 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO
|
||||
|
||||
// Partition sizes are expressed in MiB, should be multiples of
|
||||
// the logical sector size (usually 512B). EFI starts with 2MiB
|
||||
// empty and a 300MiB EFI boot partition, while BIOS starts at
|
||||
// empty and a EFI boot partition, while BIOS starts at
|
||||
// the 1MiB boundary (usually sector 2048).
|
||||
int uefisys_part_sizeB = isEfi ? 300_MiB : 0_MiB;
|
||||
int empty_space_sizeB = isEfi ? 2_MiB : 1_MiB;
|
||||
int uefisys_part_sizeB = 0_MiB;
|
||||
|
||||
if ( isEfi )
|
||||
{
|
||||
if ( gs->contains( "efiSystemPartitionSize" ) )
|
||||
uefisys_part_sizeB = PartUtils::parseSizeString( gs->value( "efiSystemPartitionSize" ).toString(), dev->capacity() );
|
||||
else
|
||||
uefisys_part_sizeB = 300_MiB;
|
||||
}
|
||||
|
||||
// Since sectors count from 0, if the space is 2048 sectors in size,
|
||||
// the first free sector has number 2048 (and there are 2048 sectors
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||
* Copyright 2014-2017, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2018, Adriaan de Groot <groot@kde.org>
|
||||
* Copyright 2019, Collabora Ltd
|
||||
* Copyright 2019, Collabora Ltd <arnaud.ferraris@collabora.com>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -489,6 +489,12 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
efiSP = QStringLiteral( "/boot/efi" );
|
||||
gs->insert( "efiSystemPartition", efiSP );
|
||||
|
||||
// Read and parse key efiSystemPartitionSize
|
||||
if ( configurationMap.contains( "efiSystemPartitionSize" ) )
|
||||
{
|
||||
gs->insert( "efiSystemPartitionSize", CalamaresUtils::getString( configurationMap, "efiSystemPartitionSize" ) );
|
||||
}
|
||||
|
||||
// SWAP SETTINGS
|
||||
//
|
||||
// This is a bit convoluted because there's legacy settings to handle as well
|
||||
|
@ -3,6 +3,10 @@
|
||||
# etc.) use just /boot.
|
||||
efiSystemPartition: "/boot/efi"
|
||||
|
||||
# This optional setting specifies the size of the EFI system partition.
|
||||
# If nothing is specified, the default size of 300MiB will be used.
|
||||
# efiSystemPartitionSize: 300M
|
||||
|
||||
# In autogenerated partitioning, allow the user to select a swap size?
|
||||
# If there is exactly one choice, no UI is presented, and the user
|
||||
# cannot make a choice -- this setting is used. If there is more than
|
||||
|
Loading…
Reference in New Issue
Block a user