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

d.marlin dmarlin at redhat.com
Fri Nov 2 23:59:21 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.
- remove the need to set bootloader --location=none in kickstart.

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..80135b1 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -2102,6 +2102,51 @@ 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):
+        for image in self.images:
+            log.info("bootloader.py: write dummy config stanza.")
+            stanza = (" ")
+            config.write(stanza)
+
+    #
+    # installation
+    #
+    def write_config(self):
+        log.info("bootloader.py: write config.")
+        super(UBOOT, self).write_config()
+
+
+    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 2614e41..587a4a2 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