[PATCH] Add PPC PReP, Apple Bootstrap, and EFI boot device formats.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 platform.py           |   13 +++++++------
 storage/devices.py    |    4 ++++
 storage/devicetree.py |   12 ++++++++++++
 storage/formats/fs.py |   44 ++++++++++++++++++++++++++++++++------------
 4 files changed, 55 insertions(+), 18 deletions(-)

diff --git a/platform.py b/platform.py
index f1a20a4..6bd0fd6 100644
--- a/platform.py
+++ b/platform.py
@@ -170,8 +170,8 @@ class EFI(Platform):
             if not req.format.type.startswith("ext"):
                 raise FSError("/boot is not ext2")
         elif req.format.mountpoint == "/boot/efi":
-            if not req.format.type.endswith("fat"):
-                raise FSError("/boot/efi is not vfat")
+            if not req.format.type != "efi":
+                raise FSError("/boot/efi is not efi")
 
     def setDefaultPartitioning(self):
         ret = Platform.setDefaultPartitioning(self)
@@ -236,7 +236,7 @@ class IPSeriesPPC(PPC):
 
         # We want the first PReP partition.
         for device in self.anaconda.id.storage.partitions:
-            if device.partedPartition.getFlag(parted.PARTITION_PREP):
+            if device.format.name == "prepboot":
                 bootDev = device
                 break
 
@@ -279,9 +279,10 @@ class NewWorldPPC(PPC):
         bootDev = None
 
         for part in self.anaconda.id.storage.partitions:
-            # XXX do we need to also check the size?
-            if part.format.type == "hfs" and self.validBootPartSize(part.size):
+            if part.format.type == "appleboot" and self.validBootPartSize(part.size):
                 bootDev = part
+                # if we're only picking one, it might as well be the first
+                break
 
         return bootDev
 
@@ -298,7 +299,7 @@ class NewWorldPPC(PPC):
         else:
             ret["boot"] = (bootDev.name, N_("Apple Bootstrap"))
             for (n, device) in enumerate(self.anaconda.id.storage.partitions):
-                if device.format.type == "hfs" and device.bootable and device.path != bootDev.path:
+                if device.format.type == "appleboot" and device.path != bootDev.path:
                     ret["boot%d" % n] = (device.path, N_("Apple Bootstrap"))
 
         return ret
diff --git a/storage/devices.py b/storage/devices.py
index 415697c..44320b6 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -903,6 +903,10 @@ class PartitionDevice(StorageDevice):
 
             # collect information about the partition from parted
             self.probe()
+            if self.getFlag(parted.PARTITION_PREP):
+                # the only way to identify a PPC PReP Boot partition is to
+                # check the partition type/flags, so do it here.
+                self.format = getFormat("prep", device=self.path, exists=True)
         else:
             # XXX It might be worthwhile to create a shit-simple
             #     PartitionRequest class and pass one to this constructor
diff --git a/storage/devicetree.py b/storage/devicetree.py
index ae6bed9..63339dd 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -1140,6 +1140,18 @@ class DeviceTree(object):
                     kwargs["peStart"] = udev_device_get_pv_pe_start(info)
                 except KeyError:
                     log.debug("PV %s has no pe_start" % name)
+            elif format_type == "vfat":
+                # efi magic
+                if isinstance(device, PartitionDevice) and device.bootable:
+                    efi = formats.getFormat("efi")
+                    if efi.minSize <= device.size <= efi.maxSize:
+                        args[0] = "efi"
+            elif format_type == "hfs":
+                # apple bootstrap magic
+                if isinstance(device, PartitionDevice) and device.bootable:
+                    apple = formats.getFormat("appleboot")
+                    if apple.minSize <= device.size <= apple.maxSize:
+                        args[0] = "appleboot"
 
             format = formats.getFormat(*args, **kwargs)
             device.format = format
diff --git a/storage/formats/fs.py b/storage/formats/fs.py
index 1939434..bc0eb58 100644
--- a/storage/formats/fs.py
+++ b/storage/formats/fs.py
@@ -783,11 +783,7 @@ register_device_format(Ext4FS)
 
 
 class FATFS(FS):
-    """ FAT filesystem.
-
-        XXX Do we want to subclass this for EFI or twiddle bootable based
-            on the platform?
-    """
+    """ FAT filesystem. """
     _type = "vfat"
     _mkfs = "mkdosfs"
     _labelfs = "dosfslabel"
@@ -797,15 +793,23 @@ class FATFS(FS):
     _packages = [ "dosfstools" ]
     _defaultMountOptions = ["umask=0077", "shortname=winnt"]
 
-    @property
-    def bootable(self):
-        retval = self._bootable
-        #if self.type in platform.bootableFSTypes:
-        #    retval = True
+register_device_format(FATFS)
 
-        return retval
 
-register_device_format(FATFS)
+class EFIFS(FATFS):
+    _type = "efi"
+    _name = "EFI System Partition"
+    _minSize = 50
+    _maxSize = 256
+    _bootable = True
+
+    @property
+    def supported(self):
+        import platform
+        return (isinstance(platform.getPlatform(None), platform.EFI)
+                and self.utilsAvailable)
+
+register_device_format(EFIFS)
 
 
 class BTRFS(FS):
@@ -928,6 +932,22 @@ class HFS(FS):
 register_device_format(HFS)
 
 
+class AppleBootstrapFS(HFS):
+    _type = "appleboot"
+    _name = "Apple Bootstrap"
+    _bootable = True
+    _minSize = 800.00 / 1024.00
+    _maxSize = 1
+
+    @property
+    def supported(self):
+        import platform
+        return (isinstance(platform.getPlatform(None), platform.NewWorldPPC)
+                and self.utilsAvailable)
+
+register_device_format(AppleBootstrapFS)
+
+
 # this doesn't need to be here
 class HFSPlus(FS):
     _type = "hfs+"
-- 
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux