=== modified file 'linaro_image_tools/media_create/boards.py'
@@ -137,6 +137,10 @@
cmd_runner.run(cmd, as_root=True).wait()
+class BoardException(Exception):
+ """Class for board related exceptions."""
+
+
class BoardConfig(object):
"""The configuration used when building an image for a board."""
@@ -1541,7 +1545,6 @@
class OrigenConfig(SamsungConfig):
- # TODO test
def __init__(self):
super(OrigenConfig, self).__init__()
self.boot_script = 'boot.scr'
@@ -1569,10 +1572,33 @@
self.mmc_part_offset = 1
self.samsung_bl1_len = 48
self.samsung_bl2_start = 49
- self.samsung_env_start = 1073
+ self.samsung_env_start = 1599
self.serial_tty = 'ttySAC2'
self._extra_serial_options = 'console=%s,115200n8'
+ def populate_raw_partition(self, boot_device_or_file, chroot_dir):
+ # Overridden method for Origen Quad board, since the bootloader
+ # is now composed of 4 binaries.
+ boot_bin_0 = {'name': 'origen_quad.bl1.bin', 'seek': 1}
+ boot_bin_1 = {'name': 'origen_quad-spl.bin.signed', 'seek': 31}
+ boot_bin_2 = {'name': 'u-boot.bin', 'seek': 63}
+ boot_bin_3 = {'name': 'exynos4x12.tzsw.signed.img', 'seek': 761}
+ boot_bins = [boot_bin_0, boot_bin_1, boot_bin_2, boot_bin_3]
+
+ boot_partition = 'boot'
+
+ # Zero the env so that the boot_script will get loaded
+ _dd("/dev/zero", boot_device_or_file, count=self.samsung_env_len,
+ seek=self.samsung_env_start)
+
+ for boot_bin in boot_bins:
+ name = boot_bin['name']
+ file_path = os.path.join(chroot_dir, boot_partition, name)
+ if not os.path.exists(file_path):
+ raise BoardException("File '%s' does not exists. Cannot "
+ "proceed." % name)
+ _dd(file_path, boot_device_or_file, seek=boot_bin['seek'])
+
class ArndaleConfig(SamsungConfig):
def __init__(self):
=== modified file 'linaro_image_tools/media_create/tests/test_media_create.py'
@@ -1517,13 +1517,20 @@
self.assertEqual(expected, self.funcs_calls)
def test_origen_quad_raw(self):
- self.useFixture(MockSomethingFixture(os.path, 'getsize',
- lambda file: 1))
+ # Need to mock this since files do not exist here, and
+ # an Exception is raised.
+ self.useFixture(MockSomethingFixture(os.path, 'exists',
+ lambda exists: True))
self.populate_raw_partition(boards.OrigenQuadConfig())
- expected = ['_dd', '_dd', '_dd']
+ expected = ['_dd', '_dd', '_dd', '_dd', '_dd']
self.assertEqual(expected, self.funcs_calls)
+ def test_origen_quad_raises(self):
+ board_conf = boards.OrigenQuadConfig()
+ self.assertRaises(boards.BoardException,
+ board_conf.populate_raw_partition, '', '')
+
def test_arndale_raw(self):
self.useFixture(MockSomethingFixture(os.path, 'getsize',
lambda file: 1))
@@ -1641,13 +1648,20 @@
fixture = MockCmdRunnerPopenFixture()
self.useFixture(fixture)
expected_commands = [
- ('sudo -E dd if=/dev/zero of= bs=512 conv=notrunc count=32 '
- 'seek=1073'),
- ('sudo -E dd if=boot/u-boot-mmc-spl.bin of= bs=512 '
- 'conv=notrunc seek=1'),
- 'sudo -E dd if=boot/u-boot.bin of= bs=512 conv=notrunc seek=49']
- self.useFixture(MockSomethingFixture(os.path, 'getsize',
- lambda file: 1))
+ ('sudo -E dd if=/dev/zero of= bs=512 conv=notrunc count=32 '
+ 'seek=1599'),
+ ('sudo -E dd if=boot/origen_quad.bl1.bin of= bs=512 '
+ 'conv=notrunc seek=1'),
+ ('sudo -E dd if=boot/origen_quad-spl.bin.signed of= bs=512 '
+ 'conv=notrunc seek=31'),
+ ('sudo -E dd if=boot/u-boot.bin of= bs=512 conv=notrunc '
+ 'seek=63'),
+ ('sudo -E dd if=boot/exynos4x12.tzsw.signed.img of= bs=512 '
+ 'conv=notrunc seek=761')
+ ]
+
+ self.useFixture(MockSomethingFixture(os.path, 'exists',
+ lambda exists: True))
self.populate_raw_partition(android_boards.AndroidOrigenQuadConfig())
expected = []