Signed-off-by: Dennis Gilmore dennis@ausil.us --- pyanaconda/bootloader.py | 118 ++++++++++++++++++++++++++++++++++++++++++++++ pyanaconda/platform.py | 9 +--- 2 files changed, 120 insertions(+), 7 deletions(-)
diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py index ea4de5e..995ebba 100644 --- a/pyanaconda/bootloader.py +++ b/pyanaconda/bootloader.py @@ -2295,6 +2295,124 @@ class SILO(YabootSILOBase): if rc: raise BootLoaderError("bootloader install failed")
+class UBOOTBase(BootLoader): + + # + # 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) + + +class UBOOT(UBOOTbase): + name = "UBOOT" + _config_file = "boot.scr.in" + packages = ['uboot-tools'] + stage2_format_types = ["ext3", "ext2", "vfat"] + can_dual_boot = False + def write_config_header(self, config): + header = ("# boot.scr.in generated by anaconda\n\n" + "#boot=%(stage1dev)s\n" + % {"stage1dev": self.stage1_device.path}) + config.write(header) + + def write_config_images(self, config): + for image in self.images: + + + args = Arguments() + armMachine = iutil.getARMMachine() + + dtb_addr = "" + dtb_line = "" + load_method = "ext2load" + disk_info = "0:1" + + if armMachine in ["highbank"]: + storage_type = "scsi" + elif armMachine in ["tegra", "kirkwood"]: + storage_type = "usb" + elif armMachine in ["imx"]: + storage_type = "" + disk_info = "" + load_method = "${loadcmd}" + else: + storage_type = "sata" + + if image.initrd: + if armMachine in ["highbank"]: + initrd_addr = "${ramdisk_addr_r}" + elif armMachine in ["imx"]: + initrd_addr = "${ramdiskaddr}" + elif armMachine in ["tegra"]: + initrd_addr = "0x4400000" + else: + initrd_addr = "0x81600000" + + initrd_line = "%s %s %s %s %s/uInitrd" % (load_method, + storage_type, disk_info + initrd_addr, self.boot_prefix) + else: + initrd_line = "" + initrd_addr = "-" + + if armMachine in ["highbank"]: + kernel_addr = "${kernel_addr_r}" + dtb_addr = "${fdt_addr_r}" + elif armMachine in ["imx"]: + kernel_addr = "${kerneladdr}" + elif armMachine in ["tegra"]: + kernel_addr = "0x4080000" + else: + kernel_addr = "0x80300000" + + kernel_line = "%s %s %s %s %s/uImage" % (load_method, + storage_type, disk_info + kernel_addr, self.boot_prefix + + root_device_spec = self.storage.rootDevice.fstabSpec + args.update("ro", "root=%s" % root_device_spec) + + args.update(self.boot_args) + log.info("bootloader.py: used boot args: %s " % args) + + stanza = ("\nsetenv bootargs %(root_device)s rootwait %(args)s\n" + "%(kernel_line)s" + "%(initrd_line)s" + "%(dtb_line)s" + "bootm %(kernel_addr)s %(initrd_addr)s %(dtb_addr)s" + "\n\n" + % {"kernel_line": kernel_line, "initrd_line": initrd_line, + "dtb_line": dtb_line, "kernel_addr": kernel_addr, + "initrd_addr":, initrd_addr, "dtb_addr": dtb_addr, + "root_device": root_device, "args": args}) + config.write(stanza) + + # + # installation + # + def write_config(self): + super(UBOOT, self).write_config() + + + def install(self): + args = ["-A", "arm", "-T", "script", "-C none", "-n", "%s boot script" % productName, "-d", self.config_file, "/boot/boot.scr"] + rc = iutil.execWithRedirect("mkimage", 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 05a496f..ccdec28 100644 --- a/pyanaconda/platform.py +++ b/pyanaconda/platform.py @@ -336,12 +336,7 @@ class Sparc(Platform):
class ARM(Platform): _armMachine = iutil.getARMMachine() - _bootloaderClass = bootloader.GRUB2 - _boot_stage1_device_types = ["disk"] - _boot_mbr_description = N_("Master Boot Record") - _boot_descriptions = {"disk": _boot_mbr_description, - "partition": Platform._boot_partition_description} - + _bootloaderClass = bootloader.UBOOT _disklabel_types = ["msdos"]
@property @@ -349,7 +344,7 @@ class ARM(Platform): return self._armMachine
class omapARM(ARM): - _bootloaderClass = bootloader.UBOOTuEnv + _bootloaderClass = bootloader.UBOOTBase _boot_stage1_format_types = ["vfat"] _boot_stage1_device_types = ["partition"] _boot_stage1_mountpoints = ["/boot/uboot"]