[PATCH grubby/master] Add ARM-OMAP class to create a uboot partition to support the boot-loader.

d.marlin dmarlin at redhat.com
Fri Oct 5 05:48:37 UTC 2012


From: "d.marlin" <dmarlin at redhat.com>

Break out the setup of ARM-OMAP systems, as they need to have a vfat partition
at the start of the disk in order for the SOC to load the initial boot code.
This also sets the weight for the '/' partition to ensure it is the last
partition on the image.

Signed-off-by: David A. Marlin <dmarlin at redhat.com>
---
 pyanaconda/platform.py |   40 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/pyanaconda/platform.py b/pyanaconda/platform.py
index ea5b92f..ad89011 100644
--- a/pyanaconda/platform.py
+++ b/pyanaconda/platform.py
@@ -350,6 +350,40 @@ class ARM(Platform):
             self._armMachine = iutil.getARMMachine()
         return self._armMachine
 
+class omapARM(ARM):
+    _boot_stage1_format_types = ["vfat"]
+    _boot_stage1_device_types = ["partition"]
+    _boot_stage1_mountpoints = ["/boot/uboot"]
+    _boot_uboot_description = N_("U-Boot Partition")
+    _boot_descriptions = {"partition": _boot_uboot_description}
+
+    def setDefaultPartitioning(self):
+        """Return the ARM-OMAP platform-specific partitioning information."""
+        from storage.partspec import PartSpec
+        ret = [PartSpec(mountpoint="/boot/uboot", fstype="vfat", 
+                        size=20, maxSize=200, grow=True, 
+                        weight=self.weight(fstype="vfat", mountpoint="/boot/uboot"))]
+        ret.append(PartSpec(mountpoint="/", fstype="ext4",
+                            size=2000, maxSize=3000,
+                            weight=self.weight(mountpoint="/")))
+        return ret
+
+    def weight(self, fstype=None, mountpoint=None):
+        """Return the ARM-OMAP platform-specific weights for the uboot 
+           and / partitions.  On OMAP, uboot must be the first partition,
+           and '/' must be the last partition, so we try to weight them 
+           accordingly."""
+        score = Platform.weight(self, fstype=fstype, mountpoint=mountpoint)
+        if fstype == "vfat" and mountpoint == "/boot/uboot":
+            score = 6000
+        elif mountpoint == "/":
+            score = -100
+
+        if score:
+            return score
+        else:
+            return 0
+
 def getPlatform():
     """Check the architecture of the system and return an instance of a
        Platform subclass to match.  If the architecture could not be determined,
@@ -377,6 +411,10 @@ def getPlatform():
     elif iutil.isX86():
         return X86()
     elif iutil.isARM():
-        return ARM()
+        armMachine = iutil.getARMMachine()
+        if (armMachine == "omap" ):
+            return omapARM()
+        else:
+            return ARM()
     else:
         raise SystemError, "Could not determine system architecture."
-- 
1.7.10.2



More information about the anaconda-patches mailing list