Merge lp:~tusharbehera/linaro-image-tools/origen-quad-support into lp:linaro-image-tools/11.11

Proposed by Tushar Behera
Status: Merged
Approved by: Данило Шеган
Approved revision: 591
Merged at revision: 591
Proposed branch: lp:~tusharbehera/linaro-image-tools/origen-quad-support
Merge into: lp:linaro-image-tools/11.11
Diff against target: 333 lines (+196/-0)
3 files modified
linaro_image_tools/media_create/android_boards.py (+8/-0)
linaro_image_tools/media_create/boards.py (+22/-0)
linaro_image_tools/media_create/tests/test_media_create.py (+166/-0)
To merge this branch: bzr merge lp:~tusharbehera/linaro-image-tools/origen-quad-support
Reviewer Review Type Date Requested Status
Данило Шеган (community) Approve
Review via email: mp+139425@code.launchpad.net

Description of the change

Tested with linaro-android-media-create with a custom built boot.tar.bz2 for Origen Quad board. For testing, the BL1 and SPL binaries are merged to make a single binary. Waiting for approval from Samsung HQ to release BL1 in the same method. Till we get the permission, we can review this patch.

To post a comment you must log in.
Revision history for this message
Данило Шеган (danilo) wrote :

This looks good. Thanks for writing up all the tests. I'll be landing this after I do a few more local tests.

review: Approve
Revision history for this message
Данило Шеган (danilo) wrote :

Hum, I am having problems with Linaro Android 12.10 release: with these changes, my Exynos 4210 won't boot, whereas the pre-created image does boot.

Revision history for this message
Данило Шеган (danilo) wrote :

Hum, it seems this was transient. It boots on my 4th attempt.

Revision history for this message
Milo Casagrande (milo) wrote :

Pinged Tusharb on IRC about merging this branch, this is what he said:

Gwaihir, let's proceed ahead with the merge of the origen-quad patches ...
Gwaihir, for 2012.12 release, we are using the binaries released by Insignal and we would require this patch ...
Gwaihir, although getting BL1 through Insignal repository is a bit tedious, but it is the only solution ATM for 2012.12 OrigenQuad Android release ..

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/android_boards.py'
2--- linaro_image_tools/media_create/android_boards.py 2012-12-06 04:45:51 +0000
3+++ linaro_image_tools/media_create/android_boards.py 2012-12-12 10:23:23 +0000
4@@ -33,6 +33,7 @@
5 from linaro_image_tools.media_create.boards import SnowballEmmcConfig
6 from linaro_image_tools.media_create.boards import SMDKV310Config
7 from linaro_image_tools.media_create.boards import OrigenConfig
8+from linaro_image_tools.media_create.boards import OrigenQuadConfig
9 from linaro_image_tools.media_create.boards import VexpressConfig
10 from linaro_image_tools.media_create.boards import (
11 align_up,
12@@ -349,6 +350,12 @@
13 dtb_name = None
14
15
16+class AndroidOrigenQuadConfig(AndroidSamsungConfig, OrigenQuadConfig):
17+ _extra_serial_opts = 'console=tty0 console=ttySAC2,115200n8'
18+ android_specific_args = 'init=/init androidboot.console=ttySAC2'
19+ dtb_name = None
20+
21+
22 class AndroidVexpressConfig(AndroidBoardConfig, VexpressConfig):
23 _extra_serial_opts = 'console=tty0 console=ttyAMA0,38400n8'
24 android_specific_args = 'init=/init androidboot.console=ttyAMA0'
25@@ -365,6 +372,7 @@
26 'iMX53': AndroidMx53LoCoConfig,
27 'mx6qsabrelite': AndroidMx6QSabreliteConfig,
28 'origen': AndroidOrigenConfig,
29+ 'origen_quad': AndroidOrigenQuadConfig,
30 'vexpress': AndroidVexpressConfig,
31 'vexpress-a9': AndroidVexpressConfig,
32 }
33
34=== modified file 'linaro_image_tools/media_create/boards.py'
35--- linaro_image_tools/media_create/boards.py 2012-12-10 10:49:30 +0000
36+++ linaro_image_tools/media_create/boards.py 2012-12-12 10:23:23 +0000
37@@ -1453,6 +1453,7 @@
38 old_spl_path = os.path.join(spl_dir, 'v310_mmc_spl.bin')
39 new_spl_path = os.path.join(spl_dir, 'u-boot-mmc-spl.bin')
40 new_new_spl_path = os.path.join(spl_dir, 'origen-spl.bin')
41+ samsung_spl_path_4 = os.path.join(spl_dir, 'origen_quad-spl.bin')
42
43 spl_file = old_spl_path
44 # The new upstream u-boot filename has changed
45@@ -1463,6 +1464,10 @@
46 if not os.path.exists(spl_file):
47 spl_file = new_new_spl_path
48
49+ # upstream u-boot filename is dependent on board name
50+ if not os.path.exists(spl_file):
51+ spl_file = samsung_spl_path_4
52+
53 if not os.path.exists(spl_file):
54 # missing SPL loader
55 raise AssertionError("Couldn't find the SPL file, tried %s and %s"
56@@ -1533,6 +1538,22 @@
57 mmc_option = '0:2'
58
59
60+class OrigenQuadConfig(SamsungConfig):
61+ bootloader_flavor = 'origen_quad'
62+ serial_tty = 'ttySAC2'
63+ _extra_serial_opts = 'console=%s,115200n8'
64+ kernel_addr = '0x40007000'
65+ initrd_addr = '0x42000000'
66+ load_addr = '0x40008000'
67+ kernel_flavors = ['origen_quad']
68+ boot_script = 'boot.scr'
69+ mmc_part_offset = 1
70+ mmc_option = '0:2'
71+ samsung_bl1_len = 48
72+ samsung_bl2_start = 49
73+ samsung_env_start = 1073
74+
75+
76 class I386Config(BoardConfig):
77 # define serial
78 serial_tty = 'ttyS0'
79@@ -1618,6 +1639,7 @@
80 'overo': OveroConfig,
81 'smdkv310': SMDKV310Config,
82 'origen': OrigenConfig,
83+ 'origen_quad': OrigenQuadConfig,
84 'mx6qsabrelite': BoardConfig,
85 'i386': I386Config,
86 }
87
88=== modified file 'linaro_image_tools/media_create/tests/test_media_create.py'
89--- linaro_image_tools/media_create/tests/test_media_create.py 2012-12-10 10:49:30 +0000
90+++ linaro_image_tools/media_create/tests/test_media_create.py 2012-12-12 10:23:23 +0000
91@@ -759,6 +759,26 @@
92 config = boards.OrigenConfig
93
94
95+class TestGetOrigenQuadSPL(TestCaseWithFixtures):
96+ config = boards.OrigenQuadConfig
97+
98+ def test_no_file_present(self):
99+ tempdir = self.useFixture(CreateTempDirFixture()).get_temp_dir()
100+ self.assertRaises(
101+ AssertionError, self.config._get_samsung_spl, tempdir)
102+
103+ def test_new_file_present(self):
104+ tempdir = self.useFixture(CreateTempDirFixture()).get_temp_dir()
105+ path = _create_uboot_dir(tempdir, self.config.bootloader_flavor)
106+ spl_path = os.path.join(path, 'origen_quad-spl.bin')
107+ open(spl_path, 'w').close()
108+ self.assertEquals(spl_path, self.config._get_samsung_spl(tempdir))
109+
110+
111+class TestGetOrigenQuadUboot(TestGetSMDKUboot):
112+ config = boards.OrigenQuadConfig
113+
114+
115 class TestCreateToc(TestCaseWithFixtures):
116 ''' Tests boards.SnowballEmmcConfig.create_toc()'''
117
118@@ -1223,6 +1243,27 @@
119 'make_uImage', 'make_uInitrd', 'make_boot_script']
120 self.assertEqual(expected, self.funcs_calls)
121
122+ def test_origen_quad_steps(self):
123+ def mock_func_creator(name):
124+ return classmethod(
125+ lambda *args, **kwargs: self.funcs_calls.append(name))
126+
127+ self.useFixture(MockSomethingFixture(
128+ linaro_image_tools.media_create.boards.OrigenQuadConfig,
129+ 'install_samsung_boot_loader',
130+ mock_func_creator('install_samsung_boot_loader')))
131+ self.useFixture(MockSomethingFixture(os.path, 'exists',
132+ lambda file: True))
133+ boards.OrigenQuadConfig.hardwarepack_handler = (
134+ TestSetMetadata.MockHardwarepackHandler('ahwpack.tar.gz'))
135+ boards.OrigenQuadConfig.hardwarepack_handler.get_format = (
136+ lambda: '1.0')
137+ self.make_boot_files(boards.OrigenQuadConfig)
138+ expected = [
139+ 'install_samsung_boot_loader', 'make_flashable_env', '_dd',
140+ 'make_uImage', 'make_uInitrd', 'make_boot_script']
141+ self.assertEqual(expected, self.funcs_calls)
142+
143 def test_ux500_steps(self):
144 self.make_boot_files(boards.Ux500Config)
145 expected = ['make_uImage', 'make_uInitrd', 'make_boot_script']
146@@ -1358,6 +1399,14 @@
147 expected = ['_dd', '_dd', '_dd']
148 self.assertEqual(expected, self.funcs_calls)
149
150+ def test_origen_quad_raw(self):
151+ self.useFixture(MockSomethingFixture(os.path, 'getsize',
152+ lambda file: 1))
153+
154+ self.populate_raw_partition(boards.OrigenQuadConfig)
155+ expected = ['_dd', '_dd', '_dd']
156+ self.assertEqual(expected, self.funcs_calls)
157+
158 def test_vexpress_a9_raw(self):
159 self.populate_raw_partition(boards.VexpressA9Config)
160 expected = []
161@@ -1463,6 +1512,24 @@
162 self.assertEqual(expected_commands, fixture.mock.commands_executed)
163 self.assertEqual(expected, self.funcs_calls)
164
165+ def test_origen_quad_raw(self):
166+ fixture = MockCmdRunnerPopenFixture()
167+ self.useFixture(fixture)
168+ expected_commands = [
169+ ('sudo -E dd if=/dev/zero of= bs=512 conv=notrunc count=32 '
170+ 'seek=1073'),
171+ ('sudo -E dd if=boot/u-boot-mmc-spl.bin of= bs=512 '
172+ 'conv=notrunc seek=1'),
173+ 'sudo -E dd if=boot/u-boot.bin of= bs=512 conv=notrunc seek=49']
174+ self.useFixture(MockSomethingFixture(os.path, 'getsize',
175+ lambda file: 1))
176+
177+ self.populate_raw_partition(android_boards.AndroidOrigenQuadConfig)
178+ expected = []
179+ # Test that we dd the files
180+ self.assertEqual(expected_commands, fixture.mock.commands_executed)
181+ self.assertEqual(expected, self.funcs_calls)
182+
183 def test_vexpress_raw(self):
184 self.populate_raw_partition(android_boards.AndroidVexpressConfig)
185 expected = []
186@@ -1600,6 +1667,11 @@
187 '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-',
188 board_configs['origen'].get_sfdisk_cmd())
189
190+ def test_origen_quad(self):
191+ self.assertEquals(
192+ '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-',
193+ board_configs['origen_quad'].get_sfdisk_cmd())
194+
195 def test_panda_android(self):
196 self.assertEqual(
197 '63,270272,0x0C,*\n270336,1048576,L\n1318912,524288,L\n'
198@@ -1612,6 +1684,12 @@
199 '1327104,-,E\n1327104,524288,L\n1851392,1048576,L\n2899968,,,-',
200 android_boards.AndroidOrigenConfig.get_sfdisk_cmd())
201
202+ def test_origen_quad_android(self):
203+ self.assertEqual(
204+ '1,8191,0xDA\n8253,270274,0x0C,*\n278528,1048576,L\n'
205+ '1327104,-,E\n1327104,524288,L\n1851392,1048576,L\n2899968,,,-',
206+ android_boards.AndroidOrigenQuadConfig.get_sfdisk_cmd())
207+
208 def test_snowball_emmc_android(self):
209 self.assertEqual(
210 '256,7936,0xDA\n8192,262144,0x0C,*\n270336,1048576,L\n'
211@@ -1683,6 +1761,17 @@
212 '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-',
213 config.get_sfdisk_cmd())
214
215+ def test_origen_quad(self):
216+ class config(board_configs['origen_quad']):
217+ partition_layout = 'reserved_bootfs_rootfs'
218+ LOADER_MIN_SIZE_S = (boards.BoardConfig.samsung_bl1_start +
219+ boards.BoardConfig.samsung_bl1_len +
220+ boards.BoardConfig.samsung_bl2_len +
221+ boards.BoardConfig.samsung_env_len)
222+ self.assertEquals(
223+ '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-',
224+ config.get_sfdisk_cmd())
225+
226
227 class TestGetBootCmd(TestCase):
228
229@@ -1760,6 +1849,20 @@
230 'initrd_high': '0xffffffff'}
231 self.assertEqual(expected, boot_commands)
232
233+ def test_origen_quad(self):
234+ boot_commands = board_configs['origen_quad']._get_boot_env(
235+ is_live=False, is_lowmem=False, consoles=[],
236+ rootfs_id="UUID=deadbeef", i_img_data="initrd", d_img_data=None)
237+ expected = {
238+ 'bootargs': 'console=ttySAC2,115200n8 root=UUID=deadbeef '
239+ 'rootwait ro',
240+ 'bootcmd': 'fatload mmc 0:2 0x40007000 uImage; '
241+ 'fatload mmc 0:2 0x42000000 uInitrd; '
242+ 'bootm 0x40007000 0x42000000',
243+ 'fdt_high': '0xffffffff',
244+ 'initrd_high': '0xffffffff'}
245+ self.assertEqual(expected, boot_commands)
246+
247 def test_ux500(self):
248 boot_commands = board_configs['ux500']._get_boot_env(
249 is_live=False, is_lowmem=False, consoles=[],
250@@ -2031,6 +2134,18 @@
251 self.assertBootEnv(
252 android_boards.AndroidOrigenConfig, expected)
253
254+ def test_android_origen_quad(self):
255+ expected = {
256+ 'bootargs': 'console=tty0 console=ttySAC2,115200n8 '
257+ 'rootwait ro init=/init androidboot.console=ttySAC2',
258+ 'bootcmd': 'fatload mmc 0:2 0x40007000 uImage; '
259+ 'fatload mmc 0:2 0x42000000 uInitrd; '
260+ 'bootm 0x40007000 0x42000000',
261+ 'fdt_high': '0xffffffff',
262+ 'initrd_high': '0xffffffff'}
263+ self.assertBootEnv(
264+ android_boards.AndroidOrigenQuadConfig, expected)
265+
266 def test_android_vexpress(self):
267 expected = {
268 'bootargs': 'console=tty0 console=ttyAMA0,38400n8 '
269@@ -2250,6 +2365,36 @@
270 boards.OrigenConfig.samsung_bl2_start)]
271 self.assertEqual(expected, fixture.mock.commands_executed)
272
273+ def test_install_origen_quad_u_boot(self):
274+ fixture = self._mock_Popen()
275+ bootloader_flavor = boards.OrigenQuadConfig.bootloader_flavor
276+ self.useFixture(MockSomethingFixture(
277+ boards.OrigenQuadConfig, '_get_samsung_spl',
278+ classmethod(lambda cls, chroot_dir: "%s/%s/SPL" % (
279+ chroot_dir, bootloader_flavor))))
280+ self.useFixture(MockSomethingFixture(
281+ boards.OrigenQuadConfig, '_get_samsung_bootloader',
282+ classmethod(lambda cls, chroot_dir: "%s/%s/uboot" % (
283+ chroot_dir, bootloader_flavor))))
284+ boards.OrigenQuadConfig.hardwarepack_handler = (
285+ TestSetMetadata.MockHardwarepackHandler('ahwpack.tar.gz'))
286+ boards.OrigenQuadConfig.hardwarepack_handler.get_format = (
287+ lambda: '1.0')
288+ self.useFixture(MockSomethingFixture(os.path, 'getsize',
289+ lambda file: 1))
290+ boards.OrigenQuadConfig.install_samsung_boot_loader(
291+ boards.OrigenQuadConfig._get_samsung_spl("chroot_dir"),
292+ boards.OrigenQuadConfig._get_samsung_bootloader("chroot_dir"),
293+ "boot_disk")
294+ expected = [
295+ '%s dd if=chroot_dir/%s/SPL of=boot_disk bs=512 conv=notrunc '
296+ 'seek=%d' % (sudo_args, bootloader_flavor,
297+ boards.OrigenQuadConfig.samsung_bl1_start),
298+ '%s dd if=chroot_dir/%s/uboot of=boot_disk bs=512 conv=notrunc '
299+ 'seek=%d' % (sudo_args, bootloader_flavor,
300+ boards.OrigenQuadConfig.samsung_bl2_start)]
301+ self.assertEqual(expected, fixture.mock.commands_executed)
302+
303 def test_get_plain_boot_script_contents(self):
304 boot_env = {'bootargs': 'mybootargs', 'bootcmd': 'mybootcmd',
305 'initrd_high': '0xffffffff', 'fdt_high': '0xffffffff'}
306@@ -2477,6 +2622,27 @@
307 [('1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-', HEADS,
308 SECTORS, '', self.media.path)], sfdisk_fixture.mock.calls)
309
310+ def test_create_partitions_for_origen_quad(self):
311+ # For this board we create a one cylinder partition at the beginning.
312+ popen_fixture = self.useFixture(MockCmdRunnerPopenFixture())
313+ sfdisk_fixture = self.useFixture(MockRunSfdiskCommandsFixture())
314+
315+ create_partitions(
316+ board_configs['origen_quad'], self.media, HEADS, SECTORS, '')
317+
318+ self.assertEqual(
319+ ['%s parted -s %s mklabel msdos' % (sudo_args, self.media.path),
320+ '%s sfdisk -l %s' % (sudo_args, self.media.path),
321+ 'sync',
322+ '%s sfdisk -l %s' % (sudo_args, self.media.path)],
323+ popen_fixture.mock.commands_executed)
324+ # Notice that we create all partitions in a single sfdisk run because
325+ # every time we run sfdisk it actually repartitions the device,
326+ # erasing any partitions created previously.
327+ self.assertEqual(
328+ [('1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-', HEADS,
329+ SECTORS, '', self.media.path)], sfdisk_fixture.mock.calls)
330+
331 def test_create_partitions_for_beagle(self):
332 popen_fixture = self.useFixture(MockCmdRunnerPopenFixture())
333 sfdisk_fixture = self.useFixture(MockRunSfdiskCommandsFixture())

Subscribers

People subscribed via source and target branches