Hi!

First of all, I was previously not subscribed to this list, so please
excuse any broken references.

Kerim Gueney wrote:
>
> Do note the new "efi" partition type. It applies the vFAT filesystem
> onto the partition and sets the partition type to EFI System Partition.
>
> We'd appreciate it, if you guys could test it and reported any bugs you
> encounter.

I have some remarks, and one bug report.

To create an EFI System partition (ESP; gdisk partition type EF00) with
parted, you need to set a partition's "boot" flag (see [0]). The bug is:
The new code sets a partition's "bios_grub" flag, resulting in (gdisk)
partition type EF02.

Also, I feel that "esp" is a better identifier than "efi", as the former
abbreviation appears in other literature and seems less ambiguous.

I have attached a patch that addresses these issues (based on
2dadbeeaddaa7f6c778146ad35782281de5b074d rather than HEAD because I feel it
shows the differences better). Please feel free to use it if you find it
helpful.

Additionally, I want to point out that you can create an EFI System
partition without the new feature with the "bootable:<number>" disk option,
like so:

disk_config disk1 disklabel:gpt fstabkey:uuid bootable:1
primary         /boot/efi        200            vfat    rw
[...]

Regards,
Ulrich

[0] 
https://wiki.archlinux.org/index.php/Unified_Extensible_Firmware_Interface#GPT_partitioned_disks
diff --git a/lib/setup-storage/Commands.pm b/lib/setup-storage/Commands.pm
index 00d5e33..60426b0 100644
--- a/lib/setup-storage/Commands.pm
+++ b/lib/setup-storage/Commands.pm
@@ -1328,7 +1328,7 @@ sub setup_partitions {
     $flags = $FAI::current_config{$disk}{partitions}{$mapped_id}{flags}
       if ($part->{size}->{preserve} || $part->{size}->{resize});
     # set the bootable flag, if requested at all
-    $flags .= ",boot" if($FAI::configs{$config}{bootable} == $part_id);
+    $flags .= ",boot" if($FAI::configs{$config}{bootable} == $part_id || defined($part->{esp}));
     # set the bios_grub flag on BIOS compatible GPT tables
     $flags .= ",bios_grub" if($FAI::configs{$config}{disklabel} eq "gpt-bios"
       && $FAI::configs{$config}{gpt_bios_part} == $part_id);
diff --git a/lib/setup-storage/Parser.pm b/lib/setup-storage/Parser.pm
index 5e47ac5..25ff2dd 100755
--- a/lib/setup-storage/Parser.pm
+++ b/lib/setup-storage/Parser.pm
@@ -1066,6 +1066,14 @@ $FAI::Parser = Parse::RecDescent->new(
           my ($fs, $journal) = split(/:/, $item[1]);
           my $to_be_preserved = 0;
 
+          if ($fs eq "esp") {
+            # EFI System Partition
+            die "EFI system partition (ESP) requires mountpoint at or in /boot\n"
+              unless ($FAI::partition_pointer->{mountpoint} =~ m/^\/boot/);
+            $FAI::partition_pointer->{esp} = 1;
+            $fs = "vfat";
+          }
+
           $FAI::partition_pointer->{filesystem} = $fs;
 
           defined($journal) and $journal =~ s/journal=//;

Reply via email to