Merge lp:~salgado/linaro-image-tools/consolidate-board-config into lp:linaro-image-tools/11.11
- consolidate-board-config
- Merge into trunk
Proposed by
Guilherme Salgado
Status: | Merged |
---|---|
Merged at revision: | 238 |
Proposed branch: | lp:~salgado/linaro-image-tools/consolidate-board-config |
Merge into: | lp:linaro-image-tools/11.11 |
Prerequisite: | lp:~salgado/linaro-image-tools/config-class |
Diff against target: |
555 lines (+201/-158) 4 files modified
linaro-media-create (+2/-2) linaro_media_create/boards.py (+177/-10) linaro_media_create/populate_boot.py (+5/-129) linaro_media_create/tests/test_media_create.py (+17/-17) |
To merge this branch: | bzr merge lp:~salgado/linaro-image-tools/consolidate-board-config |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Linaro Maintainers | Pending | ||
Review via email: mp+46062@code.launchpad.net |
Commit message
Description of the change
Move board-specific stuff from populate_boot.py to boards.py
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'linaro-media-create' |
2 | --- linaro-media-create 2011-01-13 01:04:08 +0000 |
3 | +++ linaro-media-create 2011-01-13 01:04:08 +0000 |
4 | @@ -100,8 +100,8 @@ |
5 | |
6 | if args.should_format_bootfs: |
7 | populate_boot( |
8 | - args.board, board_config, ROOTFS_DIR, boot_partition, BOOT_DISK, |
9 | - args.device, TMP_DIR, args.is_live, args.is_lowmem, args.consoles) |
10 | + board_config, ROOTFS_DIR, boot_partition, BOOT_DISK, args.device, |
11 | + args.is_live, args.is_lowmem, args.consoles) |
12 | |
13 | if args.should_format_rootfs: |
14 | create_swap = False |
15 | |
16 | === modified file 'linaro_media_create/boards.py' |
17 | --- linaro_media_create/boards.py 2011-01-13 01:04:08 +0000 |
18 | +++ linaro_media_create/boards.py 2011-01-13 01:04:08 +0000 |
19 | @@ -1,35 +1,48 @@ |
20 | """Configuration for boards supported by linaro-media-create. |
21 | |
22 | -To add support for a new board, you just need to create a subclass of |
23 | -BoardConfig and set appropriate values for its variables. |
24 | +To add support for a new board, you need to create a subclass of |
25 | +BoardConfig, set appropriate values for its variables and add it to |
26 | +board_configs at the bottom of this file. |
27 | """ |
28 | |
29 | +import atexit |
30 | +import glob |
31 | +import os |
32 | +import tempfile |
33 | import uuid |
34 | |
35 | +from linaro_media_create import cmd_runner |
36 | + |
37 | ROOTFS_UUID = str(uuid.uuid4()) |
38 | |
39 | |
40 | class BoardConfig(object): |
41 | """The configuration used when building an image for a board.""" |
42 | + # These attributes may not need to be redefined on some subclasses. |
43 | uboot_flavor = None |
44 | mmc_option = '0:1' |
45 | mmc_part_offset = 0 |
46 | - extra_serial_opts = None |
47 | - live_serial_opts = None |
48 | + fat_size = 32 |
49 | + extra_serial_opts = '' |
50 | + live_serial_opts = '' |
51 | + extra_boot_args_options = None |
52 | + |
53 | + # These attributes must be defined on all subclasses. |
54 | kernel_addr = None |
55 | initrd_addr = None |
56 | load_addr = None |
57 | sub_arch = None |
58 | boot_script = None |
59 | - extra_boot_args_options = None |
60 | - fat_size = 32 |
61 | |
62 | @classmethod |
63 | - def get_boot_cmd(cls, is_live, is_lowmem, consoles): |
64 | - """Get the boot command for this board.""" |
65 | + def _get_boot_cmd(cls, is_live, is_lowmem, consoles): |
66 | + """Get the boot command for this board. |
67 | + |
68 | + In general subclasses should not have to override this. |
69 | + """ |
70 | boot_args_options = 'rootwait ro' |
71 | - if cls.extra_boot_args_options: |
72 | - boot_args_options += " %s" % cls.extra_boot_args_options |
73 | + if cls.extra_boot_args_options is not None: |
74 | + boot_args_options += ' %s' % cls.extra_boot_args_options |
75 | serial_opts = '' |
76 | if consoles is not None: |
77 | for console in consoles: |
78 | @@ -63,6 +76,24 @@ |
79 | "%(boot_snippet)s %(boot_args_options)s'\n" |
80 | "boot" % replacements) |
81 | |
82 | + @classmethod |
83 | + def make_boot_files(cls, uboot_parts_dir, is_live, is_lowmem, consoles, |
84 | + root_dir, boot_dir, boot_script, boot_device_or_file): |
85 | + boot_cmd = cls._get_boot_cmd(is_live, is_lowmem, consoles) |
86 | + cls._make_boot_files( |
87 | + uboot_parts_dir, boot_cmd, root_dir, boot_dir, boot_script, |
88 | + boot_device_or_file) |
89 | + |
90 | + @classmethod |
91 | + def _make_boot_files(cls, uboot_parts_dir, boot_cmd, root_dir, boot_dir, |
92 | + boot_script, boot_device_or_file): |
93 | + """Make the necessary boot files for this board. |
94 | + |
95 | + This is usually board-specific so ought to be defined in every |
96 | + subclass. |
97 | + """ |
98 | + raise NotImplementedError() |
99 | + |
100 | |
101 | class BeagleConfig(BoardConfig): |
102 | uboot_flavor = 'omap3_beagle' |
103 | @@ -77,6 +108,17 @@ |
104 | 'earlyprintk fixrtc nocompcache vram=12M omapfb.debug=y ' |
105 | 'omapfb.mode=dvi:1280x720MR-16@60') |
106 | |
107 | + @classmethod |
108 | + def _make_boot_files(cls, uboot_parts_dir, boot_cmd, chroot_dir, |
109 | + boot_dir, boot_script, boot_device_or_file): |
110 | + mlo_file = os.path.join( |
111 | + chroot_dir, 'usr', 'lib', 'x-loader-omap', 'MLO') |
112 | + install_omap_boot_loader(mlo_file, boot_dir) |
113 | + make_uImage(cls.load_addr, uboot_parts_dir, cls.sub_arch, boot_dir) |
114 | + make_uInitrd(uboot_parts_dir, cls.sub_arch, boot_dir) |
115 | + make_boot_script(boot_cmd, boot_script) |
116 | + make_boot_ini(boot_script, boot_dir) |
117 | + |
118 | |
119 | class PandaConfig(BoardConfig): |
120 | uboot_flavor = 'omap4_panda' |
121 | @@ -91,10 +133,29 @@ |
122 | 'earlyprintk fixrtc nocompcache vram = 32M omapfb.debug = y ' |
123 | 'omapfb.vram = 0:8M mem = 463M ip = none') |
124 | |
125 | + @classmethod |
126 | + def _make_boot_files(cls, uboot_parts_dir, boot_cmd, chroot_dir, |
127 | + boot_dir, boot_script, boot_device_or_file): |
128 | + mlo_file = os.path.join( |
129 | + chroot_dir, 'usr', 'lib', 'x-loader-omap4', 'MLO') |
130 | + install_omap_boot_loader(mlo_file, boot_dir) |
131 | + make_uImage(cls.load_addr, uboot_parts_dir, cls.sub_arch, boot_dir) |
132 | + make_uInitrd(uboot_parts_dir, cls.sub_arch, boot_dir) |
133 | + make_boot_script(boot_cmd, boot_script) |
134 | + make_boot_ini(boot_script, boot_dir) |
135 | + |
136 | |
137 | class IgepConfig(BeagleConfig): |
138 | uboot_flavor = None |
139 | |
140 | + @classmethod |
141 | + def _make_boot_files(cls, uboot_parts_dir, boot_cmd, chroot_dir, |
142 | + boot_dir, boot_script, boot_device_or_file): |
143 | + make_uImage(cls.load_addr, uboot_parts_dir, cls.sub_arch, boot_dir) |
144 | + make_uInitrd(uboot_parts_dir, cls.sub_arch, boot_dir) |
145 | + make_boot_script(boot_cmd, boot_script) |
146 | + make_boot_ini(boot_script, boot_dir) |
147 | + |
148 | |
149 | class Ux500Config(BoardConfig): |
150 | extra_serial_opts = 'console = tty0 console = ttyAMA2,115200n8' |
151 | @@ -111,6 +172,13 @@ |
152 | 'hwmem = 48M@302M mem = 152M@360M') |
153 | mmc_option = '1:1' |
154 | |
155 | + @classmethod |
156 | + def _make_boot_files(cls, uboot_parts_dir, boot_cmd, chroot_dir, |
157 | + boot_dir, boot_script, boot_device_or_file): |
158 | + make_uImage(cls.load_addr, uboot_parts_dir, cls.sub_arch, boot_dir) |
159 | + make_uInitrd(uboot_parts_dir, cls.sub_arch, boot_dir) |
160 | + make_boot_script(boot_cmd, boot_script) |
161 | + |
162 | |
163 | class Mx51evkConfig(BoardConfig): |
164 | extra_serial_opts = 'console = tty0 console = ttymxc0,115200n8' |
165 | @@ -123,6 +191,16 @@ |
166 | mmc_part_offset = 1 |
167 | mmc_option = '0:2' |
168 | |
169 | + @classmethod |
170 | + def _make_boot_files(cls, uboot_parts_dir, boot_cmd, chroot_dir, |
171 | + boot_dir, boot_script, boot_device_or_file): |
172 | + uboot_file = os.path.join( |
173 | + chroot_dir, 'usr', 'lib', 'u-boot', 'mx51evk', 'u-boot.imx') |
174 | + install_mx51evk_boot_loader(uboot_file, boot_device_or_file) |
175 | + make_uImage(cls.load_addr, uboot_parts_dir, cls.sub_arch, boot_dir) |
176 | + make_uInitrd(uboot_parts_dir, cls.sub_arch, boot_dir) |
177 | + make_boot_script(boot_cmd, boot_script) |
178 | + |
179 | |
180 | class VexpressConfig(BoardConfig): |
181 | uboot_flavor = 'ca9x4_ct_vxp' |
182 | @@ -137,6 +215,12 @@ |
183 | # only allows for FAT16 |
184 | fat_size = 16 |
185 | |
186 | + @classmethod |
187 | + def _make_boot_files(cls, uboot_parts_dir, boot_cmd, chroot_dir, |
188 | + boot_dir, boot_script): |
189 | + make_uImage(cls.load_addr, uboot_parts_dir, cls.sub_arch, boot_dir) |
190 | + make_uInitrd(uboot_parts_dir, cls.sub_arch, boot_dir) |
191 | + |
192 | |
193 | board_configs = { |
194 | 'beagle': BeagleConfig, |
195 | @@ -146,3 +230,86 @@ |
196 | 'ux500': Ux500Config, |
197 | 'mx51evk': Mx51evkConfig, |
198 | } |
199 | + |
200 | + |
201 | +def _run_mkimage(img_type, load_addr, entry_point, name, img_data, img, |
202 | + stdout=None, as_root=True): |
203 | + cmd = ['mkimage', |
204 | + '-A', 'arm', |
205 | + '-O', 'linux', |
206 | + '-T', img_type, |
207 | + '-C', 'none', |
208 | + '-a', load_addr, |
209 | + '-e', load_addr, |
210 | + '-n', name, |
211 | + '-d', img_data, |
212 | + img] |
213 | + proc = cmd_runner.run(cmd, as_root=as_root, stdout=stdout) |
214 | + proc.wait() |
215 | + return proc.returncode |
216 | + |
217 | + |
218 | +def _get_file_matching(regex): |
219 | + """Return a file whose path matches the given regex. |
220 | + |
221 | + If zero or more than one files match, raise a ValueError. |
222 | + """ |
223 | + files = glob.glob(regex) |
224 | + if len(files) == 1: |
225 | + return files[0] |
226 | + elif len(files) == 0: |
227 | + raise ValueError( |
228 | + "No files found matching '%s'; can't continue" % regex) |
229 | + else: |
230 | + # TODO: Could ask the user to chosse which file to use instead of |
231 | + # raising an exception. |
232 | + raise ValueError("Too many files matching '%s' found." % regex) |
233 | + |
234 | + |
235 | +def make_uImage(load_addr, uboot_parts_dir, sub_arch, boot_disk): |
236 | + img_data = _get_file_matching( |
237 | + '%s/vmlinuz-*-%s' % (uboot_parts_dir, sub_arch)) |
238 | + img = '%s/uImage' % boot_disk |
239 | + return _run_mkimage( |
240 | + 'kernel', load_addr, load_addr, 'Linux', img_data, img) |
241 | + |
242 | + |
243 | +def make_uInitrd(uboot_parts_dir, sub_arch, boot_disk): |
244 | + img_data = _get_file_matching( |
245 | + '%s/initrd.img-*-%s' % (uboot_parts_dir, sub_arch)) |
246 | + img = '%s/uInitrd' % boot_disk |
247 | + return _run_mkimage('ramdisk', '0', '0', 'initramfs', img_data, img) |
248 | + |
249 | + |
250 | +def make_boot_script(boot_script_data, boot_script): |
251 | + # Need to save the boot script data into a file that will be passed to |
252 | + # mkimage. |
253 | + _, tmpfile = tempfile.mkstemp() |
254 | + atexit.register(os.unlink, tmpfile) |
255 | + with open(tmpfile, 'w') as fd: |
256 | + fd.write(boot_script_data) |
257 | + return _run_mkimage( |
258 | + 'script', '0', '0', 'boot script', tmpfile, boot_script) |
259 | + |
260 | + |
261 | +def install_mx51evk_boot_loader(imx_file, boot_device_or_file): |
262 | + proc = cmd_runner.run([ |
263 | + "dd", |
264 | + "if=%s" % imx_file, |
265 | + "of=%s" % boot_device_or_file, |
266 | + "bs=1024", |
267 | + "seek=1", |
268 | + "conv=notrunc"], as_root=True) |
269 | + proc.wait() |
270 | + |
271 | + |
272 | +def install_omap_boot_loader(mlo_file, boot_disk): |
273 | + cmd_runner.run(["cp", "-v", mlo_file, boot_disk], as_root=True).wait() |
274 | + # XXX: Is this really needed? |
275 | + cmd_runner.run(["sync"]).wait() |
276 | + |
277 | + |
278 | +def make_boot_ini(boot_script, boot_disk): |
279 | + proc = cmd_runner.run( |
280 | + ["cp", "-v", boot_script, "%s/boot.ini" % boot_disk], as_root=True) |
281 | + proc.wait() |
282 | |
283 | === modified file 'linaro_media_create/populate_boot.py' |
284 | --- linaro_media_create/populate_boot.py 2011-01-13 01:04:08 +0000 |
285 | +++ linaro_media_create/populate_boot.py 2011-01-13 01:04:08 +0000 |
286 | @@ -1,94 +1,11 @@ |
287 | import errno |
288 | -import glob |
289 | import os |
290 | |
291 | from linaro_media_create import cmd_runner |
292 | |
293 | |
294 | -def _run_mkimage(img_type, load_addr, entry_point, name, img_data, img, |
295 | - stdout=None, as_root=True): |
296 | - cmd = ['mkimage', |
297 | - '-A', 'arm', |
298 | - '-O', 'linux', |
299 | - '-T', img_type, |
300 | - '-C', 'none', |
301 | - '-a', load_addr, |
302 | - '-e', load_addr, |
303 | - '-n', name, |
304 | - '-d', img_data, |
305 | - img] |
306 | - proc = cmd_runner.run(cmd, as_root=as_root, stdout=stdout) |
307 | - proc.wait() |
308 | - return proc.returncode |
309 | - |
310 | - |
311 | -def _get_file_matching(regex): |
312 | - """Return a file whose path matches the given regex. |
313 | - |
314 | - If zero or more than one files match, raise a ValueError. |
315 | - """ |
316 | - files = glob.glob(regex) |
317 | - if len(files) == 1: |
318 | - return files[0] |
319 | - elif len(files) == 0: |
320 | - raise ValueError( |
321 | - "No files found matching '%s'; can't continue" % regex) |
322 | - else: |
323 | - # TODO: Could ask the user to chosse which file to use instead of |
324 | - # raising an exception. |
325 | - raise ValueError("Too many files matching '%s' found." % regex) |
326 | - |
327 | - |
328 | -def make_uImage(load_addr, uboot_parts_dir, sub_arch, boot_disk): |
329 | - img_data = _get_file_matching( |
330 | - '%s/vmlinuz-*-%s' % (uboot_parts_dir, sub_arch)) |
331 | - img = '%s/uImage' % boot_disk |
332 | - return _run_mkimage( |
333 | - 'kernel', load_addr, load_addr, 'Linux', img_data, img) |
334 | - |
335 | - |
336 | -def make_uInitrd(uboot_parts_dir, sub_arch, boot_disk): |
337 | - img_data = _get_file_matching( |
338 | - '%s/initrd.img-*-%s' % (uboot_parts_dir, sub_arch)) |
339 | - img = '%s/uInitrd' % boot_disk |
340 | - return _run_mkimage('ramdisk', '0', '0', 'initramfs', img_data, img) |
341 | - |
342 | - |
343 | -def make_boot_script(boot_script_data, tmp_dir, boot_script): |
344 | - # Need to save the boot script data into a file that will be passed to |
345 | - # mkimage. |
346 | - data_file = '%s/boot.cmd' % tmp_dir |
347 | - with open(data_file, 'w') as fd: |
348 | - fd.write(boot_script_data) |
349 | - return _run_mkimage( |
350 | - 'script', '0', '0', 'boot script', data_file, boot_script) |
351 | - |
352 | - |
353 | -def install_mx51evk_boot_loader(imx_file, boot_device_or_file): |
354 | - proc = cmd_runner.run([ |
355 | - "dd", |
356 | - "if=%s" % imx_file, |
357 | - "of=%s" % boot_device_or_file, |
358 | - "bs=1024", |
359 | - "seek=1", |
360 | - "conv=notrunc"], as_root=True) |
361 | - proc.wait() |
362 | - |
363 | - |
364 | -def install_omap_boot_loader(mlo_file, boot_disk): |
365 | - cmd_runner.run(["cp", "-v", mlo_file, boot_disk], as_root=True).wait() |
366 | - # XXX: Is this really needed? |
367 | - cmd_runner.run(["sync"]).wait() |
368 | - |
369 | - |
370 | -def make_boot_ini(boot_script, boot_disk): |
371 | - proc = cmd_runner.run( |
372 | - ["cp", "-v", boot_script, "%s/boot.ini" % boot_disk], as_root=True) |
373 | - proc.wait() |
374 | - |
375 | - |
376 | -def populate_boot(board, board_config, chroot_dir, boot_partition, boot_disk, |
377 | - boot_device_or_file, tmp_dir, is_live, is_lowmem, consoles): |
378 | +def populate_boot(board_config, chroot_dir, boot_partition, boot_disk, |
379 | + boot_device_or_file, is_live, is_lowmem, consoles): |
380 | |
381 | parts_dir = 'boot' |
382 | if is_live: |
383 | @@ -115,50 +32,9 @@ |
384 | dict(boot_disk=boot_disk, |
385 | boot_script_name=board_config.boot_script)) |
386 | |
387 | - load_addr = board_config.load_addr |
388 | - sub_arch = board_config.sub_arch |
389 | - boot_cmd = board_config.get_boot_cmd(is_live, is_lowmem, consoles) |
390 | - |
391 | - # TODO: Once linaro-media-create is fully ported to python, we should |
392 | - # split this into several board-specific functions that are defined |
393 | - # somewhere else and just called here. |
394 | - if board in ["beagle", "panda"]: |
395 | - xloader_dir = 'x-loader-omap' |
396 | - if board == "panda": |
397 | - xloader_dir = 'x-loader-omap4' |
398 | - mlo_file = os.path.join( |
399 | - chroot_dir, 'usr', 'lib', xloader_dir, 'MLO') |
400 | - install_omap_boot_loader(mlo_file, boot_disk) |
401 | - make_uImage(load_addr, uboot_parts_dir, sub_arch, boot_disk) |
402 | - make_uInitrd(uboot_parts_dir, sub_arch, boot_disk) |
403 | - make_boot_script(boot_cmd, tmp_dir, boot_script) |
404 | - make_boot_ini(boot_script, boot_disk) |
405 | - |
406 | - elif board == "igep": |
407 | - make_uImage(load_addr, uboot_parts_dir, sub_arch, boot_disk) |
408 | - make_uInitrd(uboot_parts_dir, sub_arch, boot_disk) |
409 | - make_boot_script(boot_cmd, tmp_dir, boot_script) |
410 | - make_boot_ini(boot_script, boot_disk) |
411 | - |
412 | - elif board == "ux500": |
413 | - make_uImage(load_addr, uboot_parts_dir, sub_arch, boot_disk) |
414 | - make_uInitrd(uboot_parts_dir, sub_arch, boot_disk) |
415 | - make_boot_script(boot_cmd, tmp_dir, boot_script) |
416 | - |
417 | - elif board == "vexpress": |
418 | - make_uImage(load_addr, uboot_parts_dir, sub_arch, boot_disk) |
419 | - make_uInitrd(uboot_parts_dir, sub_arch, boot_disk) |
420 | - |
421 | - elif board == "mx51evk": |
422 | - install_mx51evk_boot_loader( |
423 | - "binary/usr/lib/u-boot/mx51evk/u-boot.imx", boot_device_or_file) |
424 | - make_uImage(load_addr, uboot_parts_dir, sub_arch, boot_disk) |
425 | - make_uInitrd(uboot_parts_dir, sub_arch, boot_disk) |
426 | - make_boot_script(boot_cmd, tmp_dir, boot_script) |
427 | - |
428 | - else: |
429 | - raise AssertionError( |
430 | - "Internal error; missing support for board: %s" % board) |
431 | + board_config.make_boot_files( |
432 | + uboot_parts_dir, is_live, is_lowmem, consoles, chroot_dir, boot_disk, |
433 | + boot_script, boot_device_or_file) |
434 | |
435 | cmd_runner.run(['sync']).wait() |
436 | try: |
437 | |
438 | === modified file 'linaro_media_create/tests/test_media_create.py' |
439 | --- linaro_media_create/tests/test_media_create.py 2011-01-13 01:04:08 +0000 |
440 | +++ linaro_media_create/tests/test_media_create.py 2011-01-13 01:04:08 +0000 |
441 | @@ -6,6 +6,7 @@ |
442 | import string |
443 | import subprocess |
444 | import sys |
445 | +import tempfile |
446 | import time |
447 | |
448 | from testtools import TestCase |
449 | @@ -16,13 +17,18 @@ |
450 | check_device, |
451 | cmd_runner, |
452 | ensure_command, |
453 | - populate_boot, |
454 | + boards, |
455 | partitions, |
456 | rootfs, |
457 | ) |
458 | from linaro_media_create.boards import ( |
459 | board_configs, |
460 | + make_boot_script, |
461 | + make_uImage, |
462 | + make_uInitrd, |
463 | ROOTFS_UUID, |
464 | + _get_file_matching, |
465 | + _run_mkimage, |
466 | ) |
467 | from linaro_media_create.hwpack import ( |
468 | copy_file, |
469 | @@ -43,13 +49,6 @@ |
470 | run_sfdisk_commands, |
471 | setup_partitions, |
472 | ) |
473 | -from linaro_media_create.populate_boot import ( |
474 | - make_boot_script, |
475 | - make_uImage, |
476 | - make_uInitrd, |
477 | - _get_file_matching, |
478 | - _run_mkimage, |
479 | - ) |
480 | from linaro_media_create.remove_binary_dir import remove_dir |
481 | from linaro_media_create.rootfs import ( |
482 | create_flash_kernel_config, |
483 | @@ -96,7 +95,7 @@ |
484 | class TestGetBootCmd(TestCase): |
485 | |
486 | def test_vexpress(self): |
487 | - boot_cmd = board_configs['vexpress'].get_boot_cmd( |
488 | + boot_cmd = board_configs['vexpress']._get_boot_cmd( |
489 | is_live=False, is_lowmem=False, consoles=None) |
490 | expected = ( |
491 | "setenv bootcmd 'fatload mmc 0:1 0x60008000 uImage; fatload mmc " |
492 | @@ -106,7 +105,7 @@ |
493 | self.assertEqual(expected, boot_cmd) |
494 | |
495 | def test_mx51evk(self): |
496 | - boot_cmd = board_configs['mx51evk'].get_boot_cmd( |
497 | + boot_cmd = board_configs['mx51evk']._get_boot_cmd( |
498 | is_live=False, is_lowmem=False, consoles=None) |
499 | expected = ( |
500 | "setenv bootcmd 'fatload mmc 0:2 0x90000000 uImage; fatload mmc " |
501 | @@ -116,7 +115,7 @@ |
502 | self.assertEqual(expected, boot_cmd) |
503 | |
504 | def test_ux500(self): |
505 | - boot_cmd = board_configs['ux500'].get_boot_cmd( |
506 | + boot_cmd = board_configs['ux500']._get_boot_cmd( |
507 | is_live=False, is_lowmem=False, consoles=None) |
508 | expected = ( |
509 | "setenv bootcmd 'fatload mmc 1:1 0x00100000 uImage; fatload mmc " |
510 | @@ -130,7 +129,7 @@ |
511 | self.assertEqual(expected, boot_cmd) |
512 | |
513 | def test_panda(self): |
514 | - boot_cmd = board_configs['panda'].get_boot_cmd( |
515 | + boot_cmd = board_configs['panda']._get_boot_cmd( |
516 | is_live=False, is_lowmem=False, consoles=None) |
517 | expected = ( |
518 | "setenv bootcmd 'fatload mmc 0:1 0x80200000 uImage; fatload mmc " |
519 | @@ -142,7 +141,7 @@ |
520 | self.assertEqual(expected, boot_cmd) |
521 | |
522 | def test_beagle(self): |
523 | - boot_cmd = board_configs['beagle'].get_boot_cmd( |
524 | + boot_cmd = board_configs['beagle']._get_boot_cmd( |
525 | is_live=False, is_lowmem=False, consoles=None) |
526 | expected = ( |
527 | "setenv bootcmd 'fatload mmc 0:1 0x80000000 uImage; " |
528 | @@ -229,7 +228,7 @@ |
529 | |
530 | def _mock_get_file_matching(self): |
531 | self.useFixture(MockSomethingFixture( |
532 | - populate_boot, '_get_file_matching', |
533 | + boards, '_get_file_matching', |
534 | lambda regex: regex)) |
535 | |
536 | def _mock_Popen(self): |
537 | @@ -258,14 +257,15 @@ |
538 | self.assertEqual([expected], fixture.mock.calls) |
539 | |
540 | def test_make_boot_script(self): |
541 | + self.useFixture(MockSomethingFixture( |
542 | + tempfile, 'mkstemp', lambda: (-1, '/tmp/random-abxzr'))) |
543 | self._mock_get_file_matching() |
544 | fixture = self._mock_Popen() |
545 | - tempdir = self.useFixture(CreateTempDirFixture()).tempdir |
546 | - make_boot_script('boot script data', tempdir, 'boot_script') |
547 | + make_boot_script('boot script data', 'boot_script') |
548 | expected = [ |
549 | 'sudo', 'mkimage', '-A', 'arm', '-O', 'linux', '-T', 'script', |
550 | '-C', 'none', '-a', '0', '-e', '0', '-n', 'boot script', |
551 | - '-d', '%s/boot.cmd' % tempdir, 'boot_script'] |
552 | + '-d', '/tmp/random-abxzr', 'boot_script'] |
553 | self.assertEqual([expected], fixture.mock.calls) |
554 | |
555 | def test_get_file_matching(self): |