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
1=== modified file 'linaro_image_tools/media_create/boards.py'
2--- linaro_image_tools/media_create/boards.py 2013-02-25 09:05:41 +0000
3+++ linaro_image_tools/media_create/boards.py 2013-03-20 16:26:04 +0000
4@@ -137,6 +137,10 @@
5 cmd_runner.run(cmd, as_root=True).wait()
6
7
8+class BoardException(Exception):
9+ """Class for board related exceptions."""
10+
11+
12 class BoardConfig(object):
13 """The configuration used when building an image for a board."""
14
15@@ -1541,7 +1545,6 @@
16
17
18 class OrigenConfig(SamsungConfig):
19- # TODO test
20 def __init__(self):
21 super(OrigenConfig, self).__init__()
22 self.boot_script = 'boot.scr'
23@@ -1569,10 +1572,33 @@
24 self.mmc_part_offset = 1
25 self.samsung_bl1_len = 48
26 self.samsung_bl2_start = 49
27- self.samsung_env_start = 1073
28+ self.samsung_env_start = 1599
29 self.serial_tty = 'ttySAC2'
30 self._extra_serial_options = 'console=%s,115200n8'
31
32+ def populate_raw_partition(self, boot_device_or_file, chroot_dir):
33+ # Overridden method for Origen Quad board, since the bootloader
34+ # is now composed of 4 binaries.
35+ boot_bin_0 = {'name': 'origen_quad.bl1.bin', 'seek': 1}
36+ boot_bin_1 = {'name': 'origen_quad-spl.bin.signed', 'seek': 31}
37+ boot_bin_2 = {'name': 'u-boot.bin', 'seek': 63}
38+ boot_bin_3 = {'name': 'exynos4x12.tzsw.signed.img', 'seek': 761}
39+ boot_bins = [boot_bin_0, boot_bin_1, boot_bin_2, boot_bin_3]
40+
41+ boot_partition = 'boot'
42+
43+ # Zero the env so that the boot_script will get loaded
44+ _dd("/dev/zero", boot_device_or_file, count=self.samsung_env_len,
45+ seek=self.samsung_env_start)
46+
47+ for boot_bin in boot_bins:
48+ name = boot_bin['name']
49+ file_path = os.path.join(chroot_dir, boot_partition, name)
50+ if not os.path.exists(file_path):
51+ raise BoardException("File '%s' does not exists. Cannot "
52+ "proceed." % name)
53+ _dd(file_path, boot_device_or_file, seek=boot_bin['seek'])
54+
55
56 class ArndaleConfig(SamsungConfig):
57 def __init__(self):
58
59=== modified file 'linaro_image_tools/media_create/tests/test_media_create.py'
60--- linaro_image_tools/media_create/tests/test_media_create.py 2013-02-18 13:05:58 +0000
61+++ linaro_image_tools/media_create/tests/test_media_create.py 2013-03-20 16:26:04 +0000
62@@ -1517,13 +1517,20 @@
63 self.assertEqual(expected, self.funcs_calls)
64
65 def test_origen_quad_raw(self):
66- self.useFixture(MockSomethingFixture(os.path, 'getsize',
67- lambda file: 1))
68+ # Need to mock this since files do not exist here, and
69+ # an Exception is raised.
70+ self.useFixture(MockSomethingFixture(os.path, 'exists',
71+ lambda exists: True))
72
73 self.populate_raw_partition(boards.OrigenQuadConfig())
74- expected = ['_dd', '_dd', '_dd']
75+ expected = ['_dd', '_dd', '_dd', '_dd', '_dd']
76 self.assertEqual(expected, self.funcs_calls)
77
78+ def test_origen_quad_raises(self):
79+ board_conf = boards.OrigenQuadConfig()
80+ self.assertRaises(boards.BoardException,
81+ board_conf.populate_raw_partition, '', '')
82+
83 def test_arndale_raw(self):
84 self.useFixture(MockSomethingFixture(os.path, 'getsize',
85 lambda file: 1))
86@@ -1641,13 +1648,20 @@
87 fixture = MockCmdRunnerPopenFixture()
88 self.useFixture(fixture)
89 expected_commands = [
90- ('sudo -E dd if=/dev/zero of= bs=512 conv=notrunc count=32 '
91- 'seek=1073'),
92- ('sudo -E dd if=boot/u-boot-mmc-spl.bin of= bs=512 '
93- 'conv=notrunc seek=1'),
94- 'sudo -E dd if=boot/u-boot.bin of= bs=512 conv=notrunc seek=49']
95- self.useFixture(MockSomethingFixture(os.path, 'getsize',
96- lambda file: 1))
97+ ('sudo -E dd if=/dev/zero of= bs=512 conv=notrunc count=32 '
98+ 'seek=1599'),
99+ ('sudo -E dd if=boot/origen_quad.bl1.bin of= bs=512 '
100+ 'conv=notrunc seek=1'),
101+ ('sudo -E dd if=boot/origen_quad-spl.bin.signed of= bs=512 '
102+ 'conv=notrunc seek=31'),
103+ ('sudo -E dd if=boot/u-boot.bin of= bs=512 conv=notrunc '
104+ 'seek=63'),
105+ ('sudo -E dd if=boot/exynos4x12.tzsw.signed.img of= bs=512 '
106+ 'conv=notrunc seek=761')
107+ ]
108+
109+ self.useFixture(MockSomethingFixture(os.path, 'exists',
110+ lambda exists: True))
111
112 self.populate_raw_partition(android_boards.AndroidOrigenQuadConfig())
113 expected = []

Subscribers

People subscribed via source and target branches