[PATCH 2/2] ARM: very basic uboot bootloader configuration support

Brian C. Lane bcl at redhat.com
Mon Jul 23 20:48:02 UTC 2012


On Mon, Jul 16, 2012 at 11:24:44AM -0500, Dennis Gilmore wrote:
> Signed-off-by: Dennis Gilmore <dennis at 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):

*Base implies a class that is always subclassed before being used (eg.
YabootSILOBase), Maybe Make this one UBOOT and the other ArmUBOOT since
it has the arm specific logic in it.

> +
> +    #
> +    # 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"

Is .in really the name of the script?


> +    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"

[snip]

I like to see blocks like these implemented as lookups instead of hard
to read block of if/then, it makes it easier to maintain which settings
go with each machine instead of digging through code. If you use a dict
of dicts named for the fields you can then pass the dict to
"%(storage_type)s ..." to generate the output.

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: not available
URL: <https://fedorahosted.org/pipermail/anaconda-patches/attachments/20120723/122a66a4/attachment.sig>


More information about the anaconda-patches mailing list