aboutsummaryrefslogtreecommitdiff
path: root/linaro_media_create
diff options
context:
space:
mode:
authorGuilherme Salgado <salgado@canonical.com>2011-01-12 15:54:55 -0600
committerGuilherme Salgado <salgado@canonical.com>2011-01-12 15:54:55 -0600
commit12fce6f67ad235582b5e7443098b4bea3abf5571 (patch)
treed4269b7efe5641ac4fd29939c7f3c913e6b1daf9 /linaro_media_create
parent760245fa2be0ab5d30d5a7e60e7dfa385bb18a8f (diff)
Use classes for board config
Diffstat (limited to 'linaro_media_create')
-rw-r--r--linaro_media_create/__init__.py125
-rw-r--r--linaro_media_create/boards.py148
-rw-r--r--linaro_media_create/boot_cmd.py0
-rw-r--r--linaro_media_create/populate_boot.py12
-rw-r--r--linaro_media_create/tests/test_media_create.py295
5 files changed, 203 insertions, 377 deletions
diff --git a/linaro_media_create/__init__.py b/linaro_media_create/__init__.py
index e22e9f8..6e900f3 100644
--- a/linaro_media_create/__init__.py
+++ b/linaro_media_create/__init__.py
@@ -1,8 +1,9 @@
import argparse
-import uuid
-ROOTFS_UUID = str(uuid.uuid4())
-KNOWN_BOARDS = ['beagle', 'igep', 'mx51evk', 'panda', 'ux500', 'vexpress']
+from linaro_media_create.boards import board_configs
+
+
+KNOWN_BOARDS = board_configs.keys()
class Live256MegsAction(argparse.Action):
@@ -87,121 +88,3 @@ def get_args_parser():
'--no-part', dest='should_create_partitions', action='store_false',
help='Reuse existing partitions on the given media.')
return parser
-
-
-def get_board_config(board, is_live, is_lowmem, consoles):
- """Return a dict containing the configs to create an image for a board.
-
- :param args: An argparse.ArgumentParser object containing the arguments
- passed to linaro-media-create.
- """
- mmc_part_offset = 0
- mmc_option = '0:1'
- boot_args_options = 'rootwait ro'
- uboot_flavor = None
- fat_size = 32
- serial_opts = ''
- if consoles is not None:
- for console in consoles:
- serial_opts += ' console=%s' % console
-
- # XXX: I think this is not needed as we have board-specific
- # serial options for when is_live is true.
- if is_live:
- serial_opts += ' serialtty=ttyS2'
-
- if board in ('beagle', 'igep'):
- if board == 'beagle':
- uboot_flavor = 'omap3_beagle'
- serial_opts += ' console=tty0 console=ttyS2,115200n8'
- live_serial_opts = 'serialtty=ttyS2'
- kernel_addr = '0x80000000'
- initrd_addr = '0x81600000'
- load_addr = '0x80008000'
- sub_arch = 'linaro-omap'
- boot_script = 'boot.scr'
- boot_args_options += (
- ' earlyprintk fixrtc nocompcache vram=12M omapfb.debug=y'
- ' omapfb.mode=dvi:1280x720MR-16@60')
-
- elif board == 'panda':
- uboot_flavor = 'omap4_panda'
- serial_opts += ' console = tty0 console = ttyO2,115200n8'
- live_serial_opts = 'serialtty = ttyO2'
- kernel_addr = '0x80200000'
- initrd_addr = '0x81600000'
- load_addr = '0x80008000'
- sub_arch = 'omap4'
- boot_script = 'boot.scr'
- boot_args_options += (
- ' earlyprintk fixrtc nocompcache vram = 32M omapfb.debug = y'
- ' omapfb.vram = 0:8M mem = 463M ip = none')
-
- elif board == 'ux500':
- serial_opts += ' console = tty0 console = ttyAMA2,115200n8'
- live_serial_opts = 'serialtty = ttyAMA2'
- kernel_addr = '0x00100000'
- initrd_addr = '0x08000000'
- load_addr = '0x00008000'
- sub_arch = 'ux500'
- boot_script = 'flash.scr'
- boot_args_options += (
- ' earlyprintk rootdelay = 1 fixrtc nocompcache'
- ' mem = 96M@0 mem_modem = 32M@96M mem = 44M@128M pmem = 22M@172M'
- ' mem = 30M@194M mem_mali = 32M@224M pmem_hwb = 54M@256M'
- ' hwmem = 48M@302M mem = 152M@360M')
- mmc_option = '1:1'
-
- elif board == 'mx51evk':
- serial_opts += ' console = tty0 console = ttymxc0,115200n8'
- live_serial_opts = 'serialtty = ttymxc0'
- kernel_addr = '0x90000000'
- initrd_addr = '0x90800000'
- load_addr = '0x90008000'
- sub_arch = 'linaro-mx51'
- boot_script = 'boot.scr'
- mmc_part_offset = 1
- mmc_option = '0:2'
-
- elif board == 'vexpress':
- uboot_flavor = 'ca9x4_ct_vxp'
- serial_opts += ' console = tty0 console = ttyAMA0,38400n8'
- live_serial_opts = 'serialtty = ttyAMA0'
- kernel_addr = '0x60008000'
- initrd_addr = '0x81000000'
- load_addr = kernel_addr
- sub_arch = 'linaro-vexpress'
- boot_script = None
- # ARM Boot Monitor is used to load u-boot, uImage etc. into flash and
- # only allows for FAT16
- fat_size = 16
-
- else:
- raise ValueError("Unkown board: %s" % board)
-
- lowmem_opt = ''
- boot_snippet = 'root=UUID=%s' % ROOTFS_UUID
- if is_live:
- serial_opts += ' %s' % live_serial_opts
- boot_snippet = 'boot=casper'
- if is_lowmem:
- lowmem_opt = 'only-ubiquity'
-
- boot_cmd = (
- "setenv bootcmd 'fatload mmc %(mmc_option)s %(kernel_addr)s "
- "uImage; fatload mmc %(mmc_option)s %(initrd_addr)s uInitrd; "
- "bootm %(kernel_addr)s %(initrd_addr)s'\n"
- "setenv bootargs '%(serial_opts)s %(lowmem_opt)s "
- "%(boot_snippet)s %(boot_args_options)s'\n"
- "boot" % vars())
-
- # Instead of constructing a dict here, we could create a separate class
- # for the config of every board, with the varying bits stored as class
- # variables. At this point I don't see much advantage in doing that,
- # though.
- return dict(
- kernel_addr=kernel_addr, initrd_addr=initrd_addr, load_addr=load_addr,
- sub_arch=sub_arch, boot_script=boot_script, fat_size=fat_size,
- boot_args_options=boot_args_options, serial_opts=serial_opts,
- uboot_flavor=uboot_flavor, mmc_part_offset=mmc_part_offset,
- mmc_option=mmc_option, boot_cmd=boot_cmd)
diff --git a/linaro_media_create/boards.py b/linaro_media_create/boards.py
new file mode 100644
index 0000000..4ca4fad
--- /dev/null
+++ b/linaro_media_create/boards.py
@@ -0,0 +1,148 @@
+"""Configuration for boards supported by linaro-media-create.
+
+To add support for a new board, you just need to create a subclass of
+BoardConfig and set appropriate values for its variables.
+"""
+
+import uuid
+
+ROOTFS_UUID = str(uuid.uuid4())
+
+
+class BoardConfig(object):
+ """The configuration used when building an image for a board."""
+ uboot_flavor = None
+ mmc_option = '0:1'
+ mmc_part_offset = 0
+ extra_serial_opts = None
+ live_serial_opts = None
+ kernel_addr = None
+ initrd_addr = None
+ load_addr = None
+ sub_arch = None
+ boot_script = None
+ extra_boot_args_options = None
+ fat_size = 32
+
+ @classmethod
+ def get_boot_cmd(cls, is_live, is_lowmem, consoles):
+ """Get the boot command for this board."""
+ boot_args_options = 'rootwait ro'
+ if cls.extra_boot_args_options:
+ boot_args_options += " %s" % cls.extra_boot_args_options
+ serial_opts = ''
+ if consoles is not None:
+ for console in consoles:
+ serial_opts += ' console=%s' % console
+
+ # XXX: I think this is not needed as we have board-specific
+ # serial options for when is_live is true.
+ if is_live:
+ serial_opts += ' serialtty=ttyS2'
+
+ serial_opts += ' %s' % cls.extra_serial_opts
+
+ lowmem_opt = ''
+ boot_snippet = 'root=UUID=%s' % ROOTFS_UUID
+ if is_live:
+ serial_opts += ' %s' % cls.live_serial_opts
+ boot_snippet = 'boot=casper'
+ if is_lowmem:
+ lowmem_opt = 'only-ubiquity'
+
+ replacements = dict(
+ mmc_option=cls.mmc_option, kernel_addr=cls.kernel_addr,
+ initrd_addr=cls.initrd_addr, serial_opts=serial_opts,
+ lowmem_opt=lowmem_opt, boot_snippet=boot_snippet,
+ boot_args_options=boot_args_options)
+ return (
+ "setenv bootcmd 'fatload mmc %(mmc_option)s %(kernel_addr)s "
+ "uImage; fatload mmc %(mmc_option)s %(initrd_addr)s uInitrd; "
+ "bootm %(kernel_addr)s %(initrd_addr)s'\n"
+ "setenv bootargs '%(serial_opts)s %(lowmem_opt)s "
+ "%(boot_snippet)s %(boot_args_options)s'\n"
+ "boot" % replacements)
+
+
+class BeagleConfig(BoardConfig):
+ uboot_flavor = 'omap3_beagle'
+ extra_serial_opts = 'console=tty0 console=ttyS2,115200n8'
+ live_serial_opts = 'serialtty=ttyS2'
+ kernel_addr = '0x80000000'
+ initrd_addr = '0x81600000'
+ load_addr = '0x80008000'
+ sub_arch = 'linaro-omap'
+ boot_script = 'boot.scr'
+ extra_boot_args_options = (
+ 'earlyprintk fixrtc nocompcache vram=12M omapfb.debug=y '
+ 'omapfb.mode=dvi:1280x720MR-16@60')
+
+
+class PandaConfig(BoardConfig):
+ uboot_flavor = 'omap4_panda'
+ extra_serial_opts = 'console = tty0 console = ttyO2,115200n8'
+ live_serial_opts = 'serialtty = ttyO2'
+ kernel_addr = '0x80200000'
+ initrd_addr = '0x81600000'
+ load_addr = '0x80008000'
+ sub_arch = 'omap4'
+ boot_script = 'boot.scr'
+ extra_boot_args_options = (
+ 'earlyprintk fixrtc nocompcache vram = 32M omapfb.debug = y '
+ 'omapfb.vram = 0:8M mem = 463M ip = none')
+
+
+class IgepConfig(BeagleConfig):
+ uboot_flavor = None
+
+
+class Ux500Config(BoardConfig):
+ extra_serial_opts = 'console = tty0 console = ttyAMA2,115200n8'
+ live_serial_opts = 'serialtty = ttyAMA2'
+ kernel_addr = '0x00100000'
+ initrd_addr = '0x08000000'
+ load_addr = '0x00008000'
+ sub_arch = 'ux500'
+ boot_script = 'flash.scr'
+ extra_boot_args_options = (
+ 'earlyprintk rootdelay = 1 fixrtc nocompcache '
+ 'mem = 96M@0 mem_modem = 32M@96M mem = 44M@128M pmem = 22M@172M '
+ 'mem = 30M@194M mem_mali = 32M@224M pmem_hwb = 54M@256M '
+ 'hwmem = 48M@302M mem = 152M@360M')
+ mmc_option = '1:1'
+
+
+class Mx51evkConfig(BoardConfig):
+ extra_serial_opts = 'console = tty0 console = ttymxc0,115200n8'
+ live_serial_opts = 'serialtty = ttymxc0'
+ kernel_addr = '0x90000000'
+ initrd_addr = '0x90800000'
+ load_addr = '0x90008000'
+ sub_arch = 'linaro-mx51'
+ boot_script = 'boot.scr'
+ mmc_part_offset = 1
+ mmc_option = '0:2'
+
+
+class VexpressConfig(BoardConfig):
+ uboot_flavor = 'ca9x4_ct_vxp'
+ extra_serial_opts = 'console = tty0 console = ttyAMA0,38400n8'
+ live_serial_opts = 'serialtty = ttyAMA0'
+ kernel_addr = '0x60008000'
+ initrd_addr = '0x81000000'
+ load_addr = kernel_addr
+ sub_arch = 'linaro-vexpress'
+ boot_script = None
+ # ARM Boot Monitor is used to load u-boot, uImage etc. into flash and
+ # only allows for FAT16
+ fat_size = 16
+
+
+board_configs = {
+ 'beagle': BeagleConfig,
+ 'igep': IgepConfig,
+ 'panda': PandaConfig,
+ 'vexpress': VexpressConfig,
+ 'ux500': Ux500Config,
+ 'mx51evk': Mx51evkConfig,
+ }
diff --git a/linaro_media_create/boot_cmd.py b/linaro_media_create/boot_cmd.py
deleted file mode 100644
index e69de29..0000000
--- a/linaro_media_create/boot_cmd.py
+++ /dev/null
diff --git a/linaro_media_create/populate_boot.py b/linaro_media_create/populate_boot.py
index 8aef8cc..f3a1589 100644
--- a/linaro_media_create/populate_boot.py
+++ b/linaro_media_create/populate_boot.py
@@ -88,7 +88,7 @@ def make_boot_ini(boot_script, boot_disk):
def populate_boot(board, board_config, chroot_dir, boot_partition, boot_disk,
- boot_device_or_file, tmp_dir, is_live):
+ boot_device_or_file, tmp_dir, is_live, is_lowmem, consoles):
parts_dir = 'boot'
if is_live:
@@ -104,7 +104,7 @@ def populate_boot(board, board_config, chroot_dir, boot_partition, boot_disk,
raise
cmd_runner.run(['mount', boot_partition, boot_disk], as_root=True).wait()
- uboot_flavor = board_config.get('uboot_flavor')
+ uboot_flavor = board_config.uboot_flavor
if uboot_flavor is not None:
uboot_bin = os.path.join(
chroot_dir, 'usr', 'lib', 'u-boot', uboot_flavor, 'u-boot.bin')
@@ -113,11 +113,11 @@ def populate_boot(board, board_config, chroot_dir, boot_partition, boot_disk,
boot_script = "%(boot_disk)s/%(boot_script_name)s" % (
dict(boot_disk=boot_disk,
- boot_script_name=board_config['boot_script']))
+ boot_script_name=board_config.boot_script))
- load_addr = board_config['load_addr']
- sub_arch = board_config['sub_arch']
- boot_cmd = board_config['boot_cmd']
+ load_addr = board_config.load_addr
+ sub_arch = board_config.sub_arch
+ boot_cmd = board_config.get_boot_cmd(is_live, is_lowmem, consoles)
# TODO: Once linaro-media-create is fully ported to python, we should
# split this into several board-specific functions that are defined
diff --git a/linaro_media_create/tests/test_media_create.py b/linaro_media_create/tests/test_media_create.py
index f02f80b..c6c4668 100644
--- a/linaro_media_create/tests/test_media_create.py
+++ b/linaro_media_create/tests/test_media_create.py
@@ -9,7 +9,6 @@ import sys
import time
from testtools import TestCase
-from testtools.matchers import Mismatch
from hwpack.testing import TestCaseWithFixtures
@@ -17,10 +16,12 @@ from linaro_media_create import (
check_device,
cmd_runner,
ensure_command,
- get_board_config,
populate_boot,
partitions,
rootfs,
+ )
+from linaro_media_create.boards import (
+ board_configs,
ROOTFS_UUID,
)
from linaro_media_create.hwpack import (
@@ -92,110 +93,32 @@ class TestEnsureCommand(TestCase):
ensure_command.apt_get_install = orig_func
-class IsEqualToDict(object):
- """A testtools matcher to compare dicts.
-
- When there are differences, only the differing keys/values are shown.
- """
-
- def __init__(self, expected):
- self.expected = expected
-
- def match(self, actual):
- actual_keys = set(actual.keys())
- expected_keys = set(self.expected.keys())
- instersection = actual_keys.intersection(expected_keys)
- expected_only_keys = expected_keys.difference(actual_keys)
- actual_only_keys = actual_keys.difference(expected_keys)
- keys_with_differing_values = []
- for key in instersection:
- if actual[key] != self.expected[key]:
- keys_with_differing_values.append(key)
-
- if (len(expected_only_keys) == 0 and len(actual_only_keys) == 0
- and len(keys_with_differing_values) == 0):
- return None
-
- expected_diffs = []
- for key in keys_with_differing_values + list(expected_only_keys):
- expected_diffs.append("%s: %r" % (key, self.expected[key]))
- expected_diffs = "\n".join(expected_diffs)
-
- actual_diffs = []
- for key in keys_with_differing_values + list(actual_only_keys):
- actual_diffs.append("%s: %r" % (key, actual[key]))
- actual_diffs = "\n".join(actual_diffs)
-
- mismatch_string = "\na = %s\n" % expected_diffs
- mismatch_string += "=" * 60 + "\n"
- mismatch_string += "b = %s" % actual_diffs
- return IsEqualToDictMismatch(self.expected, mismatch_string, actual)
-
-
-class IsEqualToDictMismatch(Mismatch):
-
- def __init__(self, expected, mismatch_string, other):
- self.expected = expected
- self._mismatch_string = mismatch_string
- self.other = other
-
- def describe(self):
- return self._mismatch_string
+class TestGetBootCmd(TestCase):
+ def test_vexpress(self):
+ boot_cmd = board_configs['vexpress'].get_boot_cmd(
+ is_live=False, is_lowmem=False, consoles=None)
+ expected = (
+ "setenv bootcmd 'fatload mmc 0:1 0x60008000 uImage; fatload mmc "
+ "0:1 0x81000000 uInitrd; bootm 0x60008000 0x81000000'\nsetenv "
+ "bootargs ' console = tty0 console = ttyAMA0,38400n8 "
+ "root=UUID=%s rootwait ro'\nboot" % ROOTFS_UUID)
+ self.assertEqual(expected, boot_cmd)
-class TestGetBoardConfig(TestCase):
+ def test_mx51evk(self):
+ boot_cmd = board_configs['mx51evk'].get_boot_cmd(
+ is_live=False, is_lowmem=False, consoles=None)
+ expected = (
+ "setenv bootcmd 'fatload mmc 0:2 0x90000000 uImage; fatload mmc "
+ "0:2 0x90800000 uInitrd; bootm 0x90000000 0x90800000'\nsetenv "
+ "bootargs ' console = tty0 console = ttymxc0,115200n8 "
+ "root=UUID=%s rootwait ro'\nboot" % ROOTFS_UUID)
+ self.assertEqual(expected, boot_cmd)
- expected_beagle_config = {
- 'boot_cmd': (
- "setenv bootcmd 'fatload mmc 0:1 0x80000000 uImage; "
- "fatload mmc 0:1 0x81600000 uInitrd; bootm 0x80000000 "
- "0x81600000'\nsetenv bootargs ' console=tty0 "
- "console=ttyS2,115200n8 root=UUID=%s rootwait ro earlyprintk "
- "fixrtc nocompcache vram=12M omapfb.debug=y "
- "omapfb.mode=dvi:1280x720MR-16@60'\nboot" % ROOTFS_UUID),
- 'boot_args_options': (
- 'rootwait ro earlyprintk fixrtc nocompcache vram=12M '
- 'omapfb.debug=y omapfb.mode=dvi:1280x720MR-16@60'),
- 'boot_script': 'boot.scr',
- 'fat_size': 32,
- 'initrd_addr': '0x81600000',
- 'kernel_addr': '0x80000000',
- 'load_addr': '0x80008000',
- 'mmc_option': '0:1',
- 'mmc_part_offset': 0,
- 'serial_opts': ' console=tty0 console=ttyS2,115200n8',
- 'sub_arch': 'linaro-omap',
- 'uboot_flavor': 'omap3_beagle'}
-
- expected_panda_config = {
- 'boot_cmd': (
- "setenv bootcmd 'fatload mmc 0:1 0x80200000 uImage; fatload mmc "
- "0:1 0x81600000 uInitrd; bootm 0x80200000 0x81600000'\nsetenv "
- "bootargs ' console = tty0 console = ttyO2,115200n8 "
- "root=UUID=%s rootwait ro earlyprintk fixrtc nocompcache "
- "vram = 32M omapfb.debug = y omapfb.vram = 0:8M mem = 463M "
- "ip = none'\nboot" % ROOTFS_UUID),
- 'boot_args_options': (
- 'rootwait ro earlyprintk fixrtc nocompcache vram = 32M '
- 'omapfb.debug = y omapfb.vram = 0:8M mem = 463M ip = none'),
- 'boot_script': 'boot.scr',
- 'fat_size': 32,
- 'initrd_addr': '0x81600000',
- 'kernel_addr': '0x80200000',
- 'load_addr': '0x80008000',
- 'mmc_option': '0:1',
- 'mmc_part_offset': 0,
- 'serial_opts': ' console = tty0 console = ttyO2,115200n8',
- 'sub_arch': 'omap4',
- 'uboot_flavor': 'omap4_panda'}
-
- expected_ux500_config = {
- 'boot_args_options': (
- 'rootwait ro earlyprintk rootdelay = 1 fixrtc nocompcache '
- 'mem = 96M@0 mem_modem = 32M@96M mem = 44M@128M pmem = 22M@172M '
- 'mem = 30M@194M mem_mali = 32M@224M pmem_hwb = 54M@256M '
- 'hwmem = 48M@302M mem = 152M@360M'),
- 'boot_cmd': (
+ def test_ux500(self):
+ boot_cmd = board_configs['ux500'].get_boot_cmd(
+ is_live=False, is_lowmem=False, consoles=None)
+ expected = (
"setenv bootcmd 'fatload mmc 1:1 0x00100000 uImage; fatload mmc "
"1:1 0x08000000 uInitrd; bootm 0x00100000 0x08000000'\nsetenv "
"bootargs ' console = tty0 console = ttyAMA2,115200n8 "
@@ -203,160 +126,32 @@ class TestGetBoardConfig(TestCase):
"nocompcache mem = 96M@0 mem_modem = 32M@96M mem = 44M@128M "
"pmem = 22M@172M mem = 30M@194M mem_mali = 32M@224M "
"pmem_hwb = 54M@256M hwmem = 48M@302M mem = 152M@360M'\nboot"
- % ROOTFS_UUID),
- 'boot_script': 'flash.scr',
- 'fat_size': 32,
- 'initrd_addr': '0x08000000',
- 'kernel_addr': '0x00100000',
- 'load_addr': '0x00008000',
- 'mmc_option': '1:1',
- 'mmc_part_offset': 0,
- 'serial_opts': ' console = tty0 console = ttyAMA2,115200n8',
- 'sub_arch': 'ux500',
- 'uboot_flavor': None}
-
- expected_vexpress_config = {
- 'boot_args_options': 'rootwait ro',
- 'boot_cmd': (
- "setenv bootcmd 'fatload mmc 0:1 0x60008000 uImage; fatload mmc "
- "0:1 0x81000000 uInitrd; bootm 0x60008000 0x81000000'\nsetenv "
- "bootargs ' console = tty0 console = ttyAMA0,38400n8 "
- "root=UUID=%s rootwait ro'\nboot" % ROOTFS_UUID),
- 'boot_script': None,
- 'fat_size': 16,
- 'initrd_addr': '0x81000000',
- 'kernel_addr': '0x60008000',
- 'load_addr': '0x60008000',
- 'mmc_option': '0:1',
- 'mmc_part_offset': 0,
- 'serial_opts': ' console = tty0 console = ttyAMA0,38400n8',
- 'sub_arch': 'linaro-vexpress',
- 'uboot_flavor': 'ca9x4_ct_vxp'}
-
- expected_mx51evk_config = {
- 'boot_args_options': 'rootwait ro',
- 'boot_cmd': (
- "setenv bootcmd 'fatload mmc 0:2 0x90000000 uImage; fatload mmc "
- "0:2 0x90800000 uInitrd; bootm 0x90000000 0x90800000'\nsetenv "
- "bootargs ' console = tty0 console = ttymxc0,115200n8 "
- "root=UUID=%s rootwait ro'\nboot" % ROOTFS_UUID),
- 'boot_script': 'boot.scr',
- 'fat_size': 32,
- 'initrd_addr': '0x90800000',
- 'kernel_addr': '0x90000000',
- 'load_addr': '0x90008000',
- 'mmc_option': '0:2',
- 'mmc_part_offset': 1,
- 'serial_opts': ' console = tty0 console = ttymxc0,115200n8',
- 'sub_arch': 'linaro-mx51',
- 'uboot_flavor': None}
-
- def test_unknown_board(self):
- self.assertRaises(
- ValueError, get_board_config, 'foobar', is_live=True,
- is_lowmem=False, consoles=None)
-
- def test_vexpress_live(self):
- config = get_board_config(
- 'vexpress', is_live=True, is_lowmem=False, consoles=None)
- expected = self.expected_vexpress_config.copy()
- expected['boot_cmd'] = (
- "setenv bootcmd 'fatload mmc 0:1 0x60008000 uImage; fatload mmc "
- "0:1 0x81000000 uInitrd; bootm 0x60008000 0x81000000'\nsetenv "
- "bootargs ' console = tty0 console = ttyAMA0,38400n8 "
- "serialtty = ttyAMA0 boot=casper rootwait ro'\nboot")
- expected['serial_opts'] = (
- ' console = tty0 console = ttyAMA0,38400n8 serialtty = ttyAMA0')
- self.assertThat(expected, IsEqualToDict(config))
-
- def test_vexpress(self):
- config = get_board_config(
- 'vexpress', is_live=False, is_lowmem=False, consoles=None)
- self.assertThat(self.expected_vexpress_config, IsEqualToDict(config))
-
- def test_mx51evk_live(self):
- config = get_board_config(
- 'mx51evk', is_live=True, is_lowmem=False, consoles=None)
- expected = self.expected_mx51evk_config.copy()
- expected['boot_cmd'] = (
- "setenv bootcmd 'fatload mmc 0:2 0x90000000 uImage; "
- "fatload mmc 0:2 0x90800000 uInitrd; bootm 0x90000000 "
- "0x90800000'\nsetenv bootargs ' console = tty0 "
- "console = ttymxc0,115200n8 serialtty = ttymxc0 boot=casper "
- "rootwait ro'\nboot")
- expected['serial_opts'] = (
- ' console = tty0 console = ttymxc0,115200n8 serialtty = ttymxc0')
- self.assertThat(expected, IsEqualToDict(config))
-
- def test_mx51evk(self):
- config = get_board_config(
- 'mx51evk', is_live=False, is_lowmem=False, consoles=None)
- self.assertThat(self.expected_mx51evk_config, IsEqualToDict(config))
-
- def test_ux500_live(self):
- config = get_board_config(
- 'ux500', is_live=True, is_lowmem=False, consoles=None)
- boot_cmd = (
- "setenv bootcmd 'fatload mmc 1:1 0x00100000 uImage; fatload "
- "mmc 1:1 0x08000000 uInitrd; bootm 0x00100000 0x08000000'\n"
- "setenv bootargs ' console = tty0 console = ttyAMA2,115200n8 "
- "serialtty = ttyAMA2 boot=casper rootwait ro earlyprintk "
- "rootdelay = 1 fixrtc nocompcache mem = 96M@0 "
- "mem_modem = 32M@96M mem = 44M@128M pmem = 22M@172M "
- "mem = 30M@194M mem_mali = 32M@224M pmem_hwb = 54M@256M "
- "hwmem = 48M@302M mem = 152M@360M'\nboot")
- expected = self.expected_ux500_config.copy()
- expected['boot_cmd'] = boot_cmd
- expected['serial_opts'] = (
- ' console = tty0 console = ttyAMA2,115200n8 serialtty = ttyAMA2')
- self.assertThat(expected, IsEqualToDict(config))
-
- def test_ux500(self):
- config = get_board_config(
- 'ux500', is_live=False, is_lowmem=False, consoles=None)
- self.assertThat(self.expected_ux500_config, IsEqualToDict(config))
+ % ROOTFS_UUID)
+ self.assertEqual(expected, boot_cmd)
def test_panda(self):
- config = get_board_config(
- 'panda', is_live=False, is_lowmem=False, consoles=None)
- self.assertThat(self.expected_panda_config, IsEqualToDict(config))
-
- def test_panda_live(self):
- config = get_board_config(
- 'panda', is_live=True, is_lowmem=False, consoles=None)
- boot_cmd = (
- "setenv bootcmd 'fatload mmc 0:1 0x80200000 uImage; "
- "fatload mmc 0:1 0x81600000 uInitrd; bootm 0x80200000 "
- "0x81600000'\nsetenv bootargs ' console = tty0 "
- "console = ttyO2,115200n8 serialtty = ttyO2 boot=casper "
- "rootwait ro earlyprintk fixrtc nocompcache vram = 32M "
- "omapfb.debug = y omapfb.vram = 0:8M mem = 463M ip = none'\nboot")
- expected = self.expected_panda_config.copy()
- expected['boot_cmd'] = boot_cmd
- expected['serial_opts'] = (
- ' console = tty0 console = ttyO2,115200n8 serialtty = ttyO2')
- self.assertThat(expected, IsEqualToDict(config))
+ boot_cmd = board_configs['panda'].get_boot_cmd(
+ is_live=False, is_lowmem=False, consoles=None)
+ expected = (
+ "setenv bootcmd 'fatload mmc 0:1 0x80200000 uImage; fatload mmc "
+ "0:1 0x81600000 uInitrd; bootm 0x80200000 0x81600000'\nsetenv "
+ "bootargs ' console = tty0 console = ttyO2,115200n8 "
+ "root=UUID=%s rootwait ro earlyprintk fixrtc nocompcache "
+ "vram = 32M omapfb.debug = y omapfb.vram = 0:8M mem = 463M "
+ "ip = none'\nboot" % ROOTFS_UUID)
+ self.assertEqual(expected, boot_cmd)
def test_beagle(self):
- config = get_board_config(
- 'beagle', is_live=False, is_lowmem=False, consoles=None)
- self.assertThat(self.expected_beagle_config, IsEqualToDict(config))
-
- def test_beagle_live(self):
- config = get_board_config(
- 'beagle', is_live=True, is_lowmem=False, consoles=None)
- boot_cmd = (
+ boot_cmd = board_configs['beagle'].get_boot_cmd(
+ is_live=False, is_lowmem=False, consoles=None)
+ expected = (
"setenv bootcmd 'fatload mmc 0:1 0x80000000 uImage; "
"fatload mmc 0:1 0x81600000 uInitrd; bootm 0x80000000 "
"0x81600000'\nsetenv bootargs ' console=tty0 "
- "console=ttyS2,115200n8 serialtty=ttyS2 boot=casper rootwait ro "
- "earlyprintk fixrtc nocompcache vram=12M omapfb.debug=y "
- "omapfb.mode=dvi:1280x720MR-16@60'\nboot")
- expected = self.expected_beagle_config.copy()
- expected['boot_cmd'] = boot_cmd
- expected['serial_opts'] = (
- ' console=tty0 console=ttyS2,115200n8 serialtty=ttyS2')
- self.assertThat(expected, IsEqualToDict(config))
+ "console=ttyS2,115200n8 root=UUID=%s rootwait ro earlyprintk "
+ "fixrtc nocompcache vram=12M omapfb.debug=y "
+ "omapfb.mode=dvi:1280x720MR-16@60'\nboot" % ROOTFS_UUID)
+ self.assertEqual(expected, boot_cmd)
class TestRemoveBinaryDir(TestCaseWithFixtures):