From patchwork Fri Jul 27 09:04:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milo Casagrande X-Patchwork-Id: 10302 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 D98182402A for ; Fri, 27 Jul 2012 09:04:14 +0000 (UTC) Received: from mail-gh0-f180.google.com (mail-gh0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id 512D6A18538 for ; Fri, 27 Jul 2012 09:04:14 +0000 (UTC) Received: by ghbz12 with SMTP id z12so2936496ghb.11 for ; Fri, 27 Jul 2012 02:04:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :content-type:mime-version:x-launchpad-project:x-launchpad-branch :x-launchpad-message-rationale:x-launchpad-branch-revision-number :x-launchpad-notification-type:to:from:subject:message-id:date :reply-to:sender:errors-to:precedence:x-generated-by :x-launchpad-hash:x-gm-message-state; bh=uf1CWsEMU16u5KTNZKdE86UKYWtwtkN/P3DkKLrJPJY=; b=JlwLPHfyJUkI1ehhiMCGZ3iWwyPq3C2WKwFImofrL/RkZPcrPw6ZbvfieK2MTqNpkZ NSKxpEj4Gi0UeKj373e95NffXKUA85ymRVhGCHDbywr9cKKmjIE5Hb6hy4BhZb9kuYcL AcXDzjEUOS1SKkP2D4uzKh8rcDYtCdKsRS4HmmFUF4N8veCqmBUV3K5I70DmT6yW+JUN Q3zSeyXP4zi7I9Y9rDbGJe8qmIt1881wSG6EFr5FxElJmM52JBs4mLNqda6qt2wgO26l AEzdwdFxEIhdntdGksDV8t7pRqUMOQY7ChIlfG4QunD9+wpnxqeE/j6v4SUoqzLyBeUo Ka7Q== Received: by 10.50.160.130 with SMTP id xk2mr1161036igb.66.1343379853600; Fri, 27 Jul 2012 02:04:13 -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.43.93.3 with SMTP id bs3csp19733icc; Fri, 27 Jul 2012 02:04:12 -0700 (PDT) Received: by 10.180.75.168 with SMTP id d8mr4328115wiw.8.1343379851447; Fri, 27 Jul 2012 02:04:11 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id c35si2080183wec.84.2012.07.27.02.04.10 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 27 Jul 2012 02:04:11 -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 1SugSw-0007QO-P0 for ; Fri, 27 Jul 2012 09:04:10 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id AFC33E526F for ; Fri, 27 Jul 2012 09:04:10 +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: 543 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-image-tools/linaro-image-tools/trunk] Rev 543: Merged lp:~dooferlad/linaro-image-tools/bootloader-selection. Message-Id: <20120727090410.29335.27907.launchpad@ackee.canonical.com> Date: Fri, 27 Jul 2012 09:04:10 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="15694"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 71f2ddecf2bcbbe9325a5661448dc1c734f9ec79 X-Gm-Message-State: ALoCoQmuR1UOJhu5WYlWbzmlwVOVfn3dv4L5a151Mz1UYiEFDoN1A7h6v0SyiftQd2VQ5giOVVmy Merge authors: James Tunnicliffe (dooferlad) Related merge proposals: https://code.launchpad.net/~dooferlad/linaro-image-tools/bootloader-selection/+merge/116906 proposed by: James Tunnicliffe (dooferlad) review: Approve - Milo Casagrande (milo) ------------------------------------------------------------ revno: 543 [merge] committer: Milo Casagrande branch nick: trunk timestamp: Fri 2012-07-27 11:03:04 +0200 message: Merged lp:~dooferlad/linaro-image-tools/bootloader-selection. modified: linaro_image_tools/hwpack/builder.py linaro_image_tools/hwpack/config.py linaro_image_tools/hwpack/hardwarepack.py linaro_image_tools/hwpack/tests/test_config.py linaro_image_tools/hwpack/tests/test_config_v3.py linaro_image_tools/media_create/android_boards.py linaro_image_tools/media_create/boards.py linaro_image_tools/media_create/tests/test_media_create.py linaro_image_tools/utils.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_image_tools/hwpack/builder.py' --- linaro_image_tools/hwpack/builder.py 2012-07-23 15:36:47 +0000 +++ linaro_image_tools/hwpack/builder.py 2012-07-26 14:46:31 +0000 @@ -199,8 +199,8 @@ self.packages.extend(self.find_bootloader_packages( self.config.boards)) else: - if self.config.u_boot_package is not None: - self.packages.append(self.config.u_boot_package) + if self.config.bootloader_package is not None: + self.packages.append(self.config.bootloader_package) if self.config.spl_package is not None: self.packages.append(self.config.spl_package) local_packages = [ @@ -232,16 +232,17 @@ self._set_new_values(self.config.boards) metadata.boards = self.config.boards else: - u_boot_package = None - if self.config.u_boot_file is not None: - assert self.config.u_boot_package is not None - u_boot_package = self.find_fetched_package( + bootloader_package = None + if self.config.bootloader_file is not None: + assert(self.config.bootloader_package + is not None) + bootloader_package = self.find_fetched_package( self.packages, - self.config.u_boot_package) + self.config.bootloader_package) self.hwpack.metadata.u_boot = \ self.add_file_to_hwpack( - u_boot_package, - self.config.u_boot_file, + bootloader_package, + self.config.bootloader_file, self.hwpack.U_BOOT_DIR) spl_package = None @@ -256,10 +257,11 @@ self.config.spl_file, self.hwpack.SPL_DIR) - # u_boot_package and spl_package can be identical - if (u_boot_package is not None and - u_boot_package in self.packages): - self.packages.remove(u_boot_package) + # bootloader_package and spl_package can be + # identical + if (bootloader_package is not None and + bootloader_package in self.packages): + self.packages.remove(bootloader_package) if (spl_package is not None and spl_package in self.packages): self.packages.remove(spl_package) === modified file 'linaro_image_tools/hwpack/config.py' --- linaro_image_tools/hwpack/config.py 2012-07-25 10:56:58 +0000 +++ linaro_image_tools/hwpack/config.py 2012-07-26 15:15:51 +0000 @@ -103,17 +103,17 @@ translate_v2_metadata[ARCHITECTURES_FIELD] = "ARCHITECTURE" ASSUME_INSTALLED_KEY = "assume-installed" translate_v2_to_v3[ASSUME_INSTALLED_KEY] = ASSUME_INSTALLED_FIELD - U_BOOT_PACKAGE_KEY = "u_boot_package" - translate_v2_to_v3[U_BOOT_PACKAGE_KEY] = PACKAGE_FIELD - U_BOOT_FILE_KEY = "u_boot_file" - translate_v2_to_v3[U_BOOT_FILE_KEY] = FILE_FIELD - translate_v2_metadata[U_BOOT_FILE_KEY] = "U_BOOT" + BOOTLOADER_PACKAGE_KEY = "u_boot_package" + translate_v2_to_v3[BOOTLOADER_PACKAGE_KEY] = PACKAGE_FIELD + BOOTLOADER_FILE_KEY = "u_boot_file" + translate_v2_to_v3[BOOTLOADER_FILE_KEY] = FILE_FIELD + translate_v2_metadata[BOOTLOADER_FILE_KEY] = "U_BOOT" SPL_FILE_KEY = "spl_file" translate_v2_metadata[SPL_FILE_KEY] = "SPL" - UBOOT_IN_BOOT_PART_KEY = 'u_boot_in_boot_part' - translate_v2_to_v3[UBOOT_IN_BOOT_PART_KEY] = IN_BOOT_PART_FIELD - UBOOT_DD_KEY = 'u_boot_dd' - translate_v2_to_v3[UBOOT_DD_KEY] = DD_FIELD + BOOTLOADER_IN_BOOT_PART_KEY = 'u_boot_in_boot_part' + translate_v2_to_v3[BOOTLOADER_IN_BOOT_PART_KEY] = IN_BOOT_PART_FIELD + BOOTLOADER_DD_KEY = 'u_boot_dd' + translate_v2_to_v3[BOOTLOADER_DD_KEY] = DD_FIELD def __init__(self, fp, bootloader=None, board=None): """Create a Config. @@ -193,8 +193,8 @@ self._validate_assume_installed() if self.format.has_v2_fields: - self._validate_u_boot_package() - self._validate_u_boot_file() + self._validate_bootloader_package() + self._validate_bootloader_file() self._validate_serial_tty() self._validate_kernel_addr() self._validate_initrd_addr() @@ -216,7 +216,7 @@ self._validate_extra_boot_options() self._validate_boot_script() self._validate_bootloader_file_in_boot_part() - self._validate_uboot_dd() + self._validate_bootloader_dd() self._validate_spl_in_boot_part() self._validate_spl_dd() self._validate_env_dd() @@ -291,13 +291,13 @@ @property def bootloader_file_in_boot_part(self): """Whether uboot binary should be put in the boot partition. A str.""" - return self._get_bootloader_option(self.UBOOT_IN_BOOT_PART_KEY) + return self._get_bootloader_option(self.BOOTLOADER_IN_BOOT_PART_KEY) @property - def uboot_dd(self): + def bootloader_dd(self): """If the uboot binary should be dd:d to the boot partition this field specifies the offset. An int.""" - return self._get_bootloader_option(self.UBOOT_DD_KEY) + return self._get_bootloader_option(self.BOOTLOADER_DD_KEY) @property def spl_in_boot_part(self): @@ -645,20 +645,20 @@ return self._get_list(PACKAGES_FIELD) @property - def u_boot_package(self): + def bootloader_package(self): """The u-boot package that contains the u-boot bin. A str. """ - return self._get_bootloader_option(self.U_BOOT_PACKAGE_KEY) + return self._get_bootloader_option(self.BOOTLOADER_PACKAGE_KEY) @property - def u_boot_file(self): + def bootloader_file(self): """The u-boot bin file that will be unpacked from the u-boot package. A str. """ - return self._get_bootloader_option(self.U_BOOT_FILE_KEY) + return self._get_bootloader_option(self.BOOTLOADER_FILE_KEY) @property def spl_file(self): @@ -797,11 +797,12 @@ raise HwpackConfigError( "No name in the [%s] section" % self.MAIN_SECTION) - def _validate_u_boot_file(self): - u_boot_file = self.u_boot_file - if u_boot_file is not None: + def _validate_bootloader_file(self): + bootloader_file = self.bootloader_file + if bootloader_file is not None: self._assert_matches_pattern( - self.PATH_REGEX, u_boot_file, "Invalid path: %s" % u_boot_file) + self.PATH_REGEX, bootloader_file, + "Invalid path: %s" % bootloader_file) def _validate_spl_file(self): spl_file = self.spl_file @@ -995,9 +996,13 @@ def _validate_bootloader_file_in_boot_part(self): if not self._validate_bool(self.bootloader_file_in_boot_part): + if self._is_v3: + name = "bootloader" + else: + name = "u_boot" raise HwpackConfigError( - "Invalid value for u_boot_in_boot_part: %s" - % self.bootloader_file_in_boot_part) + "Invalid value for %s_in_boot_part: %s" + % (name, self.bootloader_file_in_boot_part)) def _validate_spl_in_boot_part(self): spl_in_boot_part = self.spl_in_boot_part @@ -1017,15 +1022,20 @@ "Invalid value for env_dd: %s" % self.env_dd) - def _validate_uboot_dd(self): - uboot_dd = self.uboot_dd - if uboot_dd is None: + def _validate_bootloader_dd(self): + bootloader_dd = self.bootloader_dd + if bootloader_dd is None: return try: - assert int(uboot_dd) > 0 + assert int(bootloader_dd) > 0 except: + if self._is_v3: + name = "bootloader" + else: + name = "u_boot" + raise HwpackConfigError( - "Invalid uboot_dd %s" % (uboot_dd)) + "Invalid %s_dd %s" % (name, bootloader_dd)) def _validate_spl_dd(self): spl_dd = self.spl_dd @@ -1062,14 +1072,14 @@ self._invalid_package_message( PACKAGES_FIELD, self.MAIN_SECTION, package)) - def _validate_u_boot_package(self): - u_boot_package = self.u_boot_package - if u_boot_package is not None: + def _validate_bootloader_package(self): + bootloader_package = self.bootloader_package + if bootloader_package is not None: self._assert_matches_pattern( - self.PACKAGE_REGEX, u_boot_package, + self.PACKAGE_REGEX, bootloader_package, self._invalid_package_message( - self.U_BOOT_PACKAGE_KEY, self.MAIN_SECTION, - u_boot_package)) + self.BOOTLOADER_PACKAGE_KEY, self.MAIN_SECTION, + bootloader_package)) def _validate_spl_package(self): spl_package = self.spl_package === modified file 'linaro_image_tools/hwpack/hardwarepack.py' --- linaro_image_tools/hwpack/hardwarepack.py 2012-07-25 10:56:58 +0000 +++ linaro_image_tools/hwpack/hardwarepack.py 2012-07-26 14:52:12 +0000 @@ -226,7 +226,7 @@ snowball_startup_files_config=snowball_startup_config, spl_dd=config.spl_dd, spl_in_boot_part=config.spl_in_boot_part, - uboot_dd=config.uboot_dd, + uboot_dd=config.bootloader_dd, bootloader_file_in_boot_part=config. bootloader_file_in_boot_part, vmlinuz=config.vmlinuz, === modified file 'linaro_image_tools/hwpack/tests/test_config.py' --- linaro_image_tools/hwpack/tests/test_config.py 2012-07-25 10:56:58 +0000 +++ linaro_image_tools/hwpack/tests/test_config.py 2012-07-26 14:16:31 +0000 @@ -458,13 +458,13 @@ config = self.get_config(self.valid_complete_v2 + self.valid_end) config.validate() self.assertEqual("usr/lib/u-boot/smdkv310/u-boot.bin", - config.u_boot_file) + config.bootloader_file) def test_u_boot_package(self): config = self.get_config(self.valid_complete_v2 + self.valid_end) config.validate() self.assertEqual("u-boot-linaro-s5pv310", - config.u_boot_package) + config.bootloader_package) def test_spl_file(self): config = self.get_config(self.valid_complete_v2 + self.valid_end) === modified file 'linaro_image_tools/hwpack/tests/test_config_v3.py' --- linaro_image_tools/hwpack/tests/test_config_v3.py 2012-07-25 10:56:58 +0000 +++ linaro_image_tools/hwpack/tests/test_config_v3.py 2012-07-26 14:46:31 +0000 @@ -190,15 +190,15 @@ " package: ~~\n") self.assertValidationError( "Invalid value in u_boot_package in the metadata: ~~", - config._validate_u_boot_package) + config._validate_bootloader_package) - def test_validate_invalid_u_boot_file(self): + def test_validate_invalid_bootloader_file(self): config = self.get_config(self.valid_start_v3 + "bootloaders:\n" " u_boot:\n" " file: ~~\n") self.assertValidationError("Invalid path: ~~", - config._validate_u_boot_file) + config._validate_bootloader_file) def test_validate_invalid_kernel_file(self): config = self.get_config(self.valid_start_v3 + @@ -272,14 +272,14 @@ def test_validate_wireless_interfaces(self): self.assertTrue("XXX What is an invalid interface name?") - def test_validate_u_boot_in_boot_part_bool(self): + def test_validate_bootloader_in_boot_part_bool(self): config = self.get_config( self.valid_start_v3 + "bootloaders:\n" " u_boot:\n" " in_boot_part: Nope\n") self.assertValidationError( - "Invalid value for u_boot_in_boot_part: Nope", + "Invalid value for bootloader_in_boot_part: Nope", config._validate_bootloader_file_in_boot_part) def test_find_board_specific_variable(self): @@ -444,17 +444,17 @@ self.assertEqual("bootfs_rootfs", config.partition_layout) - def test_u_boot_file(self): + def test_bootloader_file(self): config = self.get_config(self.valid_complete_v3 + self.valid_end) config.validate() self.assertEqual("usr/lib/u-boot/smdkv310/u-boot.bin", - config.u_boot_file) + config.bootloader_file) def test_u_boot_package(self): config = self.get_config(self.valid_complete_v3 + self.valid_end) config.validate() self.assertEqual("u-boot-linaro-s5pv310", - config.u_boot_package) + config.bootloader_package) def test_spl_file(self): config = self.get_config(self.valid_complete_v3 + self.valid_end) === modified file 'linaro_image_tools/media_create/android_boards.py' --- linaro_image_tools/media_create/android_boards.py 2012-07-17 15:33:19 +0000 +++ linaro_image_tools/media_create/android_boards.py 2012-07-26 15:30:34 +0000 @@ -189,7 +189,7 @@ class AndroidPandaConfig(AndroidOmapConfig, PandaConfig): - uboot_flavor = 'omap4_panda' + bootloader_flavor = 'omap4_panda' dtb_addr = '0x815f0000' dtb_name = 'board.dtb' _extra_serial_opts = 'console=ttyO2,115200n8' @@ -298,7 +298,7 @@ class AndroidMx6QSabreliteConfig(AndroidMx53LoCoConfig): - uboot_flavor = 'mx6qsabrelite' + bootloader_flavor = 'mx6qsabrelite' kernel_addr = '0x10000000' initrd_addr = '0x12000000' load_addr = '0x10008000' === modified file 'linaro_image_tools/media_create/boards.py' --- linaro_image_tools/media_create/boards.py 2012-07-25 11:06:29 +0000 +++ linaro_image_tools/media_create/boards.py 2012-07-26 16:20:57 +0000 @@ -214,10 +214,10 @@ """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 + bootloader_flavor = None # whether to copy u-boot to the boot partition bootloader_file_in_boot_part = False - uboot_dd = False + bootloader_dd = False spl_in_boot_part = False spl_dd = False env_dd = False @@ -407,12 +407,13 @@ elif string.lower(env_dd) == 'no': cls.env_dd = False - uboot_dd = cls.get_metadata_field('uboot_dd') - # Either uboot_dd is not specified, or it contains the dd offset. - if uboot_dd is None: - cls.uboot_dd = False + bootloader_dd = cls.get_metadata_field('bootloader_dd') + # Either bootloader_dd is not specified, or it contains the dd + # offset. + if bootloader_dd is None: + cls.bootloader_dd = False else: - cls.uboot_dd = int(uboot_dd) + cls.bootloader_dd = int(bootloader_dd) spl_dd = cls.get_metadata_field('spl_dd') # Either spl_dd is not specified, or it contains the dd offset. if spl_dd is None: @@ -660,11 +661,11 @@ return boot_env @classmethod - def make_boot_files(cls, uboot_parts_dir, is_live, is_lowmem, consoles, - chroot_dir, rootfs_uuid, boot_dir, + def make_boot_files(cls, bootloader_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 + parts_dir = bootloader_parts_dir else: parts_dir = chroot_dir (k_img_data, i_img_data, d_img_data) = cls._get_kflavor_files( @@ -692,12 +693,12 @@ _dd(from_file, to_file, seek=seek) @classmethod - def install_samsung_boot_loader(cls, samsung_spl_file, uboot_file, + def install_samsung_boot_loader(cls, samsung_spl_file, bootloader_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._dd_file(bootloader_file, boot_device_or_file, cls.SAMSUNG_V310_BL2_START, cls.SAMSUNG_V310_BL2_LEN * SECTOR_SIZE) @@ -721,9 +722,10 @@ if cls.spl_dd: cls._dd_file(spl_file, boot_device_or_file, cls.spl_dd) - uboot_file = cls.get_file('u_boot_file') - if cls.uboot_dd: - cls._dd_file(uboot_file, boot_device_or_file, cls.uboot_dd) + bootloader_file = cls.get_file('bootloader_file') + if cls.bootloader_dd: + cls._dd_file(bootloader_file, boot_device_or_file, + cls.bootloader_dd) make_uImage(cls.load_addr, k_img_data, boot_dir) make_uInitrd(i_img_data, boot_dir) @@ -769,33 +771,34 @@ parts_dir = 'boot' if is_live: parts_dir = 'casper' - uboot_parts_dir = os.path.join(chroot_dir, parts_dir) + bootloader_parts_dir = os.path.join(chroot_dir, parts_dir) cmd_runner.run(['mkdir', '-p', boot_disk]).wait() with partition_mounted(boot_partition, boot_disk): if cls.bootloader_file_in_boot_part: with cls.hardwarepack_handler: # - if cls.uboot_flavor is not None: + if cls.bootloader_flavor is not None: default = os.path.join( chroot_dir, 'usr', 'lib', 'u-boot', - cls.uboot_flavor, 'u-boot.img') + cls.bootloader_flavor, 'u-boot.img') if not os.path.exists(default): default = os.path.join( chroot_dir, 'usr', 'lib', 'u-boot', - cls.uboot_flavor, 'u-boot.bin') + cls.bootloader_flavor, 'u-boot.bin') else: default = None # - uboot_bin = cls.get_file('u_boot_file', default=default) - assert uboot_bin is not None, ( - "uboot binary could not be found") + bootloader_bin = cls.get_file('bootloader_file', + default=default) + assert bootloader_bin is not None, ( + "bootloader binary could not be found") proc = cmd_runner.run( - ['cp', '-v', uboot_bin, boot_disk], as_root=True) + ['cp', '-v', bootloader_bin, boot_disk], as_root=True) proc.wait() cls.make_boot_files( - uboot_parts_dir, is_live, is_lowmem, consoles, chroot_dir, + bootloader_parts_dir, is_live, is_lowmem, consoles, chroot_dir, rootfs_uuid, boot_disk, boot_device_or_file) @classmethod @@ -908,8 +911,8 @@ cls.serial_tty = classproperty(lambda cls: 'ttyS2') @classmethod - def make_boot_files(cls, uboot_parts_dir, is_live, is_lowmem, consoles, - chroot_dir, rootfs_uuid, boot_dir, + def make_boot_files(cls, bootloader_parts_dir, is_live, is_lowmem, + consoles, chroot_dir, rootfs_uuid, boot_dir, boot_device_or_file): # XXX: This is also part of our temporary hack to fix bug 697824; we # need to call set_appropriate_serial_tty() before doing anything that @@ -917,7 +920,7 @@ if cls.hwpack_format == HardwarepackHandler.FORMAT_1: cls.set_appropriate_serial_tty(chroot_dir) super(OmapConfig, cls).make_boot_files( - uboot_parts_dir, is_live, is_lowmem, consoles, chroot_dir, + bootloader_parts_dir, is_live, is_lowmem, consoles, chroot_dir, rootfs_uuid, boot_dir, boot_device_or_file) @classmethod @@ -936,7 +939,7 @@ class BeagleConfig(OmapConfig): - uboot_flavor = 'omap3_beagle' + bootloader_flavor = 'omap3_beagle' dtb_name = 'omap3-beagle.dtb' _serial_tty = 'ttyO2' _extra_serial_opts = 'console=tty0 console=%s,115200n8' @@ -952,7 +955,7 @@ class OveroConfig(OmapConfig): - uboot_flavor = 'omap3_overo' + bootloader_flavor = 'omap3_overo' dtb_name = 'omap3-overo.dtb' _serial_tty = 'ttyO2' _extra_serial_opts = 'console=tty0 console=%s,115200n8' @@ -967,7 +970,7 @@ class PandaConfig(OmapConfig): - uboot_flavor = 'omap4_panda' + bootloader_flavor = 'omap4_panda' dtb_name = 'omap4-panda.dtb' _serial_tty = 'ttyO2' _extra_serial_opts = 'console=tty0 console=%s,115200n8' @@ -984,7 +987,7 @@ class IgepConfig(BeagleConfig): bootloader_file_in_boot_part = False - uboot_flavor = None + bootloader_flavor = None dtb_name = 'isee-igep-v2.dtb' @classmethod @@ -1282,10 +1285,11 @@ # XXX: delete this method when hwpacks V1 can die assert cls.hwpack_format == HardwarepackHandler.FORMAT_1 with cls.hardwarepack_handler: - uboot_file = cls.get_file('u_boot_file', default=os.path.join( - chroot_dir, 'usr', 'lib', 'u-boot', cls.uboot_flavor, + bootloader_file = cls.get_file('bootloader_file', + default=os.path.join( + chroot_dir, 'usr', 'lib', 'u-boot', cls.bootloader_flavor, 'u-boot.imx')) - install_mx5_boot_loader(uboot_file, boot_device_or_file, + install_mx5_boot_loader(bootloader_file, boot_device_or_file, cls.LOADER_MIN_SIZE_S) make_uImage(cls.load_addr, k_img_data, boot_dir) make_uInitrd(i_img_data, boot_dir) @@ -1311,27 +1315,27 @@ class EfikamxConfig(Mx51Config): - uboot_flavor = 'efikamx' + bootloader_flavor = 'efikamx' dtb_name = 'genesi-efikamx.dtb' class EfikasbConfig(Mx51Config): - uboot_flavor = 'efikasb' + bootloader_flavor = 'efikasb' dtb_name = 'genesi-efikasb.dtb' class Mx51evkConfig(Mx51Config): - uboot_flavor = 'mx51evk' + bootloader_flavor = 'mx51evk' dtb_name = 'mx51-babbage.dtb' class Mx53LoCoConfig(Mx53Config): - uboot_flavor = 'mx53loco' + bootloader_flavor = 'mx53loco' dtb_name = 'mx53-loco.dtb' class VexpressConfig(BoardConfig): - uboot_flavor = 'ca9x4_ct_vxp' + bootloader_flavor = 'ca9x4_ct_vxp' bootloader_file_in_boot_part = True serial_tty = 'ttyAMA0' _extra_serial_opts = 'console=tty0 console=%s,38400n8' @@ -1429,8 +1433,7 @@ # XXX: delete this method when hwpacks V1 can die assert cls.hwpack_format == HardwarepackHandler.FORMAT_1 cls.install_samsung_boot_loader(cls._get_samsung_spl(chroot_dir), - cls._get_samsung_uboot(chroot_dir), - boot_device_or_file) + cls._get_samsung_bootloader(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) @@ -1448,7 +1451,7 @@ # XXX: delete this method when hwpacks V1 can die assert cls.hwpack_format == HardwarepackHandler.FORMAT_1 spl_dir = os.path.join( - chroot_dir, 'usr', 'lib', 'u-boot', cls.uboot_flavor) + chroot_dir, 'usr', 'lib', 'u-boot', cls.bootloader_flavor) old_spl_path = os.path.join(spl_dir, 'v310_mmc_spl.bin') new_spl_path = os.path.join(spl_dir, 'u-boot-mmc-spl.bin') new_new_spl_path = os.path.join(spl_dir, 'origen-spl.bin') @@ -1469,13 +1472,13 @@ return spl_file @classmethod - def _get_samsung_uboot(cls, chroot_dir): + def _get_samsung_bootloader(cls, chroot_dir): # XXX: delete this method when hwpacks V1 can die assert cls.hwpack_format == HardwarepackHandler.FORMAT_1 - uboot_file = os.path.join( - chroot_dir, 'usr', 'lib', 'u-boot', cls.uboot_flavor, + bootloader_file = os.path.join( + chroot_dir, 'usr', 'lib', 'u-boot', cls.bootloader_flavor, 'u-boot.bin') - return uboot_file + return bootloader_file @classmethod def populate_raw_partition(cls, boot_device_or_file, chroot_dir): @@ -1496,7 +1499,7 @@ class SMDKV310Config(SamsungConfig): - uboot_flavor = 'smdkv310' + bootloader_flavor = 'smdkv310' serial_tty = 'ttySAC1' _extra_serial_opts = 'console=%s,115200n8' kernel_addr = '0x40007000' @@ -1520,7 +1523,7 @@ class OrigenConfig(SamsungConfig): - uboot_flavor = 'origen' + bootloader_flavor = 'origen' serial_tty = 'ttySAC2' _extra_serial_opts = 'console=%s,115200n8' kernel_addr = '0x40007000' === modified file 'linaro_image_tools/media_create/tests/test_media_create.py' --- linaro_image_tools/media_create/tests/test_media_create.py 2012-07-26 09:49:34 +0000 +++ linaro_image_tools/media_create/tests/test_media_create.py 2012-07-26 16:20:57 +0000 @@ -153,7 +153,7 @@ [('FORMAT', format), ('metadata', metadata)]) hp = HardwarepackHandler([tarball], bootloader='u_boot') with hp: - self.assertEquals(hp.get_field('u_boot_file')[0], 'a_file') + self.assertEquals(hp.get_field('bootloader_file')[0], 'a_file') def test_hardwarepack_boards(self): metadata = ("format: 3.0\nname: ahwpack\nversion: 4\narchitecture: " @@ -168,7 +168,7 @@ [('FORMAT', format), ('metadata', metadata)]) hp = HardwarepackHandler([tarball], board='panda') with hp: - self.assertEquals(hp.get_field('u_boot_file')[0], 'panda_file') + self.assertEquals(hp.get_field('bootloader_file')[0], 'panda_file') def test_hardwarepack_boards_and_bootloaders(self): metadata = ("format: 3.0\nname: ahwpack\nversion: 4\narchitecture: " @@ -186,7 +186,7 @@ [('FORMAT', format), ('metadata', metadata)]) hp = HardwarepackHandler([tarball], board='panda', bootloader='uefi') with hp: - self.assertEquals(hp.get_field('u_boot_file')[0], + self.assertEquals(hp.get_field('bootloader_file')[0], 'uefi_panda_file') def add_to_tarball(self, files, tarball=None): @@ -268,7 +268,7 @@ [('metadata', metadata)]) hp = HardwarepackHandler([tarball]) with hp: - test_data, _ = hp.get_field('u_boot_file') + test_data, _ = hp.get_field('bootloader_file') self.assertEqual(test_data, data) def test_preserves_formatters(self): @@ -278,7 +278,7 @@ [('metadata', metadata)]) hp = HardwarepackHandler([tarball]) with hp: - test_data, _ = hp.get_field('u_boot_file') + test_data, _ = hp.get_field('bootloader_file') self.assertEqual(test_data, data) def test_creates_tempdir(self): @@ -306,7 +306,7 @@ (file_in_archive, data)]) hp = HardwarepackHandler([tarball]) with hp: - test_file = hp.get_file('u_boot_file') + test_file = hp.get_file('bootloader_file') self.assertEquals(data, open(test_file, 'r').read()) @@ -597,21 +597,21 @@ def test_old_file_present(self): tempdir = self.useFixture(CreateTempDirFixture()).get_temp_dir() - path = _create_uboot_dir(tempdir, self.config.uboot_flavor) + path = _create_uboot_dir(tempdir, self.config.bootloader_flavor) spl_path = os.path.join(path, 'v310_mmc_spl.bin') open(spl_path, 'w').close() self.assertEquals(spl_path, self.config._get_samsung_spl(tempdir)) def test_new_file_present(self): tempdir = self.useFixture(CreateTempDirFixture()).get_temp_dir() - path = _create_uboot_dir(tempdir, self.config.uboot_flavor) + path = _create_uboot_dir(tempdir, self.config.bootloader_flavor) spl_path = os.path.join(path, 'u-boot-mmc-spl.bin') open(spl_path, 'w').close() self.assertEquals(spl_path, self.config._get_samsung_spl(tempdir)) def test_prefers_old_path(self): tempdir = self.useFixture(CreateTempDirFixture()).get_temp_dir() - path = _create_uboot_dir(tempdir, self.config.uboot_flavor) + path = _create_uboot_dir(tempdir, self.config.bootloader_flavor) old_spl_path = os.path.join(path, 'v310_mmc_spl.bin') new_spl_path = os.path.join(path, 'u-boot-mmc-spl.bin') open(old_spl_path, 'w').close() @@ -625,9 +625,9 @@ def test_uses_uboot_flavour(self): chroot_dir = "chroot" uboot_file = os.path.join(chroot_dir, 'usr', 'lib', 'u-boot', - self.config.uboot_flavor, 'u-boot.bin') + self.config.bootloader_flavor, 'u-boot.bin') self.assertEquals( - uboot_file, self.config._get_samsung_uboot(chroot_dir)) + uboot_file, self.config._get_samsung_bootloader(chroot_dir)) class TestGetOrigenSPL(TestCaseWithFixtures): @@ -640,7 +640,7 @@ def test_new_file_present(self): tempdir = self.useFixture(CreateTempDirFixture()).get_temp_dir() - path = _create_uboot_dir(tempdir, self.config.uboot_flavor) + path = _create_uboot_dir(tempdir, self.config.bootloader_flavor) spl_path = os.path.join(path, 'u-boot-mmc-spl.bin') open(spl_path, 'w').close() self.assertEquals(spl_path, self.config._get_samsung_spl(tempdir)) @@ -1060,7 +1060,7 @@ def test_mx5_steps(self): class SomeMx5Config(boards.Mx5Config): - uboot_flavor = 'uboot_flavor' + bootloader_flavor = 'bootloader_flavor' SomeMx5Config.hardwarepack_handler = ( TestSetMetadata.MockHardwarepackHandler('ahwpack.tar.gz')) SomeMx5Config.hardwarepack_handler.get_format = ( @@ -2050,32 +2050,32 @@ def test_install_smdk_u_boot(self): fixture = self._mock_Popen() - uboot_flavor = boards.SMDKV310Config.uboot_flavor + bootloader_flavor = boards.SMDKV310Config.bootloader_flavor self.useFixture(MockSomethingFixture(os.path, 'getsize', lambda file: 1)) boards.SMDKV310Config.install_samsung_boot_loader( - "%s/%s/SPL" % ("chroot_dir", uboot_flavor), - "%s/%s/uboot" % ("chroot_dir", uboot_flavor), "boot_disk") + "%s/%s/SPL" % ("chroot_dir", bootloader_flavor), + "%s/%s/uboot" % ("chroot_dir", bootloader_flavor), "boot_disk") expected = [ '%s dd if=chroot_dir/%s/SPL of=boot_disk bs=512 conv=notrunc ' - 'seek=%d' % (sudo_args, uboot_flavor, + 'seek=%d' % (sudo_args, bootloader_flavor, boards.SMDKV310Config.SAMSUNG_V310_BL1_START), '%s dd if=chroot_dir/%s/uboot of=boot_disk bs=512 conv=notrunc ' - 'seek=%d' % (sudo_args, uboot_flavor, + 'seek=%d' % (sudo_args, bootloader_flavor, boards.SMDKV310Config.SAMSUNG_V310_BL2_START)] self.assertEqual(expected, fixture.mock.commands_executed) def test_install_origen_u_boot(self): fixture = self._mock_Popen() - uboot_flavor = boards.OrigenConfig.uboot_flavor + bootloader_flavor = boards.OrigenConfig.bootloader_flavor self.useFixture(MockSomethingFixture( boards.OrigenConfig, '_get_samsung_spl', classmethod(lambda cls, chroot_dir: "%s/%s/SPL" % ( - chroot_dir, uboot_flavor)))) + chroot_dir, bootloader_flavor)))) self.useFixture(MockSomethingFixture( - boards.OrigenConfig, '_get_samsung_uboot', + boards.OrigenConfig, '_get_samsung_bootloader', classmethod(lambda cls, chroot_dir: "%s/%s/uboot" % ( - chroot_dir, uboot_flavor)))) + chroot_dir, bootloader_flavor)))) boards.OrigenConfig.hardwarepack_handler = ( TestSetMetadata.MockHardwarepackHandler('ahwpack.tar.gz')) boards.OrigenConfig.hardwarepack_handler.get_format = ( @@ -2084,13 +2084,14 @@ lambda file: 1)) boards.OrigenConfig.install_samsung_boot_loader( boards.OrigenConfig._get_samsung_spl("chroot_dir"), - boards.OrigenConfig._get_samsung_uboot("chroot_dir"), "boot_disk") + boards.OrigenConfig._get_samsung_bootloader("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, + 'seek=%d' % (sudo_args, bootloader_flavor, boards.OrigenConfig.SAMSUNG_V310_BL1_START), '%s dd if=chroot_dir/%s/uboot of=boot_disk bs=512 conv=notrunc ' - 'seek=%d' % (sudo_args, uboot_flavor, + 'seek=%d' % (sudo_args, bootloader_flavor, boards.OrigenConfig.SAMSUNG_V310_BL2_START)] self.assertEqual(expected, fixture.mock.commands_executed) @@ -2919,9 +2920,9 @@ self.expected_calls, self.popen_fixture.mock.commands_executed) self.assertEquals(self.expected_args, self.saved_args) - def test_populate_boot_uboot_flavor(self): + def test_populate_boot_bootloader_flavor(self): self.prepare_config(boards.BoardConfig) - self.config.uboot_flavor = "uboot_flavor" + self.config.bootloader_flavor = "bootloader_flavor" self.call_populate_boot(self.config) self.assertEquals( self.expected_calls, self.popen_fixture.mock.commands_executed) @@ -2929,12 +2930,12 @@ def test_populate_boot_bootloader_file_in_boot_part(self): self.prepare_config(boards.BoardConfig) - self.config.uboot_flavor = "uboot_flavor" + self.config.bootloader_flavor = "bootloader_flavor" self.config.bootloader_file_in_boot_part = True self.call_populate_boot(self.config) expected_calls = self.expected_calls[:] expected_calls.insert(2, - '%s cp -v chroot_dir/usr/lib/u-boot/uboot_flavor/u-boot.bin ' + '%s cp -v chroot_dir/usr/lib/u-boot/bootloader_flavor/u-boot.bin ' 'boot_disk' % sudo_args) self.assertEquals( expected_calls, self.popen_fixture.mock.commands_executed) @@ -2942,7 +2943,7 @@ def test_populate_boot_bootloader_file_in_boot_part_false(self): self.prepare_config(boards.BoardConfig) - self.config.uboot_flavor = "uboot_flavor" + self.config.bootloader_flavor = "bootloader_flavor" self.config.bootloader_file_in_boot_part = False self.call_populate_boot(self.config) expected_calls = self.expected_calls[:] @@ -2950,7 +2951,7 @@ expected_calls, self.popen_fixture.mock.commands_executed) self.assertEquals(self.expected_args, self.saved_args) - def test_populate_boot_no_uboot_flavor(self): + def test_populate_boot_no_bootloader_flavor(self): self.prepare_config(boards.BoardConfig) self.config.bootloader_file_in_boot_part = True self.assertRaises( === modified file 'linaro_image_tools/utils.py' --- linaro_image_tools/utils.py 2012-07-25 11:39:20 +0000 +++ linaro_image_tools/utils.py 2012-07-26 19:49:43 +0000 @@ -344,7 +344,7 @@ def check_required_args(args): """Check that the required args are passed.""" - if args.board is None: + if args.dev is None: raise MissingRequiredOption("--dev option is required") if args.binary is None: raise MissingRequiredOption("--binary option is required")