--- pyanaconda/platform.py | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/platform.py b/pyanaconda/platform.py index 1611797..05a496f 100644 --- a/pyanaconda/platform.py +++ b/pyanaconda/platform.py @@ -348,6 +348,32 @@ class ARM(Platform): def armMachine(self): return self._armMachine
+class omapARM(ARM): + _bootloaderClass = bootloader.UBOOTuEnv + _boot_stage1_format_types = ["vfat"] + _boot_stage1_device_types = ["partition"] + _boot_stage1_mountpoints = ["/boot/uboot"] + _boot_mbr_description = N_("Master Boot Record") + _boot_descriptions = {"disk": _boot_mbr_description, + "partition": Platform._boot_partition_description} + + def setDefaultPartitioning(self): + from storage.partspec import PartSpec + ret = Platform.setDefaultPartitioning(self) + ret.append(PartSpec(mountpoint="/boot/uboot", fstype="vfat", size=20, + maxSize=20, + grow=True, weight=self.weight(fstype="vfat"))) + return ret + + def weight(self, fstype=None, mountpoint=None): + score = Platform.weight(self, fstype=fstype, mountpoint=mountpoint) + if score: + return score + elif fstype == "vfat" and mountpoint == "/boot/uboot": + return 6000 + else: + return 0 + def getPlatform(anaconda): """Check the architecture of the system and return an instance of a Platform subclass to match. If the architecture could not be determined, @@ -375,6 +401,11 @@ def getPlatform(anaconda): elif iutil.isX86(): return X86(anaconda) elif iutil.isARM(): - return ARM(anaconda) + armMachine = iutil.getARMMachine() + + if (armMachine == "omap" ): + return omapARM(anaconda) + else: + return ARM(anaconda) else: raise SystemError, "Could not determine system architecture."
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"]
On Mon, Jul 16, 2012 at 11:24:44AM -0500, Dennis Gilmore wrote:
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):
*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.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
El Mon, 23 Jul 2012 13:48:02 -0700 "Brian C. Lane" bcl@redhat.com escribió:
On Mon, Jul 16, 2012 at 11:24:44AM -0500, Dennis Gilmore wrote:
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):
*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.
Its intended to be the base ive not implemented any of the support needed for OMAP yet they use a uEnv.txt file instead of boot.scr
we cant easily support OMAP boot loaders support yet we need to put in place the bootloader binaries dependent on the exact board we are using.
not sure that we will ever support uboot on any of the other arches that it supports. maybe ill go with UBOOTuEnv and UBOOTboot for the config files
- #
- # 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?
it can be anything generally we use boot.scr.in we then run mkimage on it to wrap it into a format that uboot will load I have seen boot.cmd used also.
- 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.
really it needs to be based on the storage type used for the install. ive not yet worked out the best way to do that. this was just a generic mostly get it right to take the first step. im open to ideas on how to do it right.
Dennis
On Fri, Aug 03, 2012 at 04:49:57AM -0500, Dennis Gilmore wrote:
El Mon, 23 Jul 2012 13:48:02 -0700
+class UBOOT(UBOOTbase):
- name = "UBOOT"
- _config_file = "boot.scr.in"
Is .in really the name of the script?
it can be anything generally we use boot.scr.in we then run mkimage on it to wrap it into a format that uboot will load I have seen boot.cmd used also.
Just wanted to make sure that was the real name since .in is usually associated with the input to automake.
- 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.
really it needs to be based on the storage type used for the install. ive not yet worked out the best way to do that. this was just a generic mostly get it right to take the first step. im open to ideas on how to do it right.
Something like this (untested): default = { "boot_prefix" : self.boot_prefix, "dtb_addr": "", "dtb_line": "", "load_method": "ext2load", "disk_info": "0:1", "storage_type": "sata", "initrd_addr": "0x81600000", "kernel_addr": "0x80300000"}
settings = { "highbank": { "boot_prefix": self.boot_prefix, "dtb_addr": "${fdt_addr_r}", "dtb_line": "", "load_method": "ext2load", "disk_info": "0:1", "storage_type": "scsi", "initrd_addr": "${ramdisk_addr_r}", "kernel_addr": "${kernel_addr_r}"}, "tegra": { "boot_prefix": self.boot_prefix, "dtb_addr": "", "dtb_line": "", "load_method": "ext2load", "disk_info": "0:1", "storage_type": "usb", "initrd_addr": "0x4400000", "kernel_addr": "0x4080000"}, }
details = settings.get(armMachine, default) initrd_line = "%(load_method)s %(storage_type)s %(disk_info)s %(initrd_addr)s %(boot_prefix)s/uInitrd" % details
Although after looking at that again if all you are doing is assembling strings you may be better off just making the full string in the first place and skip all the assembly. Just stuff them into a dict using a key:
settings = { "highbank": {("ext2load scsi 0:1 ${ramdisk_addr_r} path/uInitrd", "<kernel cmdline>")}, }
In other words, if the program doesn't need to use those details to actually calculate something, just hard-code the strings.
On Mon, Jul 16, 2012 at 11:24:43AM -0500, Dennis Gilmore wrote:
pyanaconda/platform.py | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/platform.py b/pyanaconda/platform.py index 1611797..05a496f 100644 --- a/pyanaconda/platform.py +++ b/pyanaconda/platform.py @@ -348,6 +348,32 @@ class ARM(Platform): def armMachine(self): return self._armMachine
+class omapARM(ARM):
- _bootloaderClass = bootloader.UBOOTuEnv
- _boot_stage1_format_types = ["vfat"]
- _boot_stage1_device_types = ["partition"]
- _boot_stage1_mountpoints = ["/boot/uboot"]
- _boot_mbr_description = N_("Master Boot Record")
- _boot_descriptions = {"disk": _boot_mbr_description,
"partition": Platform._boot_partition_description}- def setDefaultPartitioning(self):
from storage.partspec import PartSpecret = Platform.setDefaultPartitioning(self)ret.append(PartSpec(mountpoint="/boot/uboot", fstype="vfat", size=20,maxSize=20,grow=True, weight=self.weight(fstype="vfat")))return ret- def weight(self, fstype=None, mountpoint=None):
score = Platform.weight(self, fstype=fstype, mountpoint=mountpoint)if score:return scoreelif fstype == "vfat" and mountpoint == "/boot/uboot":return 6000
This is always going to fail with your current call, mountpoint is None and you didn't pass in /boot/uboot
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
El Mon, 23 Jul 2012 13:37:38 -0700 "Brian C. Lane" bcl@redhat.com escribió:
On Mon, Jul 16, 2012 at 11:24:43AM -0500, Dennis Gilmore wrote:
pyanaconda/platform.py | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/platform.py b/pyanaconda/platform.py index 1611797..05a496f 100644 --- a/pyanaconda/platform.py +++ b/pyanaconda/platform.py @@ -348,6 +348,32 @@ class ARM(Platform): def armMachine(self): return self._armMachine
+class omapARM(ARM):
- _bootloaderClass = bootloader.UBOOTuEnv
- _boot_stage1_format_types = ["vfat"]
- _boot_stage1_device_types = ["partition"]
- _boot_stage1_mountpoints = ["/boot/uboot"]
- _boot_mbr_description = N_("Master Boot Record")
- _boot_descriptions = {"disk": _boot_mbr_description,
"partition":Platform._boot_partition_description} +
- def setDefaultPartitioning(self):
from storage.partspec import PartSpecret = Platform.setDefaultPartitioning(self)ret.append(PartSpec(mountpoint="/boot/uboot",fstype="vfat", size=20,
maxSize=20,grow=True,weight=self.weight(fstype="vfat")))
return ret- def weight(self, fstype=None, mountpoint=None):
score = Platform.weight(self, fstype=fstype,mountpoint=mountpoint)
if score:return scoreelif fstype == "vfat" and mountpoint == "/boot/uboot":return 6000This is always going to fail with your current call, mountpoint is None and you didn't pass in /boot/uboot
ok i based it on whats being done in the EFI class to make sure that /boot/efi is there
OMAP systems need to have a fat partition at the start of the disk to hold the bootloader and config the soc loads the bootloader from it. open to better ways to do it
Dennis
anaconda-patches@lists.fedorahosted.org