Merge lp:~milo/linaro-image-tools/bug1155702 into lp:linaro-image-tools/11.11

Proposed by Milo Casagrande
Status: Merged
Merged at revision: 610
Proposed branch: lp:~milo/linaro-image-tools/bug1155702
Merge into: lp:linaro-image-tools/11.11
Diff against target: 113 lines (+52/-12)
2 files modified
linaro_image_tools/media_create/boards.py (+28/-2)
linaro_image_tools/media_create/tests/test_media_create.py (+24/-10)
To merge this branch: bzr merge lp:~milo/linaro-image-tools/bug1155702
Reviewer Review Type Date Requested Status
Fathi Boudra Approve
Review via email: mp+154425@code.launchpad.net

Description of the change

The following branch fixes support for Origen Quad boards.

New binaries are needed to boot an Origen Quad board, binaries provided in
the boot tarball for Android.

Branch fixes the tests and adds another one to verify the correct exception
is thrown in case of a missing file.

To post a comment you must log in.
Revision history for this message
Fathi Boudra (fboudra) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'linaro_image_tools/media_create/boards.py'
--- linaro_image_tools/media_create/boards.py 2013-02-25 09:05:41 +0000
+++ linaro_image_tools/media_create/boards.py 2013-03-20 16:26:04 +0000
@@ -137,6 +137,10 @@
137 cmd_runner.run(cmd, as_root=True).wait()137 cmd_runner.run(cmd, as_root=True).wait()
138138
139139
140class BoardException(Exception):
141 """Class for board related exceptions."""
142
143
140class BoardConfig(object):144class BoardConfig(object):
141 """The configuration used when building an image for a board."""145 """The configuration used when building an image for a board."""
142146
@@ -1541,7 +1545,6 @@
15411545
15421546
1543class OrigenConfig(SamsungConfig):1547class OrigenConfig(SamsungConfig):
1544 # TODO test
1545 def __init__(self):1548 def __init__(self):
1546 super(OrigenConfig, self).__init__()1549 super(OrigenConfig, self).__init__()
1547 self.boot_script = 'boot.scr'1550 self.boot_script = 'boot.scr'
@@ -1569,10 +1572,33 @@
1569 self.mmc_part_offset = 11572 self.mmc_part_offset = 1
1570 self.samsung_bl1_len = 481573 self.samsung_bl1_len = 48
1571 self.samsung_bl2_start = 491574 self.samsung_bl2_start = 49
1572 self.samsung_env_start = 10731575 self.samsung_env_start = 1599
1573 self.serial_tty = 'ttySAC2'1576 self.serial_tty = 'ttySAC2'
1574 self._extra_serial_options = 'console=%s,115200n8'1577 self._extra_serial_options = 'console=%s,115200n8'
15751578
1579 def populate_raw_partition(self, boot_device_or_file, chroot_dir):
1580 # Overridden method for Origen Quad board, since the bootloader
1581 # is now composed of 4 binaries.
1582 boot_bin_0 = {'name': 'origen_quad.bl1.bin', 'seek': 1}
1583 boot_bin_1 = {'name': 'origen_quad-spl.bin.signed', 'seek': 31}
1584 boot_bin_2 = {'name': 'u-boot.bin', 'seek': 63}
1585 boot_bin_3 = {'name': 'exynos4x12.tzsw.signed.img', 'seek': 761}
1586 boot_bins = [boot_bin_0, boot_bin_1, boot_bin_2, boot_bin_3]
1587
1588 boot_partition = 'boot'
1589
1590 # Zero the env so that the boot_script will get loaded
1591 _dd("/dev/zero", boot_device_or_file, count=self.samsung_env_len,
1592 seek=self.samsung_env_start)
1593
1594 for boot_bin in boot_bins:
1595 name = boot_bin['name']
1596 file_path = os.path.join(chroot_dir, boot_partition, name)
1597 if not os.path.exists(file_path):
1598 raise BoardException("File '%s' does not exists. Cannot "
1599 "proceed." % name)
1600 _dd(file_path, boot_device_or_file, seek=boot_bin['seek'])
1601
15761602
1577class ArndaleConfig(SamsungConfig):1603class ArndaleConfig(SamsungConfig):
1578 def __init__(self):1604 def __init__(self):
15791605
=== modified file 'linaro_image_tools/media_create/tests/test_media_create.py'
--- linaro_image_tools/media_create/tests/test_media_create.py 2013-02-18 13:05:58 +0000
+++ linaro_image_tools/media_create/tests/test_media_create.py 2013-03-20 16:26:04 +0000
@@ -1517,13 +1517,20 @@
1517 self.assertEqual(expected, self.funcs_calls)1517 self.assertEqual(expected, self.funcs_calls)
15181518
1519 def test_origen_quad_raw(self):1519 def test_origen_quad_raw(self):
1520 self.useFixture(MockSomethingFixture(os.path, 'getsize',1520 # Need to mock this since files do not exist here, and
1521 lambda file: 1))1521 # an Exception is raised.
1522 self.useFixture(MockSomethingFixture(os.path, 'exists',
1523 lambda exists: True))
15221524
1523 self.populate_raw_partition(boards.OrigenQuadConfig())1525 self.populate_raw_partition(boards.OrigenQuadConfig())
1524 expected = ['_dd', '_dd', '_dd']1526 expected = ['_dd', '_dd', '_dd', '_dd', '_dd']
1525 self.assertEqual(expected, self.funcs_calls)1527 self.assertEqual(expected, self.funcs_calls)
15261528
1529 def test_origen_quad_raises(self):
1530 board_conf = boards.OrigenQuadConfig()
1531 self.assertRaises(boards.BoardException,
1532 board_conf.populate_raw_partition, '', '')
1533
1527 def test_arndale_raw(self):1534 def test_arndale_raw(self):
1528 self.useFixture(MockSomethingFixture(os.path, 'getsize',1535 self.useFixture(MockSomethingFixture(os.path, 'getsize',
1529 lambda file: 1))1536 lambda file: 1))
@@ -1641,13 +1648,20 @@
1641 fixture = MockCmdRunnerPopenFixture()1648 fixture = MockCmdRunnerPopenFixture()
1642 self.useFixture(fixture)1649 self.useFixture(fixture)
1643 expected_commands = [1650 expected_commands = [
1644 ('sudo -E dd if=/dev/zero of= bs=512 conv=notrunc count=32 '1651 ('sudo -E dd if=/dev/zero of= bs=512 conv=notrunc count=32 '
1645 'seek=1073'),1652 'seek=1599'),
1646 ('sudo -E dd if=boot/u-boot-mmc-spl.bin of= bs=512 '1653 ('sudo -E dd if=boot/origen_quad.bl1.bin of= bs=512 '
1647 'conv=notrunc seek=1'),1654 'conv=notrunc seek=1'),
1648 'sudo -E dd if=boot/u-boot.bin of= bs=512 conv=notrunc seek=49']1655 ('sudo -E dd if=boot/origen_quad-spl.bin.signed of= bs=512 '
1649 self.useFixture(MockSomethingFixture(os.path, 'getsize',1656 'conv=notrunc seek=31'),
1650 lambda file: 1))1657 ('sudo -E dd if=boot/u-boot.bin of= bs=512 conv=notrunc '
1658 'seek=63'),
1659 ('sudo -E dd if=boot/exynos4x12.tzsw.signed.img of= bs=512 '
1660 'conv=notrunc seek=761')
1661 ]
1662
1663 self.useFixture(MockSomethingFixture(os.path, 'exists',
1664 lambda exists: True))
16511665
1652 self.populate_raw_partition(android_boards.AndroidOrigenQuadConfig())1666 self.populate_raw_partition(android_boards.AndroidOrigenQuadConfig())
1653 expected = []1667 expected = []

Subscribers

People subscribed via source and target branches