[PATCH 1/2] Check MBR gap size even when /boot is on a plain partition. (#986431)

David Lehman dlehman at redhat.com
Tue Aug 6 19:03:59 UTC 2013


---
 pyanaconda/bootloader.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index 12678f7..04baef2 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -1576,6 +1576,8 @@ class GRUB2(GRUB):
         sure it starts >= 512K, otherwise return an error.
         """
         ret = True
+        base_gap_bytes = 32256      # 31.5KiB
+        advanced_gap_bytes = 524288 # 512KiB
         self.errors = []
         self.warnings = []
 
@@ -1583,9 +1585,10 @@ class GRUB2(GRUB):
             return ret
 
         # These are small enough to fit
-        if self.stage2_device.format.type in ("ext2", "ext3", "ext4") \
-           and self.stage2_device.type == "partition":
-            return ret
+        if self.stage2_device.type == "partition":
+            min_start = base_gap_bytes
+        else:
+            min_start = advanced_gap_bytes
 
         if not self.stage1_disk:
             return False
@@ -1594,7 +1597,7 @@ class GRUB2(GRUB):
         parts = self.stage1_disk.format.partedDisk.partitions
         for p in parts:
             start = p.geometry.start * p.disk.device.sectorSize
-            if not p.getFlag(PARTITION_BIOS_GRUB) and start < 1024*512:
+            if not p.getFlag(PARTITION_BIOS_GRUB) and start < min_start:
                 msg = _("%(deviceName)s may not have enough space for grub2 to embed "
                         "core.img when using the %(fsType)s filesystem on %(deviceType)s") \
                         % {"deviceName": self.stage1_device.name, "fsType": self.stage2_device.format.type,
-- 
1.8.1.4



More information about the anaconda-patches mailing list