Set the ESP flag in partition rather than bootloader.

The manual partitioning setup was already requiring the user to check
the ESP flag for the EFI System Partition. Now the autopartitioning also
sets it directly (a one-line change). The sgdisk call in the bootloader
module is thus no longer necessary (it was only a workaround because
kpmcore < 2.1.0 did not support FlagEsp), so remove that snippet.

This fixes configurations such as NVME disks where splitting boot_device
into boot_device[-1:] and boot_device[:-1] is not the correct split
(because the partition gets a 2-letter suffix) (reported by demmm on
IRC).
This commit is contained in:
Kevin Kofler 2016-10-29 00:52:38 +02:00
parent 4488761a63
commit 5377003f89
2 changed files with 3 additions and 29 deletions

View File

@ -258,7 +258,7 @@ def vfat_correct_case(parent, name):
def prepare_bootloader(fw_type): def prepare_bootloader(fw_type):
""" Prepares bootloader and set proper flags to EFI boot partition (esp,boot). """ Prepares bootloader.
Based on value 'efi_boot_loader', it either calls systemd-boot or grub to be installed. Based on value 'efi_boot_loader', it either calls systemd-boot or grub to be installed.
:param fw_type: :param fw_type:
@ -267,33 +267,6 @@ def prepare_bootloader(fw_type):
efi_boot_loader = libcalamares.job.configuration["efiBootLoader"] efi_boot_loader = libcalamares.job.configuration["efiBootLoader"]
efi_directory = libcalamares.globalstorage.value("efiSystemPartition") efi_directory = libcalamares.globalstorage.value("efiSystemPartition")
if fw_type == "efi":
partitions = libcalamares.globalstorage.value("partitions")
boot_p = ""
device = ""
for partition in partitions:
if partition["mountPoint"] == efi_directory:
boot_device = partition["device"]
boot_p = boot_device[-1:]
device = boot_device[:-1]
if not boot_p or not device:
return ("EFI directory \"{!s}\" not found!".format(efi_directory),
"Boot partition: \"{!s}\"".format(boot_p),
"Boot device: \"{!s}\"".format(device))
else:
print("EFI directory: \"{!s}\"".format(efi_directory))
print("Boot partition: \"{!s}\"".format(boot_p))
print("Boot device: \"{!s}\"".format(device))
if not device:
print("WARNING: no EFI system partition or EFI system partition mount point not set.")
print(" >>> no EFI bootloader will be installed <<<")
return None
print("Set 'EF00' flag")
subprocess.call(["sgdisk", "--typecode={!s}:EF00".format(boot_p), "{!s}".format(device)])
if efi_boot_loader == "systemd-boot" and fw_type == "efi": if efi_boot_loader == "systemd-boot" and fw_type == "efi":
install_systemd_boot(efi_directory) install_systemd_boot(efi_directory)
else: else:

View File

@ -140,7 +140,8 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
PartitionRole( PartitionRole::Primary ), PartitionRole( PartitionRole::Primary ),
FileSystem::Fat32, FileSystem::Fat32,
firstFreeSector, firstFreeSector,
lastSector lastSector,
PartitionTable::FlagEsp
); );
PartitionInfo::setFormat( efiPartition, true ); PartitionInfo::setFormat( efiPartition, true );
PartitionInfo::setMountPoint( efiPartition, Calamares::JobQueue::instance() PartitionInfo::setMountPoint( efiPartition, Calamares::JobQueue::instance()