diff options
author | James Tunnicliffe <james.tunnicliffe@linaro.org> | 2012-07-25 11:56:58 +0100 |
---|---|---|
committer | James Tunnicliffe <james.tunnicliffe@linaro.org> | 2012-07-25 11:56:58 +0100 |
commit | 69012f93cce99ecb11d0a7b7e6d0be7259786572 (patch) | |
tree | 68a4399602804279709b9623c25d9ed262141ef4 | |
parent | 14ced21e75fcf556b4c926add1e9e98d8c9ff107 (diff) |
renamed u_boot_in_boot_part to bootloader_file_in_boot_part.
-rwxr-xr-x | linaro-media-create | 2 | ||||
-rw-r--r-- | linaro_image_tools/hwpack/config.py | 10 | ||||
-rw-r--r-- | linaro_image_tools/hwpack/hardwarepack.py | 13 | ||||
-rw-r--r-- | linaro_image_tools/hwpack/tests/test_config.py | 2 | ||||
-rw-r--r-- | linaro_image_tools/hwpack/tests/test_config_v3.py | 12 | ||||
-rw-r--r-- | linaro_image_tools/media_create/__init__.py | 4 | ||||
-rw-r--r-- | linaro_image_tools/media_create/boards.py | 28 | ||||
-rw-r--r-- | linaro_image_tools/media_create/tests/test_media_create.py | 19 |
8 files changed, 56 insertions, 34 deletions
diff --git a/linaro-media-create b/linaro-media-create index 2440e78..1f60305 100755 --- a/linaro-media-create +++ b/linaro-media-create @@ -187,7 +187,7 @@ if __name__ == '__main__': if args.should_format_bootfs: board_config.populate_boot( ROOTFS_DIR, rootfs_uuid, boot_partition, BOOT_DISK, media.path, - args.is_live, args.is_lowmem, args.consoles) + args.is_live, args.is_lowmem, args.consoles, args.bootloader) if args.should_format_rootfs: create_swap = False diff --git a/linaro_image_tools/hwpack/config.py b/linaro_image_tools/hwpack/config.py index a73f9f3..14bad55 100644 --- a/linaro_image_tools/hwpack/config.py +++ b/linaro_image_tools/hwpack/config.py @@ -215,7 +215,7 @@ class Config(object): self._validate_mmc_id() self._validate_extra_boot_options() self._validate_boot_script() - self._validate_uboot_in_boot_part() + self._validate_bootloader_file_in_boot_part() self._validate_uboot_dd() self._validate_spl_in_boot_part() self._validate_spl_dd() @@ -289,7 +289,7 @@ class Config(object): return self._get_option(BOARDS_FIELD) @property - def uboot_in_boot_part(self): + 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) @@ -993,11 +993,11 @@ class Config(object): return False return string.lower(value) in ['yes', 'no'] - def _validate_uboot_in_boot_part(self): - if not self._validate_bool(self.uboot_in_boot_part): + def _validate_bootloader_file_in_boot_part(self): + if not self._validate_bool(self.bootloader_file_in_boot_part): raise HwpackConfigError( "Invalid value for u_boot_in_boot_part: %s" - % self.uboot_in_boot_part) + % self.bootloader_file_in_boot_part) def _validate_spl_in_boot_part(self): spl_in_boot_part = self.spl_in_boot_part diff --git a/linaro_image_tools/hwpack/hardwarepack.py b/linaro_image_tools/hwpack/hardwarepack.py index f24d9da..c202dbf 100644 --- a/linaro_image_tools/hwpack/hardwarepack.py +++ b/linaro_image_tools/hwpack/hardwarepack.py @@ -122,7 +122,8 @@ class Metadata(object): partition_layout=None, mmc_id=None, boot_min_size=None, root_min_size=None, loader_min_size=None, vmlinuz=None, initrd=None, dtb_addr=None, extra_boot_options=None, - env_dd=None, boot_script=None, uboot_in_boot_part=None, + env_dd=None, boot_script=None, + bootloader_file_in_boot_part=None, uboot_dd=None, spl_in_boot_part=None, spl_dd=None, extra_serial_opts=None, loader_start=None, snowball_startup_files_config=None, @@ -152,7 +153,7 @@ class Metadata(object): self.dtb_addr = dtb_addr self.extra_boot_options = extra_boot_options self.boot_script = boot_script - self.uboot_in_boot_part = uboot_in_boot_part + self.bootloader_file_in_boot_part = bootloader_file_in_boot_part self.uboot_dd = uboot_dd self.spl_in_boot_part = spl_in_boot_part self.spl_dd = spl_dd @@ -226,7 +227,8 @@ class Metadata(object): spl_dd=config.spl_dd, spl_in_boot_part=config.spl_in_boot_part, uboot_dd=config.uboot_dd, - uboot_in_boot_part=config.uboot_in_boot_part, + bootloader_file_in_boot_part=config. + bootloader_file_in_boot_part, vmlinuz=config.vmlinuz, wired_interfaces=config.wired_interfaces, wireless_interfaces=config.wireless_interfaces, @@ -387,8 +389,9 @@ class Metadata(object): metadata += "EXTRA_BOOT_OPTIONS=%s\n" % self.extra_boot_options if self.boot_script is not None: 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.bootloader_file_in_boot_part is not None: + metadata += ("U_BOOT_IN_BOOT_PART=%s\n" % + self.bootloader_file_in_boot_part) if self.spl_in_boot_part is not None: metadata += "SPL_IN_BOOT_PART=%s\n" % self.spl_in_boot_part if self.uboot_dd is not None: diff --git a/linaro_image_tools/hwpack/tests/test_config.py b/linaro_image_tools/hwpack/tests/test_config.py index ab36d04..16369c7 100644 --- a/linaro_image_tools/hwpack/tests/test_config.py +++ b/linaro_image_tools/hwpack/tests/test_config.py @@ -514,7 +514,7 @@ class ConfigTests(TestCase): config = self.get_config(self.valid_complete_v2 + self.valid_end) config.validate() self.assertEqual("Yes", - config.uboot_in_boot_part) + config.bootloader_file_in_boot_part) def test_spl_package(self): config = self.get_config(self.valid_complete_v2 + self.valid_end) diff --git a/linaro_image_tools/hwpack/tests/test_config_v3.py b/linaro_image_tools/hwpack/tests/test_config_v3.py index c58014d..c5caad1 100644 --- a/linaro_image_tools/hwpack/tests/test_config_v3.py +++ b/linaro_image_tools/hwpack/tests/test_config_v3.py @@ -280,7 +280,7 @@ class ConfigTests(TestCase): " in_boot_part: Nope\n") self.assertValidationError( "Invalid value for u_boot_in_boot_part: Nope", - config._validate_uboot_in_boot_part) + config._validate_bootloader_file_in_boot_part) def test_find_board_specific_variable(self): config = self.get_config( @@ -294,8 +294,8 @@ class ConfigTests(TestCase): config.set_bootloader("u_boot") config.set_board("panda") - config._validate_uboot_in_boot_part() - self.assertEqual(config.uboot_in_boot_part, "yes") + config._validate_bootloader_file_in_boot_part() + self.assertEqual(config.bootloader_file_in_boot_part, "yes") def test_board_specific_overwrites_global(self): config = self.get_config( @@ -312,8 +312,8 @@ class ConfigTests(TestCase): config.set_bootloader("u_boot") config.set_board("panda") - config._validate_uboot_in_boot_part() - self.assertEqual(config.uboot_in_boot_part, "yes") + config._validate_bootloader_file_in_boot_part() + self.assertEqual(config.bootloader_file_in_boot_part, "yes") def test_validate_serial_tty(self): config = self.get_config(self.valid_start_v3 + "serial_tty: tty\n") @@ -504,7 +504,7 @@ class ConfigTests(TestCase): config = self.get_config(self.valid_complete_v3 + self.valid_end) config.validate() self.assertEqual("yes", - config.uboot_in_boot_part) + config.bootloader_file_in_boot_part) def test_spl_package(self): config = self.get_config(self.valid_complete_v3 + self.valid_end) diff --git a/linaro_image_tools/media_create/__init__.py b/linaro_image_tools/media_create/__init__.py index 722e282..aecfbbd 100644 --- a/linaro_image_tools/media_create/__init__.py +++ b/linaro_image_tools/media_create/__init__.py @@ -161,6 +161,10 @@ def get_args_parser(): action='store_true', help=('Assume yes to the question "Are you 100%% sure, ' 'on selecting [mmc]"')) + parser.add_argument( + '--bootloader', + help="Select a bootloader from a hardware pack that contains more than" + "one.") add_common_options(parser) return parser diff --git a/linaro_image_tools/media_create/boards.py b/linaro_image_tools/media_create/boards.py index 63ffaf3..d04fe8d 100644 --- a/linaro_image_tools/media_create/boards.py +++ b/linaro_image_tools/media_create/boards.py @@ -213,7 +213,7 @@ class BoardConfig(object): # 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 + bootloader_file_in_boot_part = False uboot_dd = False spl_in_boot_part = False spl_dd = False @@ -380,13 +380,14 @@ class BoardConfig(object): align_up(int(loader_min_size) * 1024 ** 2, SECTOR_SIZE) / SECTOR_SIZE) - uboot_in_boot_part = cls.get_metadata_field('uboot_in_boot_part') - if uboot_in_boot_part is None: - cls.uboot_in_boot_part = False - 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 + bootloader_file_in_boot_part = cls.get_metadata_field( + 'bootloader_file_in_boot_part') + if bootloader_file_in_boot_part is None: + cls.bootloader_file_in_boot_part = False + elif string.lower(bootloader_file_in_boot_part) == 'yes': + cls.bootloader_file_in_boot_part = True + elif string.lower(bootloader_file_in_boot_part) == 'no': + cls.bootloader_file_in_boot_part = False spl_in_boot_part = cls.get_metadata_field('spl_in_boot_part') if spl_in_boot_part is None: cls.spl_in_boot_part = False @@ -760,14 +761,15 @@ class BoardConfig(object): @classmethod def populate_boot(cls, chroot_dir, rootfs_uuid, boot_partition, boot_disk, - boot_device_or_file, is_live, is_lowmem, consoles): + boot_device_or_file, is_live, is_lowmem, consoles, + bootloader=None): parts_dir = 'boot' if is_live: parts_dir = 'casper' uboot_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.uboot_in_boot_part: + if cls.bootloader_file_in_boot_part: with cls.hardwarepack_handler: # <legacy v1 support> if cls.uboot_flavor is not None: @@ -855,7 +857,7 @@ class BoardConfig(object): class OmapConfig(BoardConfig): kernel_flavors = ['linaro-omap4', 'linaro-lt-omap', 'linaro-omap', 'omap4'] - uboot_in_boot_part = True + bootloader_file_in_boot_part = True # XXX: Here we define these things as dynamic properties because our # temporary hack to fix bug 697824 relies on changing the board's @@ -978,7 +980,7 @@ class PandaConfig(OmapConfig): class IgepConfig(BeagleConfig): - uboot_in_boot_part = False + bootloader_file_in_boot_part = False uboot_flavor = None dtb_name = 'isee-igep-v2.dtb' @@ -1327,7 +1329,7 @@ class Mx53LoCoConfig(Mx53Config): class VexpressConfig(BoardConfig): uboot_flavor = 'ca9x4_ct_vxp' - uboot_in_boot_part = True + bootloader_file_in_boot_part = True serial_tty = 'ttyAMA0' _extra_serial_opts = 'console=tty0 console=%s,38400n8' _live_serial_opts = 'serialtty=%s' diff --git a/linaro_image_tools/media_create/tests/test_media_create.py b/linaro_image_tools/media_create/tests/test_media_create.py index cce7a06..b27f6b4 100644 --- a/linaro_image_tools/media_create/tests/test_media_create.py +++ b/linaro_image_tools/media_create/tests/test_media_create.py @@ -2880,10 +2880,10 @@ class TestPopulateBoot(TestCaseWithFixtures): self.expected_calls, self.popen_fixture.mock.commands_executed) self.assertEquals(self.expected_args, self.saved_args) - def test_populate_boot_uboot_in_boot_part(self): + def test_populate_boot_bootloader_file_in_boot_part(self): self.prepare_config(boards.BoardConfig) self.config.uboot_flavor = "uboot_flavor" - self.config.uboot_in_boot_part = True + self.config.bootloader_file_in_boot_part = True self.call_populate_boot(self.config) expected_calls = self.expected_calls[:] expected_calls.insert(2, @@ -2893,9 +2893,22 @@ class TestPopulateBoot(TestCaseWithFixtures): expected_calls, self.popen_fixture.mock.commands_executed) self.assertEquals(self.expected_args, self.saved_args) + 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_file_in_boot_part = False + 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 ' + # 'boot_disk' % sudo_args) + self.assertEquals( + expected_calls, self.popen_fixture.mock.commands_executed) + self.assertEquals(self.expected_args, self.saved_args) + def test_populate_boot_no_uboot_flavor(self): self.prepare_config(boards.BoardConfig) - self.config.uboot_in_boot_part = True + self.config.bootloader_file_in_boot_part = True self.assertRaises( AssertionError, self.call_populate_boot, self.config) |