From patchwork Mon Sep 19 09:13:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mattias Backman X-Patchwork-Id: 4178 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 6A58723EF5 for ; Mon, 19 Sep 2011 09:13:16 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id 4F607A1811A for ; Mon, 19 Sep 2011 09:13:16 +0000 (UTC) Received: by fxe23 with SMTP id 23so5234749fxe.11 for ; Mon, 19 Sep 2011 02:13:16 -0700 (PDT) Received: by 10.223.5.76 with SMTP id 12mr4764644fau.103.1316423596046; Mon, 19 Sep 2011 02:13:16 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.18.198 with SMTP id y6cs29131lad; Mon, 19 Sep 2011 02:13:15 -0700 (PDT) Received: by 10.216.221.203 with SMTP id r53mr2307969wep.96.1316423595087; Mon, 19 Sep 2011 02:13:15 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id c53si40897wed.58.2011.09.19.02.13.14 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 19 Sep 2011 02:13:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1R5Zuc-0007ml-HF for ; Mon, 19 Sep 2011 09:13:14 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 77450E157B for ; Mon, 19 Sep 2011 09:13:14 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: linaro-image-tools X-Launchpad-Branch: ~linaro-image-tools/linaro-image-tools/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 432 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-image-tools/linaro-image-tools/trunk] Rev 432: Pull in board specific _make_boot_files() code to a single function. Message-Id: <20110919091314.6223.66702.launchpad@ackee.canonical.com> Date: Mon, 19 Sep 2011 09:13:14 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="13980"; Instance="initZopeless config overlay" X-Launchpad-Hash: f9e3b9e37552dfc7aaf31d09f08520da2ba60c3d Merge authors: Mattias Backman (mabac) Related merge proposals: https://code.launchpad.net/~mabac/linaro-image-tools/make-boot-files-v2/+merge/75169 proposed by: Mattias Backman (mabac) ------------------------------------------------------------ revno: 432 [merge] committer: Mattias Backman branch nick: linaro-image-tools timestamp: Mon 2011-09-19 11:11:53 +0200 message: Pull in board specific _make_boot_files() code to a single function. modified: linaro-media-create linaro_image_tools/hwpack/config.py linaro_image_tools/hwpack/hardwarepack.py linaro_image_tools/media_create/boards.py linaro_image_tools/media_create/tests/test_media_create.py --- lp:linaro-image-tools https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk You are subscribed to branch lp:linaro-image-tools. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk/+edit-subscription === modified file 'linaro-media-create' --- linaro-media-create 2011-07-21 17:41:19 +0000 +++ linaro-media-create 2011-09-15 11:45:23 +0000 @@ -22,6 +22,7 @@ import os import sys import tempfile +import logging from linaro_image_tools import cmd_runner @@ -95,6 +96,14 @@ parser = get_args_parser() args = parser.parse_args() + ch = logging.StreamHandler() + ch.setLevel(logging.INFO) + formatter = logging.Formatter("%(message)s") + ch.setFormatter(formatter) + logger = logging.getLogger("linaro_image_tools") + logger.setLevel(logging.INFO) + logger.addHandler(ch) + # If --help was specified this won't execute. # Create temp dir and initialize rest of path vars. TMP_DIR = tempfile.mkdtemp() === modified file 'linaro_image_tools/hwpack/config.py' --- linaro_image_tools/hwpack/config.py 2011-08-30 08:52:00 +0000 +++ linaro_image_tools/hwpack/config.py 2011-09-15 08:41:03 +0000 @@ -44,7 +44,7 @@ PACKAGES_KEY = "packages" PACKAGE_REGEX = NAME_REGEX PATH_REGEX = r"\w[\w+\-./_]+$" - GLOB_REGEX = r"\w[\w+\-./_\*]+$" + GLOB_REGEX = r"[\w+\-./_\*]+$" ORIGIN_KEY = "origin" MAINTAINER_KEY = "maintainer" ARCHITECTURES_KEY = "architectures" @@ -74,6 +74,7 @@ EXTRA_BOOT_OPTIONS_KEY = 'extra_boot_options' BOOT_SCRIPT_KEY = 'boot_script' UBOOT_IN_BOOT_PART_KEY = 'u_boot_in_boot_part' + UBOOT_DD_KEY = 'u_boot_dd' EXTRA_SERIAL_OPTS_KEY = 'extra_serial_options' SNOWBALL_STARTUP_FILES_CONFIG_KEY = 'snowball_startup_files_config' SAMSUNG_BL1_START_KEY = 'samsung_bl1_start' @@ -136,6 +137,7 @@ self._validate_extra_boot_options() self._validate_boot_script() self._validate_uboot_in_boot_part() + self._validate_uboot_dd() self._validate_extra_serial_opts() self._validate_snowball_startup_files_config() self._validate_samsung_bl1_start() @@ -187,6 +189,11 @@ """Whether uboot binary should be put in the boot partition. A str.""" return self.parser.get(self.MAIN_SECTION, self.UBOOT_IN_BOOT_PART_KEY) + @property + def uboot_dd(self): + """Whether uboot binary should be dd:d to the boot partition. A str.""" + return self._get_option_from_main_section(self.UBOOT_DD_KEY) + def _get_option_from_main_section(self, key): """Get the value from the main section for the given key. @@ -719,6 +726,13 @@ "Invalid value for u_boot_in_boot_part: %s" % self.parser.get("hwpack", "u_boot_in_boot_part")) + def _validate_uboot_dd(self): + uboot_dd = self.uboot_dd + if uboot_dd is not None and string.lower(uboot_dd) not in ['yes', 'no']: + raise HwpackConfigError( + "Invalid value for u_boot_dd: %s" + % self.parser.get("hwpack", "u_boot_dd")) + def _validate_support(self): support = self.support if support not in (None, "supported", "unsupported"): === modified file 'linaro_image_tools/hwpack/hardwarepack.py' --- linaro_image_tools/hwpack/hardwarepack.py 2011-08-30 08:52:00 +0000 +++ linaro_image_tools/hwpack/hardwarepack.py 2011-09-13 12:57:13 +0000 @@ -84,6 +84,7 @@ loader_min_size=None, vmlinuz=None, initrd=None, dtb_addr=None, extra_boot_options=None, boot_script=None, uboot_in_boot_part=None, + uboot_dd=None, extra_serial_opts=None, loader_start=None, snowball_startup_files_config=None, samsung_bl1_start=None, samsung_bl1_len=None, @@ -114,6 +115,7 @@ self.extra_boot_options = extra_boot_options self.boot_script = boot_script self.uboot_in_boot_part = uboot_in_boot_part + self.uboot_dd = uboot_dd self.extra_serial_opts = extra_serial_opts self.snowball_startup_files_config = snowball_startup_files_config self.samsung_bl1_start = samsung_bl1_start @@ -164,6 +166,7 @@ extra_boot_options=config.extra_boot_options, boot_script=config.boot_script, uboot_in_boot_part=config.uboot_in_boot_part, + uboot_dd=config.uboot_dd, extra_serial_opts=config.extra_serial_opts, snowball_startup_files_config=config.snowball_startup_files_config, samsung_bl1_start=config.samsung_bl1_start, @@ -232,6 +235,8 @@ metadata += "BOOT_SCRIPT=%s\n" % self.boot_script if self.uboot_in_boot_part is not None: metadata += "U_BOOT_IN_BOOT_PART=%s\n" % self.uboot_in_boot_part + if self.uboot_dd is not None: + metadata += "U_BOOT_DD=%s\n" % self.uboot_dd if self.extra_serial_opts is not None: metadata += "EXTRA_SERIAL_OPTIONS=%s\n" % self.extra_serial_opts if self.snowball_startup_files_config is not None: === modified file 'linaro_image_tools/media_create/boards.py' --- linaro_image_tools/media_create/boards.py 2011-09-12 10:58:04 +0000 +++ linaro_image_tools/media_create/boards.py 2011-09-15 11:18:09 +0000 @@ -35,6 +35,7 @@ import ConfigParser import shutil import string +import logging from linaro_image_tools import cmd_runner @@ -69,6 +70,7 @@ """Round value to the next multiple of align.""" return (value + align - 1) / align * align + def align_partition(min_start, min_length, start_alignment, end_alignment): """Compute partition start and end offsets based on specified constraints. @@ -108,7 +110,7 @@ def __init__(self, hwpacks): self.hwpacks = hwpacks self.hwpack_tarfiles = [] - + class FakeSecHead(object): """ Add a fake section header to the metadata file. @@ -147,15 +149,17 @@ hwpack_with_data = None for hwpack_tarfile in self.hwpack_tarfiles: metadata = hwpack_tarfile.extractfile(self.metadata_filename) - # Use RawConfigParser which does not support the magical interpolation - # behavior of ConfigParser so we don't mess up metadata accidentally. + # Use RawConfigParser which does not support the magical + # interpolation behavior of ConfigParser so we don't mess up + # metadata accidentally. parser = ConfigParser.RawConfigParser() parser.readfp(self.FakeSecHead(metadata)) try: new_data = parser.get(section, field) if new_data is not None: assert data is None, "The metadata field '%s' is set to " \ - "'%s' and new value '%s' is found" % (field, data, new_data) + "'%s' and new value '%s' is found" % (field, data, + new_data) data = new_data hwpack_with_data = hwpack_tarfile except ConfigParser.NoOptionError: @@ -170,8 +174,7 @@ format_string = format_file.read().strip() if not format_string in supported_formats: raise AssertionError( - "Format version '%s' is not supported." % \ - format_string) + "Format version '%s' is not supported." % format_string) if format is None: format = format_string elif format != format_string: @@ -189,10 +192,12 @@ class BoardConfig(object): """The configuration used when building an image for a board.""" + hwpack_format = None # These attributes may not need to be redefined on some subclasses. uboot_flavor = None # whether to copy u-boot to the boot partition uboot_in_boot_part = False + uboot_dd = False mmc_option = '0:1' mmc_part_offset = 0 fat_size = 32 @@ -200,9 +205,9 @@ _live_serial_opts = '' extra_boot_args_options = None supports_writing_to_mmc = True - LOADER_MIN_SIZE_S = align_up(1 * 1024**2, SECTOR_SIZE) / SECTOR_SIZE - BOOT_MIN_SIZE_S = align_up(50 * 1024**2, SECTOR_SIZE) / SECTOR_SIZE - ROOT_MIN_SIZE_S = align_up(50 * 1024**2, SECTOR_SIZE) / SECTOR_SIZE + LOADER_MIN_SIZE_S = align_up(1 * 1024 ** 2, SECTOR_SIZE) / SECTOR_SIZE + BOOT_MIN_SIZE_S = align_up(50 * 1024 ** 2, SECTOR_SIZE) / SECTOR_SIZE + ROOT_MIN_SIZE_S = align_up(50 * 1024 ** 2, SECTOR_SIZE) / SECTOR_SIZE # These attributes must be defined on all subclasses for backwards # compatibility with hwpacks v1 format. Hwpacks v2 format allows these to @@ -269,12 +274,11 @@ def set_metadata(cls, hwpacks): cls.hardwarepack_handler = HardwarepackHandler(hwpacks) with cls.hardwarepack_handler: - if (cls.hardwarepack_handler.get_format() == - cls.hardwarepack_handler.FORMAT_1): + cls.hwpack_format = cls.hardwarepack_handler.get_format() + if (cls.hwpack_format == cls.hardwarepack_handler.FORMAT_1): return - if (cls.hardwarepack_handler.get_format() == - cls.hardwarepack_handler.FORMAT_2): + if (cls.hwpack_format == cls.hardwarepack_handler.FORMAT_2): # Clear V1 defaults. cls.kernel_addr = None cls.initrd_addr = None @@ -325,25 +329,33 @@ boot_min_size = cls.get_metadata_field('boot_min_size') if boot_min_size is not None: - cls.BOOT_MIN_SIZE_S = align_up(int(boot_min_size) * 1024**2, + cls.BOOT_MIN_SIZE_S = align_up(int(boot_min_size) * 1024 ** 2, SECTOR_SIZE) / SECTOR_SIZE root_min_size = cls.get_metadata_field('root_min_size') if root_min_size is not None: - cls.ROOT_MIN_SIZE_S = align_up(int(root_min_size) * 1024**2, + cls.ROOT_MIN_SIZE_S = align_up(int(root_min_size) * 1024 ** 2, SECTOR_SIZE) / SECTOR_SIZE loader_min_size = cls.get_metadata_field('loader_min_size') if loader_min_size is not None: - cls.LOADER_MIN_SIZE_S = align_up(int(loader_min_size) * 1024**2, + cls.LOADER_MIN_SIZE_S = align_up(int(loader_min_size) * 1024 ** 2, SECTOR_SIZE) / SECTOR_SIZE uboot_in_boot_part = cls.get_metadata_field('u_boot_in_boot_part') if uboot_in_boot_part is None: - cls.uboot_in_boot_part = None + cls.uboot_in_boot_part = None elif string.lower(uboot_in_boot_part) == 'yes': cls.uboot_in_boot_part = True elif string.lower(uboot_in_boot_part) == 'no': cls.uboot_in_boot_part = False + uboot_dd = cls.get_metadata_field('u_boot_dd') + if uboot_dd is None: + cls.uboot_dd = None + elif string.lower(uboot_dd) == 'yes': + cls.uboot_dd = True + elif string.lower(uboot_dd) == 'no': + cls.uboot_dd = False + loader_start = cls.get_metadata_field('loader_start') if loader_start is not None: cls.LOADER_START_S = int(loader_start) @@ -492,6 +504,8 @@ elif cls.partition_layout in ['reserved_bootfs_rootfs']: return cls.get_reserved_sfdisk_cmd(should_align_boot_part) else: + assert (cls.hwpack_format == HardwarepackHandler.FORMAT_1), ( + "Hwpack format is not 1.0 but partition_layout is unspecified.") return cls.get_v1_sfdisk_cmd(should_align_boot_part) @classmethod @@ -565,13 +579,84 @@ @classmethod def make_boot_files(cls, uboot_parts_dir, is_live, is_lowmem, consoles, chroot_dir, rootfs_uuid, boot_dir, boot_device_or_file): + if cls.hwpack_format == HardwarepackHandler.FORMAT_1: + parts_dir = uboot_parts_dir + else: + parts_dir = chroot_dir (k_img_data, i_img_data, d_img_data) = cls._get_kflavor_files( - uboot_parts_dir) + parts_dir) boot_env = cls._get_boot_env(is_live, is_lowmem, consoles, rootfs_uuid, d_img_data) - cls._make_boot_files( - boot_env, chroot_dir, boot_dir, - boot_device_or_file, k_img_data, i_img_data, d_img_data) + + if cls.hwpack_format == HardwarepackHandler.FORMAT_1: + cls._make_boot_files( + boot_env, chroot_dir, boot_dir, + boot_device_or_file, k_img_data, i_img_data, d_img_data) + else: + cls._make_boot_files_v2( + boot_env, chroot_dir, boot_dir, + boot_device_or_file, k_img_data, i_img_data, d_img_data) + + @classmethod + def _dd_file(cls, from_file, to_file, seek, max_size=None): + assert from_file is not None, "No source file name given." + if max_size is not None: + assert os.path.getsize(from_file) <= max_size, ( + "'%s' is larger than %s" % (from_file, max_size)) + logger = logging.getLogger("linaro_image_tools") + logger.info("Writing '%s' to '%s' at %s." % (from_file, to_file, seek)) + _dd(from_file, to_file, seek=seek) + + + @classmethod + def install_samsung_boot_loader(cls, samsung_spl_file, uboot_file, + boot_device_or_file): + cls._dd_file(samsung_spl_file, boot_device_or_file, + cls.SAMSUNG_V310_BL1_START, + cls.SAMSUNG_V310_BL1_LEN * SECTOR_SIZE) + cls._dd_file(uboot_file, boot_device_or_file, + cls.SAMSUNG_V310_BL2_START, + cls.SAMSUNG_V310_BL2_LEN * SECTOR_SIZE) + + + @classmethod + def _make_boot_files_v2(cls, boot_env, chroot_dir, boot_dir, + boot_device_or_file, k_img_data, i_img_data, + d_img_data): + with cls.hardwarepack_handler: + x_loader_file = cls.get_file('x_loader') + if x_loader_file is not None: + logger = logging.getLogger("linaro_image_tools") + logger.info( + "Copying x-loader '%s' to boot partition." % x_loader_file) + cmd_runner.run(["cp", "-v", x_loader_file, boot_dir], + as_root=True).wait() + # XXX: Is this really needed? + cmd_runner.run(["sync"]).wait() + + uboot_file = cls.get_file('u_boot') + if cls.uboot_dd: + cls._dd_file(uboot_file, boot_device_or_file, 2) + + samsung_spl_file = cls.get_file('spl') + if samsung_spl_file is not None: + cls.install_samsung_boot_loader(samsung_spl_file, uboot_file, + boot_device_or_file) + make_uImage(cls.load_addr, k_img_data, boot_dir) + make_uInitrd(i_img_data, boot_dir) + + if d_img_data is not None: + make_dtb(d_img_data, boot_dir) + + if cls.boot_script is not None: + boot_script_path = os.path.join(boot_dir, cls.boot_script) + make_boot_script(boot_env, boot_script_path) + + # Only used for Omap and Igep, will this be bad for the other boards? + make_boot_ini(boot_script_path, boot_dir) + + if cls.snowball_startup_files_config is not None: + cls.populate_raw_partition(chroot_dir, boot_device_or_file) @classmethod def _make_boot_files(cls, boot_env, chroot_dir, boot_dir, @@ -629,10 +714,10 @@ return cls._get_kflavor_files_v2(path) for flavor in cls.kernel_flavors: - kregex = KERNEL_GLOB % {'kernel_flavor' : flavor} - iregex = INITRD_GLOB % {'kernel_flavor' : flavor} - dregex = DTB_GLOB % {'kernel_flavor' : flavor, - 'dtb_name' : cls.dtb_name} + kregex = KERNEL_GLOB % {'kernel_flavor': flavor} + iregex = INITRD_GLOB % {'kernel_flavor': flavor} + dregex = DTB_GLOB % {'kernel_flavor': flavor, + 'dtb_name': cls.dtb_name} kernel = _get_file_matching(os.path.join(path, kregex)) if kernel is not None: initrd = _get_file_matching(os.path.join(path, iregex)) @@ -657,7 +742,9 @@ dtb = None if cls.dtb_file is not None: dtb = _get_file_matching(os.path.join(path, cls.dtb_file)) - print "Will use kernel=%s, initrd=%s, dtb=%s." % (kernel, initrd, dtb) + logger = logging.getLogger("linaro_image_tools") + logger.info( "Will use kernel=%s, initrd=%s, dtb=%s." % \ + (kernel, initrd, dtb)) return (kernel, initrd, dtb) raise ValueError( "Found kernel matching %s but no initrd matching %s" % ( @@ -1136,6 +1223,7 @@ make_uImage(cls.load_addr, k_img_data, boot_dir) make_uInitrd(i_img_data, boot_dir) + class SamsungConfig(BoardConfig): @classproperty def extra_serial_opts(cls): @@ -1170,7 +1258,9 @@ def _make_boot_files(cls, boot_env, chroot_dir, boot_dir, boot_device_or_file, k_img_data, i_img_data, d_img_data): - cls.install_samsung_boot_loader(chroot_dir, boot_device_or_file) + cls.install_samsung_boot_loader(cls._get_samsung_spl(chroot_dir), + cls._get_samsung_uboot(chroot_dir), + boot_device_or_file) env_size = cls.SAMSUNG_V310_ENV_LEN * SECTOR_SIZE env_file = make_flashable_env(boot_env, env_size) _dd(env_file, boot_device_or_file, seek=cls.SAMSUNG_V310_ENV_START) @@ -1229,26 +1319,6 @@ _dd(uboot_file, boot_device_or_file, seek=cls.SAMSUNG_V310_BL2_START) - @classmethod - def install_samsung_boot_loader(cls, chroot_dir, boot_device_or_file): - with cls.hardwarepack_handler: - try: - default = cls._get_samsung_spl(chroot_dir) - except AssertionError: - default = None - spl_file = cls.get_file('spl', default=default) - bl1_max_size = cls.SAMSUNG_V310_BL1_LEN * SECTOR_SIZE - assert os.path.getsize(spl_file) <= bl1_max_size, ( - "%s is larger than %s" % (spl_file, bl1_max_size)) - _dd(spl_file, boot_device_or_file, seek=cls.SAMSUNG_V310_BL1_START) - uboot_file = cls.get_file( - 'u_boot', default=cls._get_samsung_uboot(chroot_dir)) - bl2_max_size = cls.SAMSUNG_V310_BL2_LEN * SECTOR_SIZE - assert os.path.getsize(uboot_file) <= bl2_max_size, ( - "%s is larger than %s" % (uboot_file, bl2_max_size)) - _dd(uboot_file, boot_device_or_file, seek=cls.SAMSUNG_V310_BL2_START) - - class SMDKV310Config(SamsungConfig): uboot_flavor = 'smdkv310' serial_tty = 'ttySAC1' === modified file 'linaro_image_tools/media_create/tests/test_media_create.py' --- linaro_image_tools/media_create/tests/test_media_create.py 2011-08-30 08:52:00 +0000 +++ linaro_image_tools/media_create/tests/test_media_create.py 2011-09-15 11:18:09 +0000 @@ -876,6 +876,7 @@ super(TestBootSteps, self).setUp() self.funcs_calls = [] self.mock_all_boards_funcs() + linaro_image_tools.media_create.boards.BoardConfig.hwpack_format = '1.0' def mock_all_boards_funcs(self): """Mock functions of boards module with a call tracer.""" @@ -938,6 +939,8 @@ linaro_image_tools.media_create.boards.SMDKV310Config, 'install_samsung_boot_loader', mock_func_creator('install_samsung_boot_loader'))) + self.useFixture(MockSomethingFixture(os.path, 'exists', + lambda file: True)) boards.SMDKV310Config.hardwarepack_handler = ( TestSetMetadata.MockHardwarepackHandler('ahwpack.tar.gz')) boards.SMDKV310Config.hardwarepack_handler.get_format = ( @@ -957,6 +960,8 @@ linaro_image_tools.media_create.boards.OrigenConfig, 'install_samsung_boot_loader', mock_func_creator('install_samsung_boot_loader'))) + self.useFixture(MockSomethingFixture(os.path, 'exists', + lambda file: True)) boards.OrigenConfig.hardwarepack_handler = ( TestSetMetadata.MockHardwarepackHandler('ahwpack.tar.gz')) boards.OrigenConfig.hardwarepack_handler.get_format = ( @@ -1529,22 +1534,11 @@ def test_install_smdk_u_boot(self): fixture = self._mock_Popen() uboot_flavor = boards.SMDKV310Config.uboot_flavor - self.useFixture(MockSomethingFixture( - boards.SMDKV310Config, '_get_samsung_spl', - classmethod(lambda cls, chroot_dir: "%s/%s/SPL" % ( - chroot_dir, uboot_flavor)))) - self.useFixture(MockSomethingFixture( - boards.SMDKV310Config, '_get_samsung_uboot', - classmethod(lambda cls, chroot_dir: "%s/%s/uboot" % ( - chroot_dir, uboot_flavor)))) - boards.SMDKV310Config.hardwarepack_handler = ( - TestSetMetadata.MockHardwarepackHandler('ahwpack.tar.gz')) - boards.SMDKV310Config.hardwarepack_handler.get_format = ( - lambda: '1.0') self.useFixture(MockSomethingFixture(os.path, 'getsize', lambda file: 1)) boards.SMDKV310Config.install_samsung_boot_loader( - "chroot_dir", "boot_disk") + "%s/%s/SPL" % ("chroot_dir", uboot_flavor), + "%s/%s/uboot" % ("chroot_dir", uboot_flavor), "boot_disk") expected = [ '%s dd if=chroot_dir/%s/SPL of=boot_disk bs=512 conv=notrunc ' 'seek=%d' % (sudo_args, uboot_flavor, boards.SMDKV310Config.SAMSUNG_V310_BL1_START), @@ -1570,7 +1564,8 @@ self.useFixture(MockSomethingFixture(os.path, 'getsize', lambda file: 1)) boards.OrigenConfig.install_samsung_boot_loader( - "chroot_dir", "boot_disk") + boards.OrigenConfig._get_samsung_spl("chroot_dir"), + boards.OrigenConfig._get_samsung_uboot("chroot_dir"), "boot_disk") expected = [ '%s dd if=chroot_dir/%s/SPL of=boot_disk bs=512 conv=notrunc ' 'seek=%d' % (sudo_args, uboot_flavor, boards.OrigenConfig.SAMSUNG_V310_BL1_START), @@ -1727,6 +1722,7 @@ # Stub time.sleep() as create_partitions() use that. self.orig_sleep = time.sleep time.sleep = lambda s: None + linaro_image_tools.media_create.boards.BoardConfig.hwpack_format = '1.0' def tearDown(self): super(TestCreatePartitions, self).tearDown()