diff --git a/src/modules/partition/Config.cpp b/src/modules/partition/Config.cpp index 091817e6af09ddad5e917d6f1a4dfe4ec2e71f66..31d7ff56ca60b7753cf9007bb38db1b8ff115be1 100644 --- a/src/modules/partition/Config.cpp +++ b/src/modules/partition/Config.cpp @@ -274,38 +274,66 @@ fillGSConfigurationEFI( Calamares::GlobalStorage* gs, const QVariantMap& configu QString firmwareType( PartUtils::isEfiSystem() ? QStringLiteral( "efi" ) : QStringLiteral( "bios" ) ); gs->insert( "firmwareType", firmwareType ); - gs->insert( "efiSystemPartition", - Calamares::getString( configurationMap, "efiSystemPartition", QStringLiteral( "/boot/efi" ) ) ); + bool ok = false; + auto efiConfiguration = Calamares::getSubMap( configurationMap, "efi", ok ); - // Read and parse key efiSystemPartitionSize - if ( configurationMap.contains( "efiSystemPartitionSize" ) ) + // Mount Point { - const QString sizeString = Calamares::getString( configurationMap, "efiSystemPartitionSize" ); - Calamares::Partition::PartitionSize part_size = Calamares::Partition::PartitionSize( sizeString ); - if ( part_size.isValid() ) - { - // Insert once as string, once as a size-in-bytes; - // changes to these keys should be synchronized with PartUtils.cpp - gs->insert( PartUtils::efiFilesystemRecommendedSizeGSKey(), part_size.toBytes() ); + const auto efiSystemPartition = Calamares::getString( + efiConfiguration, + "mountPoint", + Calamares::getString( configurationMap, "efiSystemPartition", QStringLiteral( "/boot/efi" ) ) ); + // This specific GS key is also used by bootloader and grubcfg modules, + // as well as partition module internalls. + gs->insert( "efiSystemPartition", efiSystemPartition ); + } - // Assign long long int to long unsigned int to prevent compilation warning - auto byte_part_size = part_size.toBytes(); - if ( byte_part_size != PartUtils::efiFilesystemRecommendedSize() ) + // Sizes + { + const auto efiRecommendedSize = Calamares::getString( + efiConfiguration, "recommendedSize", Calamares::getString( configurationMap, "efiSystemPartitionSize" ) ); + if ( !efiRecommendedSize.isEmpty() ) + { + Calamares::Partition::PartitionSize part_size = Calamares::Partition::PartitionSize( efiRecommendedSize ); + if ( part_size.isValid() ) { - cWarning() << "EFI partition size" << sizeString << "has been adjusted to" - << PartUtils::efiFilesystemRecommendedSize() << "bytes"; + gs->insert( PartUtils::efiFilesystemRecommendedSizeGSKey(), part_size.toBytes() ); + + // Assign long long int to long unsigned int to prevent compilation warning, + // checks for loss-of-precision in the conversion. + auto byte_part_size = part_size.toBytes(); + if ( byte_part_size != PartUtils::efiFilesystemRecommendedSize() ) + { + cWarning() << "EFI partition size" << efiRecommendedSize << "has been adjusted to" + << PartUtils::efiFilesystemRecommendedSize() << "bytes"; + } + } + else + { + cWarning() << "EFI partition size" << efiRecommendedSize << "is invalid, ignored"; } } - else + + const auto efiMinimumSize = Calamares::getString( efiConfiguration, "minimumSize" ); + if ( !efiMinimumSize.isEmpty() ) { - cWarning() << "EFI partition size" << sizeString << "is invalid, ignored"; + Calamares::Partition::PartitionSize part_size = Calamares::Partition::PartitionSize( efiRecommendedSize ); + if ( part_size.isValid() ) + { + gs->insert( PartUtils::efiFilesystemMinimumSizeGSKey(), part_size.toBytes() ); + } } } - // Read and parse key efiSystemPartitionName - if ( configurationMap.contains( "efiSystemPartitionName" ) ) + // Name (label) of partition { - gs->insert( "efiSystemPartitionName", Calamares::getString( configurationMap, "efiSystemPartitionName" ) ); + const auto efiLabel = Calamares::getString( + efiConfiguration, "label", Calamares::getString( configurationMap, "efiSystemPartitionName" ) ); + + if ( !efiLabel.isEmpty() ) + { + gs->insert( "efiSystemPartitionName", efiLabel ); + } } } diff --git a/src/modules/partition/partition.conf b/src/modules/partition/partition.conf index 0ce6e1486a18fe3fe48dc4529ec1573a8f826b7f..59b7db2d80b6db1b1f0c2bb0c4ca787793142bef 100644 --- a/src/modules/partition/partition.conf +++ b/src/modules/partition/partition.conf @@ -1,18 +1,28 @@ # SPDX-FileCopyrightText: no # SPDX-License-Identifier: CC0-1.0 # -# This setting specifies the mount point of the EFI system partition. Some -# distributions (Fedora, Debian, Manjaro, etc.) use /boot/efi, others (KaOS, -# etc.) use just /boot. -# -# Defaults to "/boot/efi", may be empty (but weird effects ensue) -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. -# -# 300MiB is the default, and when writing quantities here, M is treated -# as MiB, and if you really want one-million (10^6) bytes, use MB. +# Options for EFI system partition. +# +# - *mountPoint* +# This setting specifies the mount point of the EFI system partition. Some +# distributions (Fedora, Debian, Manjaro, etc.) use /boot/efi, others (KaOS, +# etc.) use just /boot. +# +# Defaults to "/boot/efi", may be empty (but weird effects ensue) +# - *recommendedSize* +# This optional setting specifies the size of the EFI system partition. +# If nothing is specified, the default size of 300MiB will be used. +# When writing quantities here, M is treated as MiB, and if you really +# want one-million (10^6) bytes, use MB. +# - *minimumSize* +# This optional setting specifies the absolute minimum size of the EFI +# system partition. If nothing is specified, the *recommendedSize* +# is used instead. +# - *label* +# This optional setting specifies the name of the EFI system partition (see +# PARTLABEL; gpt only; requires KPMCore >= 4.2.0). +# If nothing is specified, the partition name is left unset. # # Going below the *recommended* size is allowed, but the user will # get a warning that it might not work. Going below the *minimum* @@ -22,15 +32,18 @@ efiSystemPartition: "/boot/efi" # spec. If minimum is not specified, it defaults to the recommended # size. Distro's that allow more user latitude can set the minimum lower. efi: + mountPoint: "/boot/efi" recommendedSize: 300MiB minimumSize: 32MiB + label: "EFI" + +# Deprecated alias of efi.mountPoint +# efiSystemPartition: "/boot/efi" -# This is a deprecated alias of efi.recommendedSize +# Deprecated alias of efi.recommendedSize # efiSystemPartitionSize: 300MiB -# This optional setting specifies the name of the EFI system partition (see -# PARTLABEL; gpt only; requires KPMCore >= 4.2.0). -# If nothing is specified, the partition name is left unset. +# Deprecated alias of efi.label # efiSystemPartitionName: EFI # In autogenerated partitioning, allow the user to select a swap size? diff --git a/src/modules/partition/partition.schema.yaml b/src/modules/partition/partition.schema.yaml index 557be2d2bc0ee3e781d80490c13d63bf92828e95..769c1abae56a4fe44e7838923b9d6e3027530602 100644 --- a/src/modules/partition/partition.schema.yaml +++ b/src/modules/partition/partition.schema.yaml @@ -7,15 +7,17 @@ $id: https://calamares.io/schemas/partition additionalProperties: false type: object properties: - efiSystemPartition: { type: string } # Mount point + efiSystemPartition: { type: string } # Deprecated alias of efi.mountPoint efiSystemPartitionSize: { type: string } # Deprecated alias of efi.recommendedSize - efiSystemPartitionName: { type: string } + efiSystemPartitionName: { type: string } # Deprecated alias of efi.label efi: type: object properties: recommendedSize: { type: string } minimumSize: { type: string } + label: { type: string } + mountPoint: { type: string } additionalProperties: false userSwapChoices: { type: array, items: { type: string, enum: [ none, reuse, small, suspend, file ] } } @@ -41,5 +43,4 @@ properties: requiredStorage: { type: number } required: - - efiSystemPartition - userSwapChoices