[PATCH anaconda/master] Add very basic U-Boot support for ARM platforms (take 2).

d.marlin dmarlin at redhat.com
Thu Nov 8 13:08:05 UTC 2012


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

Add a very basic U-Boot bootloader class for ARM platforms.
This addresses the following needs.
- avoids using GRUB2 as a placeholder for the bootloader.
- installs the required uboot-tools package by default.
- ensures the boot/uboot partition is bootable.

Signed-off-by: David A. Marlin <dmarlin at redhat.com>
---
 pyanaconda/bootloader.py |   45 +++++++++++++++++++++++++++++++++++++++++++++
 pyanaconda/platform.py   |    2 +-
 2 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index 8fa3f8b..3ccecfb 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -2102,6 +2102,46 @@ class SILO(YabootSILOBase):
         if rc:
             raise BootLoaderError("bootloader install failed")
 
+class UBOOT(BootLoader):
+    name = "UBOOT"
+    _config_file = "boot.cmd"
+    packages = ['uboot-tools']
+
+    stage2_device_types = ["partition"]
+
+    #
+    # configuration
+    #
+
+    @property
+    def config_dir(self):
+        if self.stage2_device.format.mountpoint == "/boot/uboot/":
+            return "/boot/uboot"
+        else:
+            return "/boot"
+
+    @property
+    def config_file(self):
+        return "%s/%s" % (self.config_dir, self._config_file)
+
+    def write_config_images(self, config):
+        stanza = (" ")
+        config.write(stanza)
+
+
+    #
+    # installation
+    #
+
+    def install(self):
+        _outfile = "%s/boot.scr" % self.config_dir
+        args = ["-p", self.config_file, _outfile]
+        rc = iutil.execWithRedirect("cp", args,
+                                    stdout="/dev/tty5", stderr="/dev/tty5",
+                                    root=ROOT_PATH)
+
+        if rc:
+            raise BootLoaderError("bootloader install failed")
 
 # anaconda-specific functions
 
diff --git a/pyanaconda/platform.py b/pyanaconda/platform.py
index 90c86dc..b1c849b 100644
--- a/pyanaconda/platform.py
+++ b/pyanaconda/platform.py
@@ -336,7 +336,7 @@ class Sparc(Platform):
 
 class ARM(Platform):
     _armMachine = None
-    bootloaderClass = bootloader.GRUB2
+    bootloaderClass = bootloader.UBOOT
     _boot_stage1_device_types = ["disk"]
     _boot_mbr_description = N_("Master Boot Record")
     _boot_descriptions = {"disk": _boot_mbr_description,
-- 
1.7.10.2



More information about the anaconda-patches mailing list