[Fai-commit] r6437 - branches/stable/3.4/lib/setup-storage

Michael Prokop mika at alioth.debian.org
Fri Apr 15 18:12:19 UTC 2011


Author: mika
Date: 2011-04-15 18:12:04 +0000 (Fri, 15 Apr 2011)
New Revision: 6437

Modified:
   branches/stable/3.4/lib/setup-storage/Sizes.pm
Log:
setup-storage/Sizes.pm: gpt-bios must be sector-wise first partition.

Make extra partition for gpt-bios the first one location-wise but still give it
the last id.

(cherry picked from commit a5d5a7bc1751d15fa4c20b9d67b4e699ad8049fa)

Modified: branches/stable/3.4/lib/setup-storage/Sizes.pm
===================================================================
--- branches/stable/3.4/lib/setup-storage/Sizes.pm	2011-04-15 18:11:42 UTC (rev 6436)
+++ branches/stable/3.4/lib/setup-storage/Sizes.pm	2011-04-15 18:12:04 UTC (rev 6437)
@@ -675,13 +675,20 @@
       $min_req_total_space += 33 * $current_disk->{sector_size};
 
       # on gpt-bios we'll need an additional partition to store what doesn't fit
-      # in the MBR
+      # in the MBR; this partition must be at the beginning, but it should be
+      # created at the very end such as not to invalidate indices of other
+      # partitions
       $FAI::device = $config;
       &FAI::init_part_config("primary");
       $FAI::configs{$config}{gpt_bios_part} = $FAI::partition_pointer->{number};
-      my $s = &FAI::convert_unit("120KiB");
+      my ($s, $e) = &FAI::make_range("1-1", $current_disk->{size} . "B");
       # enter the range into the hash
       $FAI::partition_pointer->{size}->{range} = "$s-$s";
+      # retain the free space at the beginning and fix the position
+      $FAI::partition_pointer->{start_byte} = $next_start;
+      $FAI::partition_pointer->{end_byte} = $next_start + $s - 1;
+      $next_start += $s;
+      $min_req_total_space += $s;
       # set proper defaults
       $FAI::partition_pointer->{encrypt} = 0;
       $FAI::partition_pointer->{filesystem} = "-";
@@ -731,6 +738,11 @@
 
         # partition done
         shift @worklist;
+      # the gpt-bios special partition is set up already
+      } elsif (defined($FAI::configs{$config}{gpt_bios_part}) &&
+        $FAI::configs{$config}{gpt_bios_part} == $part_id) {
+        # partition done
+        shift @worklist;
       # the partition $part_id must be preserved
       } elsif ($part->{size}->{preserve}) {
         ($next_start, $min_req_total_space) = &FAI::do_partition_preserve($part_id,




More information about the Fai-commit mailing list