Re: setup-storage and GPT partition tables with EFI boot partition

2015-07-06 Thread Kerim Gueney

Hi Ulrich,

thank you for your input!

I used the flag bios_grub because of 
https://www.gnu.org/software/grub/manual/html_node/BIOS-installation.html , 
you're right about it not being exactly correct.


Thomas suggested efi, it's his decision to choose which term to use.

I have only very limited experience (honestly, none - I don't use it) 
with GPT and as such rely on information from others. We hadn't realized 
the redundancy of the feature and it seems to be the case for a few 
people on the mailing list who use GPT. I'm guessing that there is some 
lack of documentation or not enough clarity or something. Either way, 
we'll look into it.


Again, thank you, much appreciated.

Best
Kerim

On 06.07.2015 21:55, Ulrich Zehl wrote:

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/efi200vfatrw
[...]

Regards,
Ulrich

[0] 
https://wiki.archlinux.org/index.php/Unified_Extensible_Firmware_Interface#GPT_partitioned_disks




Re: setup-storage and GPT partition tables with EFI boot partition

2015-07-06 Thread Ulrich Zehl
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/efi200vfatrw
[...]

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=//;


Re: setup-storage and GPT partition tables with EFI boot partition

2015-02-25 Thread Holger Parplies
Hi,

Thomas Lange wrote on 2015-02-23 18:56:52 +0100 [Re: setup-storage and GPT 
partition tables with EFI boot partition]:
  On Thu, 22 Jan 2015 18:31:15 +0100, John Paul Adrian Glaubitz 
  glaub...@physik.fu-berlin.de said:
 
  disk_config sda fstabkey:uuid disklabel:gpt
 [...]
 What if setup-storage would support a new file system type efi? This
 would create a FAT32 fiel system but would set the partition type to
 0xef00 (EFI SYSTEM PARTITION). Then the disk_config file could be like
 this: 
 
 primary /boot/efi   512 efi rw
 primary /   3   ext4rw
 
 
 Any comments?

what happens if you have more than one partition marked efi? Is that legal?
Does the EFI partition need to be the first one?

If it's not legal to specify efi on any partition you want, then in my
opinion it shouldn't be a virtual FS type. I don't know the specification, but
those are the questions that pop into my mind (and I'm not quite sure how an
EFI implementation would be supposed to handle more than one EFI system
partition ;-).

Supposing you are only allowed to have one EFI partition per disk, the
disk_config line would seem to be the appropriate place for the information
(because there's exactly one disk_config line per disk). But again, I'm only
guessing.

Regards,
Holger


Re: setup-storage and GPT partition tables with EFI boot partition

2015-01-23 Thread John Paul Adrian Glaubitz
On 01/22/2015 06:31 PM, John Paul Adrian Glaubitz wrote:
 primary - 512   vfatrw
 primary /   3   ext4rw
 logical swap 8000   swapsw
 logical /var 6000   ext4rw
 primary /local_scratch  1-  ext4rw
 
 which results into an error:
 
 Starting setup-storage 1.7
 Syntax error: invalid partition type at
 /usr/share/fai/setup-storage/Parser.pm line 188, $config_file line 1.

Ok, it turns out this error message is just very confusing and all you
have to do is actually use primary partition types only since GPT
doesn't distinguish between primary and logical.

However, I'm still a bit stuck since setup-storage uses the incorrect
partition type for the EFI system partition. It sets it to 0x0b (FAT32)
but it needs to be 0xef00 (EFI SYSTEM PARTITION). Any idea how to
achieve that?

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913