Merge lp:~salgado/linaro-image-tools/config-class into lp:linaro-image-tools/11.11
- config-class
- Merge into trunk
Proposed by
Guilherme Salgado
Status: | Merged |
---|---|
Merged at revision: | 237 |
Proposed branch: | lp:~salgado/linaro-image-tools/config-class |
Merge into: | lp:linaro-image-tools/11.11 |
Diff against target: |
738 lines (+216/-391) 5 files modified
linaro-media-create (+9/-10) linaro_media_create/__init__.py (+5/-122) linaro_media_create/boards.py (+148/-0) linaro_media_create/populate_boot.py (+6/-6) linaro_media_create/tests/test_media_create.py (+48/-253) |
To merge this branch: | bzr merge lp:~salgado/linaro-image-tools/config-class |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
James Westby (community) | Approve | ||
Review via email: mp+46048@code.launchpad.net |
Commit message
Description of the change
Store board config in python classes. This will make it possible for us to
move the board-specific out of populate_boot.py and into boards.py, where all
board-specific stuff will live.
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-11 21:26:54 +0000 | |||
3 | +++ linaro-media-create 2011-01-12 21:58:47 +0000 | |||
4 | @@ -6,6 +6,10 @@ | |||
5 | 6 | import tempfile | 6 | import tempfile |
6 | 7 | from subprocess import Popen | 7 | from subprocess import Popen |
7 | 8 | 8 | ||
8 | 9 | from linaro_media_create.boards import ( | ||
9 | 10 | board_configs, | ||
10 | 11 | ROOTFS_UUID, | ||
11 | 12 | ) | ||
12 | 9 | from linaro_media_create.check_device import ( | 13 | from linaro_media_create.check_device import ( |
13 | 10 | confirm_device_selection_and_ensure_it_is_ready) | 14 | confirm_device_selection_and_ensure_it_is_ready) |
14 | 11 | from linaro_media_create.ensure_command import ensure_command | 15 | from linaro_media_create.ensure_command import ensure_command |
15 | @@ -18,11 +22,7 @@ | |||
16 | 18 | from linaro_media_create.remove_binary_dir import remove_dir | 22 | from linaro_media_create.remove_binary_dir import remove_dir |
17 | 19 | from linaro_media_create.rootfs import populate_rootfs | 23 | from linaro_media_create.rootfs import populate_rootfs |
18 | 20 | from linaro_media_create.unpack_binary_tarball import unpack_binary_tarball | 24 | from linaro_media_create.unpack_binary_tarball import unpack_binary_tarball |
24 | 21 | from linaro_media_create import ( | 25 | from linaro_media_create import get_args_parser |
20 | 22 | get_args_parser, | ||
21 | 23 | get_board_config, | ||
22 | 24 | ROOTFS_UUID, | ||
23 | 25 | ) | ||
25 | 26 | 26 | ||
26 | 27 | 27 | ||
27 | 28 | TMP_DIR = tempfile.mkdtemp() | 28 | TMP_DIR = tempfile.mkdtemp() |
28 | @@ -71,8 +71,7 @@ | |||
29 | 71 | if __name__ == '__main__': | 71 | if __name__ == '__main__': |
30 | 72 | parser = get_args_parser() | 72 | parser = get_args_parser() |
31 | 73 | args = parser.parse_args() | 73 | args = parser.parse_args() |
34 | 74 | board_config = get_board_config( | 74 | board_config = board_configs[args.board] |
33 | 75 | args.board, args.is_live, args.is_lowmem, args.consoles) | ||
35 | 76 | 75 | ||
36 | 77 | media = Media(args.device) | 76 | media = Media(args.device) |
37 | 78 | if media.is_block_device: | 77 | if media.is_block_device: |
38 | @@ -94,7 +93,7 @@ | |||
39 | 94 | install_hwpacks(ROOTFS_DIR, TMP_DIR, args.hwpack_force_yes, *hwpacks) | 93 | install_hwpacks(ROOTFS_DIR, TMP_DIR, args.hwpack_force_yes, *hwpacks) |
40 | 95 | 94 | ||
41 | 96 | boot_partition, root_partition = setup_partitions( | 95 | boot_partition, root_partition = setup_partitions( |
43 | 97 | args.board, media, board_config['fat_size'], args.image_size, | 96 | args.board, media, board_config.fat_size, args.image_size, |
44 | 98 | args.boot_label, args.rfs_label, args.rootfs, ROOTFS_UUID, | 97 | args.boot_label, args.rfs_label, args.rootfs, ROOTFS_UUID, |
45 | 99 | args.should_create_partitions, | 98 | args.should_create_partitions, |
46 | 100 | args.should_format_bootfs, args.should_format_rootfs) | 99 | args.should_format_bootfs, args.should_format_rootfs) |
47 | @@ -102,7 +101,7 @@ | |||
48 | 102 | if args.should_format_bootfs: | 101 | if args.should_format_bootfs: |
49 | 103 | populate_boot( | 102 | populate_boot( |
50 | 104 | args.board, board_config, ROOTFS_DIR, boot_partition, BOOT_DISK, | 103 | args.board, board_config, ROOTFS_DIR, boot_partition, BOOT_DISK, |
52 | 105 | args.device, TMP_DIR, args.is_live) | 104 | args.device, TMP_DIR, args.is_live, args.is_lowmem, args.consoles) |
53 | 106 | 105 | ||
54 | 107 | if args.should_format_rootfs: | 106 | if args.should_format_rootfs: |
55 | 108 | create_swap = False | 107 | create_swap = False |
56 | @@ -110,6 +109,6 @@ | |||
57 | 110 | create_swap = True | 109 | create_swap = True |
58 | 111 | populate_rootfs(ROOTFS_DIR, ROOT_DISK, root_partition, args.rootfs, | 110 | populate_rootfs(ROOTFS_DIR, ROOT_DISK, root_partition, args.rootfs, |
59 | 112 | ROOTFS_UUID, create_swap, str(args.swap_file), | 111 | ROOTFS_UUID, create_swap, str(args.swap_file), |
61 | 113 | board_config['mmc_part_offset']) | 112 | board_config.mmc_part_offset) |
62 | 114 | 113 | ||
63 | 115 | print "Done creating Linaro image on %s" % args.device | 114 | print "Done creating Linaro image on %s" % args.device |
64 | 116 | 115 | ||
65 | === modified file 'linaro_media_create/__init__.py' | |||
66 | --- linaro_media_create/__init__.py 2011-01-11 21:09:50 +0000 | |||
67 | +++ linaro_media_create/__init__.py 2011-01-12 21:58:47 +0000 | |||
68 | @@ -1,8 +1,9 @@ | |||
69 | 1 | import argparse | 1 | import argparse |
74 | 2 | import uuid | 2 | |
75 | 3 | 3 | from linaro_media_create.boards import board_configs | |
76 | 4 | ROOTFS_UUID = str(uuid.uuid4()) | 4 | |
77 | 5 | KNOWN_BOARDS = ['beagle', 'igep', 'mx51evk', 'panda', 'ux500', 'vexpress'] | 5 | |
78 | 6 | KNOWN_BOARDS = board_configs.keys() | ||
79 | 6 | 7 | ||
80 | 7 | 8 | ||
81 | 8 | class Live256MegsAction(argparse.Action): | 9 | class Live256MegsAction(argparse.Action): |
82 | @@ -87,121 +88,3 @@ | |||
83 | 87 | '--no-part', dest='should_create_partitions', action='store_false', | 88 | '--no-part', dest='should_create_partitions', action='store_false', |
84 | 88 | help='Reuse existing partitions on the given media.') | 89 | help='Reuse existing partitions on the given media.') |
85 | 89 | return parser | 90 | return parser |
86 | 90 | |||
87 | 91 | |||
88 | 92 | def get_board_config(board, is_live, is_lowmem, consoles): | ||
89 | 93 | """Return a dict containing the configs to create an image for a board. | ||
90 | 94 | |||
91 | 95 | :param args: An argparse.ArgumentParser object containing the arguments | ||
92 | 96 | passed to linaro-media-create. | ||
93 | 97 | """ | ||
94 | 98 | mmc_part_offset = 0 | ||
95 | 99 | mmc_option = '0:1' | ||
96 | 100 | boot_args_options = 'rootwait ro' | ||
97 | 101 | uboot_flavor = None | ||
98 | 102 | fat_size = 32 | ||
99 | 103 | serial_opts = '' | ||
100 | 104 | if consoles is not None: | ||
101 | 105 | for console in consoles: | ||
102 | 106 | serial_opts += ' console=%s' % console | ||
103 | 107 | |||
104 | 108 | # XXX: I think this is not needed as we have board-specific | ||
105 | 109 | # serial options for when is_live is true. | ||
106 | 110 | if is_live: | ||
107 | 111 | serial_opts += ' serialtty=ttyS2' | ||
108 | 112 | |||
109 | 113 | if board in ('beagle', 'igep'): | ||
110 | 114 | if board == 'beagle': | ||
111 | 115 | uboot_flavor = 'omap3_beagle' | ||
112 | 116 | serial_opts += ' console=tty0 console=ttyS2,115200n8' | ||
113 | 117 | live_serial_opts = 'serialtty=ttyS2' | ||
114 | 118 | kernel_addr = '0x80000000' | ||
115 | 119 | initrd_addr = '0x81600000' | ||
116 | 120 | load_addr = '0x80008000' | ||
117 | 121 | sub_arch = 'linaro-omap' | ||
118 | 122 | boot_script = 'boot.scr' | ||
119 | 123 | boot_args_options += ( | ||
120 | 124 | ' earlyprintk fixrtc nocompcache vram=12M omapfb.debug=y' | ||
121 | 125 | ' omapfb.mode=dvi:1280x720MR-16@60') | ||
122 | 126 | |||
123 | 127 | elif board == 'panda': | ||
124 | 128 | uboot_flavor = 'omap4_panda' | ||
125 | 129 | serial_opts += ' console = tty0 console = ttyO2,115200n8' | ||
126 | 130 | live_serial_opts = 'serialtty = ttyO2' | ||
127 | 131 | kernel_addr = '0x80200000' | ||
128 | 132 | initrd_addr = '0x81600000' | ||
129 | 133 | load_addr = '0x80008000' | ||
130 | 134 | sub_arch = 'omap4' | ||
131 | 135 | boot_script = 'boot.scr' | ||
132 | 136 | boot_args_options += ( | ||
133 | 137 | ' earlyprintk fixrtc nocompcache vram = 32M omapfb.debug = y' | ||
134 | 138 | ' omapfb.vram = 0:8M mem = 463M ip = none') | ||
135 | 139 | |||
136 | 140 | elif board == 'ux500': | ||
137 | 141 | serial_opts += ' console = tty0 console = ttyAMA2,115200n8' | ||
138 | 142 | live_serial_opts = 'serialtty = ttyAMA2' | ||
139 | 143 | kernel_addr = '0x00100000' | ||
140 | 144 | initrd_addr = '0x08000000' | ||
141 | 145 | load_addr = '0x00008000' | ||
142 | 146 | sub_arch = 'ux500' | ||
143 | 147 | boot_script = 'flash.scr' | ||
144 | 148 | boot_args_options += ( | ||
145 | 149 | ' earlyprintk rootdelay = 1 fixrtc nocompcache' | ||
146 | 150 | ' mem = 96M@0 mem_modem = 32M@96M mem = 44M@128M pmem = 22M@172M' | ||
147 | 151 | ' mem = 30M@194M mem_mali = 32M@224M pmem_hwb = 54M@256M' | ||
148 | 152 | ' hwmem = 48M@302M mem = 152M@360M') | ||
149 | 153 | mmc_option = '1:1' | ||
150 | 154 | |||
151 | 155 | elif board == 'mx51evk': | ||
152 | 156 | serial_opts += ' console = tty0 console = ttymxc0,115200n8' | ||
153 | 157 | live_serial_opts = 'serialtty = ttymxc0' | ||
154 | 158 | kernel_addr = '0x90000000' | ||
155 | 159 | initrd_addr = '0x90800000' | ||
156 | 160 | load_addr = '0x90008000' | ||
157 | 161 | sub_arch = 'linaro-mx51' | ||
158 | 162 | boot_script = 'boot.scr' | ||
159 | 163 | mmc_part_offset = 1 | ||
160 | 164 | mmc_option = '0:2' | ||
161 | 165 | |||
162 | 166 | elif board == 'vexpress': | ||
163 | 167 | uboot_flavor = 'ca9x4_ct_vxp' | ||
164 | 168 | serial_opts += ' console = tty0 console = ttyAMA0,38400n8' | ||
165 | 169 | live_serial_opts = 'serialtty = ttyAMA0' | ||
166 | 170 | kernel_addr = '0x60008000' | ||
167 | 171 | initrd_addr = '0x81000000' | ||
168 | 172 | load_addr = kernel_addr | ||
169 | 173 | sub_arch = 'linaro-vexpress' | ||
170 | 174 | boot_script = None | ||
171 | 175 | # ARM Boot Monitor is used to load u-boot, uImage etc. into flash and | ||
172 | 176 | # only allows for FAT16 | ||
173 | 177 | fat_size = 16 | ||
174 | 178 | |||
175 | 179 | else: | ||
176 | 180 | raise ValueError("Unkown board: %s" % board) | ||
177 | 181 | |||
178 | 182 | lowmem_opt = '' | ||
179 | 183 | boot_snippet = 'root=UUID=%s' % ROOTFS_UUID | ||
180 | 184 | if is_live: | ||
181 | 185 | serial_opts += ' %s' % live_serial_opts | ||
182 | 186 | boot_snippet = 'boot=casper' | ||
183 | 187 | if is_lowmem: | ||
184 | 188 | lowmem_opt = 'only-ubiquity' | ||
185 | 189 | |||
186 | 190 | boot_cmd = ( | ||
187 | 191 | "setenv bootcmd 'fatload mmc %(mmc_option)s %(kernel_addr)s " | ||
188 | 192 | "uImage; fatload mmc %(mmc_option)s %(initrd_addr)s uInitrd; " | ||
189 | 193 | "bootm %(kernel_addr)s %(initrd_addr)s'\n" | ||
190 | 194 | "setenv bootargs '%(serial_opts)s %(lowmem_opt)s " | ||
191 | 195 | "%(boot_snippet)s %(boot_args_options)s'\n" | ||
192 | 196 | "boot" % vars()) | ||
193 | 197 | |||
194 | 198 | # Instead of constructing a dict here, we could create a separate class | ||
195 | 199 | # for the config of every board, with the varying bits stored as class | ||
196 | 200 | # variables. At this point I don't see much advantage in doing that, | ||
197 | 201 | # though. | ||
198 | 202 | return dict( | ||
199 | 203 | kernel_addr=kernel_addr, initrd_addr=initrd_addr, load_addr=load_addr, | ||
200 | 204 | sub_arch=sub_arch, boot_script=boot_script, fat_size=fat_size, | ||
201 | 205 | boot_args_options=boot_args_options, serial_opts=serial_opts, | ||
202 | 206 | uboot_flavor=uboot_flavor, mmc_part_offset=mmc_part_offset, | ||
203 | 207 | mmc_option=mmc_option, boot_cmd=boot_cmd) | ||
204 | 208 | 91 | ||
205 | === added file 'linaro_media_create/boards.py' | |||
206 | --- linaro_media_create/boards.py 1970-01-01 00:00:00 +0000 | |||
207 | +++ linaro_media_create/boards.py 2011-01-12 21:58:47 +0000 | |||
208 | @@ -0,0 +1,148 @@ | |||
209 | 1 | """Configuration for boards supported by linaro-media-create. | ||
210 | 2 | |||
211 | 3 | To add support for a new board, you just need to create a subclass of | ||
212 | 4 | BoardConfig and set appropriate values for its variables. | ||
213 | 5 | """ | ||
214 | 6 | |||
215 | 7 | import uuid | ||
216 | 8 | |||
217 | 9 | ROOTFS_UUID = str(uuid.uuid4()) | ||
218 | 10 | |||
219 | 11 | |||
220 | 12 | class BoardConfig(object): | ||
221 | 13 | """The configuration used when building an image for a board.""" | ||
222 | 14 | uboot_flavor = None | ||
223 | 15 | mmc_option = '0:1' | ||
224 | 16 | mmc_part_offset = 0 | ||
225 | 17 | extra_serial_opts = None | ||
226 | 18 | live_serial_opts = None | ||
227 | 19 | kernel_addr = None | ||
228 | 20 | initrd_addr = None | ||
229 | 21 | load_addr = None | ||
230 | 22 | sub_arch = None | ||
231 | 23 | boot_script = None | ||
232 | 24 | extra_boot_args_options = None | ||
233 | 25 | fat_size = 32 | ||
234 | 26 | |||
235 | 27 | @classmethod | ||
236 | 28 | def get_boot_cmd(cls, is_live, is_lowmem, consoles): | ||
237 | 29 | """Get the boot command for this board.""" | ||
238 | 30 | boot_args_options = 'rootwait ro' | ||
239 | 31 | if cls.extra_boot_args_options: | ||
240 | 32 | boot_args_options += " %s" % cls.extra_boot_args_options | ||
241 | 33 | serial_opts = '' | ||
242 | 34 | if consoles is not None: | ||
243 | 35 | for console in consoles: | ||
244 | 36 | serial_opts += ' console=%s' % console | ||
245 | 37 | |||
246 | 38 | # XXX: I think this is not needed as we have board-specific | ||
247 | 39 | # serial options for when is_live is true. | ||
248 | 40 | if is_live: | ||
249 | 41 | serial_opts += ' serialtty=ttyS2' | ||
250 | 42 | |||
251 | 43 | serial_opts += ' %s' % cls.extra_serial_opts | ||
252 | 44 | |||
253 | 45 | lowmem_opt = '' | ||
254 | 46 | boot_snippet = 'root=UUID=%s' % ROOTFS_UUID | ||
255 | 47 | if is_live: | ||
256 | 48 | serial_opts += ' %s' % cls.live_serial_opts | ||
257 | 49 | boot_snippet = 'boot=casper' | ||
258 | 50 | if is_lowmem: | ||
259 | 51 | lowmem_opt = 'only-ubiquity' | ||
260 | 52 | |||
261 | 53 | replacements = dict( | ||
262 | 54 | mmc_option=cls.mmc_option, kernel_addr=cls.kernel_addr, | ||
263 | 55 | initrd_addr=cls.initrd_addr, serial_opts=serial_opts, | ||
264 | 56 | lowmem_opt=lowmem_opt, boot_snippet=boot_snippet, | ||
265 | 57 | boot_args_options=boot_args_options) | ||
266 | 58 | return ( | ||
267 | 59 | "setenv bootcmd 'fatload mmc %(mmc_option)s %(kernel_addr)s " | ||
268 | 60 | "uImage; fatload mmc %(mmc_option)s %(initrd_addr)s uInitrd; " | ||
269 | 61 | "bootm %(kernel_addr)s %(initrd_addr)s'\n" | ||
270 | 62 | "setenv bootargs '%(serial_opts)s %(lowmem_opt)s " | ||
271 | 63 | "%(boot_snippet)s %(boot_args_options)s'\n" | ||
272 | 64 | "boot" % replacements) | ||
273 | 65 | |||
274 | 66 | |||
275 | 67 | class BeagleConfig(BoardConfig): | ||
276 | 68 | uboot_flavor = 'omap3_beagle' | ||
277 | 69 | extra_serial_opts = 'console=tty0 console=ttyS2,115200n8' | ||
278 | 70 | live_serial_opts = 'serialtty=ttyS2' | ||
279 | 71 | kernel_addr = '0x80000000' | ||
280 | 72 | initrd_addr = '0x81600000' | ||
281 | 73 | load_addr = '0x80008000' | ||
282 | 74 | sub_arch = 'linaro-omap' | ||
283 | 75 | boot_script = 'boot.scr' | ||
284 | 76 | extra_boot_args_options = ( | ||
285 | 77 | 'earlyprintk fixrtc nocompcache vram=12M omapfb.debug=y ' | ||
286 | 78 | 'omapfb.mode=dvi:1280x720MR-16@60') | ||
287 | 79 | |||
288 | 80 | |||
289 | 81 | class PandaConfig(BoardConfig): | ||
290 | 82 | uboot_flavor = 'omap4_panda' | ||
291 | 83 | extra_serial_opts = 'console = tty0 console = ttyO2,115200n8' | ||
292 | 84 | live_serial_opts = 'serialtty = ttyO2' | ||
293 | 85 | kernel_addr = '0x80200000' | ||
294 | 86 | initrd_addr = '0x81600000' | ||
295 | 87 | load_addr = '0x80008000' | ||
296 | 88 | sub_arch = 'omap4' | ||
297 | 89 | boot_script = 'boot.scr' | ||
298 | 90 | extra_boot_args_options = ( | ||
299 | 91 | 'earlyprintk fixrtc nocompcache vram = 32M omapfb.debug = y ' | ||
300 | 92 | 'omapfb.vram = 0:8M mem = 463M ip = none') | ||
301 | 93 | |||
302 | 94 | |||
303 | 95 | class IgepConfig(BeagleConfig): | ||
304 | 96 | uboot_flavor = None | ||
305 | 97 | |||
306 | 98 | |||
307 | 99 | class Ux500Config(BoardConfig): | ||
308 | 100 | extra_serial_opts = 'console = tty0 console = ttyAMA2,115200n8' | ||
309 | 101 | live_serial_opts = 'serialtty = ttyAMA2' | ||
310 | 102 | kernel_addr = '0x00100000' | ||
311 | 103 | initrd_addr = '0x08000000' | ||
312 | 104 | load_addr = '0x00008000' | ||
313 | 105 | sub_arch = 'ux500' | ||
314 | 106 | boot_script = 'flash.scr' | ||
315 | 107 | extra_boot_args_options = ( | ||
316 | 108 | 'earlyprintk rootdelay = 1 fixrtc nocompcache ' | ||
317 | 109 | 'mem = 96M@0 mem_modem = 32M@96M mem = 44M@128M pmem = 22M@172M ' | ||
318 | 110 | 'mem = 30M@194M mem_mali = 32M@224M pmem_hwb = 54M@256M ' | ||
319 | 111 | 'hwmem = 48M@302M mem = 152M@360M') | ||
320 | 112 | mmc_option = '1:1' | ||
321 | 113 | |||
322 | 114 | |||
323 | 115 | class Mx51evkConfig(BoardConfig): | ||
324 | 116 | extra_serial_opts = 'console = tty0 console = ttymxc0,115200n8' | ||
325 | 117 | live_serial_opts = 'serialtty = ttymxc0' | ||
326 | 118 | kernel_addr = '0x90000000' | ||
327 | 119 | initrd_addr = '0x90800000' | ||
328 | 120 | load_addr = '0x90008000' | ||
329 | 121 | sub_arch = 'linaro-mx51' | ||
330 | 122 | boot_script = 'boot.scr' | ||
331 | 123 | mmc_part_offset = 1 | ||
332 | 124 | mmc_option = '0:2' | ||
333 | 125 | |||
334 | 126 | |||
335 | 127 | class VexpressConfig(BoardConfig): | ||
336 | 128 | uboot_flavor = 'ca9x4_ct_vxp' | ||
337 | 129 | extra_serial_opts = 'console = tty0 console = ttyAMA0,38400n8' | ||
338 | 130 | live_serial_opts = 'serialtty = ttyAMA0' | ||
339 | 131 | kernel_addr = '0x60008000' | ||
340 | 132 | initrd_addr = '0x81000000' | ||
341 | 133 | load_addr = kernel_addr | ||
342 | 134 | sub_arch = 'linaro-vexpress' | ||
343 | 135 | boot_script = None | ||
344 | 136 | # ARM Boot Monitor is used to load u-boot, uImage etc. into flash and | ||
345 | 137 | # only allows for FAT16 | ||
346 | 138 | fat_size = 16 | ||
347 | 139 | |||
348 | 140 | |||
349 | 141 | board_configs = { | ||
350 | 142 | 'beagle': BeagleConfig, | ||
351 | 143 | 'igep': IgepConfig, | ||
352 | 144 | 'panda': PandaConfig, | ||
353 | 145 | 'vexpress': VexpressConfig, | ||
354 | 146 | 'ux500': Ux500Config, | ||
355 | 147 | 'mx51evk': Mx51evkConfig, | ||
356 | 148 | } | ||
357 | 0 | 149 | ||
358 | === removed file 'linaro_media_create/boot_cmd.py' | |||
359 | === modified file 'linaro_media_create/populate_boot.py' | |||
360 | --- linaro_media_create/populate_boot.py 2011-01-11 21:26:54 +0000 | |||
361 | +++ linaro_media_create/populate_boot.py 2011-01-12 21:58:47 +0000 | |||
362 | @@ -88,7 +88,7 @@ | |||
363 | 88 | 88 | ||
364 | 89 | 89 | ||
365 | 90 | def populate_boot(board, board_config, chroot_dir, boot_partition, boot_disk, | 90 | def populate_boot(board, board_config, chroot_dir, boot_partition, boot_disk, |
367 | 91 | boot_device_or_file, tmp_dir, is_live): | 91 | boot_device_or_file, tmp_dir, is_live, is_lowmem, consoles): |
368 | 92 | 92 | ||
369 | 93 | parts_dir = 'boot' | 93 | parts_dir = 'boot' |
370 | 94 | if is_live: | 94 | if is_live: |
371 | @@ -104,7 +104,7 @@ | |||
372 | 104 | raise | 104 | raise |
373 | 105 | cmd_runner.run(['mount', boot_partition, boot_disk], as_root=True).wait() | 105 | cmd_runner.run(['mount', boot_partition, boot_disk], as_root=True).wait() |
374 | 106 | 106 | ||
376 | 107 | uboot_flavor = board_config.get('uboot_flavor') | 107 | uboot_flavor = board_config.uboot_flavor |
377 | 108 | if uboot_flavor is not None: | 108 | if uboot_flavor is not None: |
378 | 109 | uboot_bin = os.path.join( | 109 | uboot_bin = os.path.join( |
379 | 110 | chroot_dir, 'usr', 'lib', 'u-boot', uboot_flavor, 'u-boot.bin') | 110 | chroot_dir, 'usr', 'lib', 'u-boot', uboot_flavor, 'u-boot.bin') |
380 | @@ -113,11 +113,11 @@ | |||
381 | 113 | 113 | ||
382 | 114 | boot_script = "%(boot_disk)s/%(boot_script_name)s" % ( | 114 | boot_script = "%(boot_disk)s/%(boot_script_name)s" % ( |
383 | 115 | dict(boot_disk=boot_disk, | 115 | dict(boot_disk=boot_disk, |
385 | 116 | boot_script_name=board_config['boot_script'])) | 116 | boot_script_name=board_config.boot_script)) |
386 | 117 | 117 | ||
390 | 118 | load_addr = board_config['load_addr'] | 118 | load_addr = board_config.load_addr |
391 | 119 | sub_arch = board_config['sub_arch'] | 119 | sub_arch = board_config.sub_arch |
392 | 120 | boot_cmd = board_config['boot_cmd'] | 120 | boot_cmd = board_config.get_boot_cmd(is_live, is_lowmem, consoles) |
393 | 121 | 121 | ||
394 | 122 | # TODO: Once linaro-media-create is fully ported to python, we should | 122 | # TODO: Once linaro-media-create is fully ported to python, we should |
395 | 123 | # split this into several board-specific functions that are defined | 123 | # split this into several board-specific functions that are defined |
396 | 124 | 124 | ||
397 | === modified file 'linaro_media_create/tests/test_media_create.py' | |||
398 | --- linaro_media_create/tests/test_media_create.py 2011-01-11 21:26:54 +0000 | |||
399 | +++ linaro_media_create/tests/test_media_create.py 2011-01-12 21:58:47 +0000 | |||
400 | @@ -9,7 +9,6 @@ | |||
401 | 9 | import time | 9 | import time |
402 | 10 | 10 | ||
403 | 11 | from testtools import TestCase | 11 | from testtools import TestCase |
404 | 12 | from testtools.matchers import Mismatch | ||
405 | 13 | 12 | ||
406 | 14 | from hwpack.testing import TestCaseWithFixtures | 13 | from hwpack.testing import TestCaseWithFixtures |
407 | 15 | 14 | ||
408 | @@ -17,10 +16,12 @@ | |||
409 | 17 | check_device, | 16 | check_device, |
410 | 18 | cmd_runner, | 17 | cmd_runner, |
411 | 19 | ensure_command, | 18 | ensure_command, |
412 | 20 | get_board_config, | ||
413 | 21 | populate_boot, | 19 | populate_boot, |
414 | 22 | partitions, | 20 | partitions, |
415 | 23 | rootfs, | 21 | rootfs, |
416 | 22 | ) | ||
417 | 23 | from linaro_media_create.boards import ( | ||
418 | 24 | board_configs, | ||
419 | 24 | ROOTFS_UUID, | 25 | ROOTFS_UUID, |
420 | 25 | ) | 26 | ) |
421 | 26 | from linaro_media_create.hwpack import ( | 27 | from linaro_media_create.hwpack import ( |
422 | @@ -92,110 +93,32 @@ | |||
423 | 92 | ensure_command.apt_get_install = orig_func | 93 | ensure_command.apt_get_install = orig_func |
424 | 93 | 94 | ||
425 | 94 | 95 | ||
530 | 95 | class IsEqualToDict(object): | 96 | class TestGetBootCmd(TestCase): |
531 | 96 | """A testtools matcher to compare dicts. | 97 | |
532 | 97 | 98 | def test_vexpress(self): | |
533 | 98 | When there are differences, only the differing keys/values are shown. | 99 | boot_cmd = board_configs['vexpress'].get_boot_cmd( |
534 | 99 | """ | 100 | is_live=False, is_lowmem=False, consoles=None) |
535 | 100 | 101 | expected = ( | |
536 | 101 | def __init__(self, expected): | 102 | "setenv bootcmd 'fatload mmc 0:1 0x60008000 uImage; fatload mmc " |
537 | 102 | self.expected = expected | 103 | "0:1 0x81000000 uInitrd; bootm 0x60008000 0x81000000'\nsetenv " |
538 | 103 | 104 | "bootargs ' console = tty0 console = ttyAMA0,38400n8 " | |
539 | 104 | def match(self, actual): | 105 | "root=UUID=%s rootwait ro'\nboot" % ROOTFS_UUID) |
540 | 105 | actual_keys = set(actual.keys()) | 106 | self.assertEqual(expected, boot_cmd) |
541 | 106 | expected_keys = set(self.expected.keys()) | 107 | |
542 | 107 | instersection = actual_keys.intersection(expected_keys) | 108 | def test_mx51evk(self): |
543 | 108 | expected_only_keys = expected_keys.difference(actual_keys) | 109 | boot_cmd = board_configs['mx51evk'].get_boot_cmd( |
544 | 109 | actual_only_keys = actual_keys.difference(expected_keys) | 110 | is_live=False, is_lowmem=False, consoles=None) |
545 | 110 | keys_with_differing_values = [] | 111 | expected = ( |
546 | 111 | for key in instersection: | 112 | "setenv bootcmd 'fatload mmc 0:2 0x90000000 uImage; fatload mmc " |
547 | 112 | if actual[key] != self.expected[key]: | 113 | "0:2 0x90800000 uInitrd; bootm 0x90000000 0x90800000'\nsetenv " |
548 | 113 | keys_with_differing_values.append(key) | 114 | "bootargs ' console = tty0 console = ttymxc0,115200n8 " |
549 | 114 | 115 | "root=UUID=%s rootwait ro'\nboot" % ROOTFS_UUID) | |
550 | 115 | if (len(expected_only_keys) == 0 and len(actual_only_keys) == 0 | 116 | self.assertEqual(expected, boot_cmd) |
551 | 116 | and len(keys_with_differing_values) == 0): | 117 | |
552 | 117 | return None | 118 | def test_ux500(self): |
553 | 118 | 119 | boot_cmd = board_configs['ux500'].get_boot_cmd( | |
554 | 119 | expected_diffs = [] | 120 | is_live=False, is_lowmem=False, consoles=None) |
555 | 120 | for key in keys_with_differing_values + list(expected_only_keys): | 121 | expected = ( |
452 | 121 | expected_diffs.append("%s: %r" % (key, self.expected[key])) | ||
453 | 122 | expected_diffs = "\n".join(expected_diffs) | ||
454 | 123 | |||
455 | 124 | actual_diffs = [] | ||
456 | 125 | for key in keys_with_differing_values + list(actual_only_keys): | ||
457 | 126 | actual_diffs.append("%s: %r" % (key, actual[key])) | ||
458 | 127 | actual_diffs = "\n".join(actual_diffs) | ||
459 | 128 | |||
460 | 129 | mismatch_string = "\na = %s\n" % expected_diffs | ||
461 | 130 | mismatch_string += "=" * 60 + "\n" | ||
462 | 131 | mismatch_string += "b = %s" % actual_diffs | ||
463 | 132 | return IsEqualToDictMismatch(self.expected, mismatch_string, actual) | ||
464 | 133 | |||
465 | 134 | |||
466 | 135 | class IsEqualToDictMismatch(Mismatch): | ||
467 | 136 | |||
468 | 137 | def __init__(self, expected, mismatch_string, other): | ||
469 | 138 | self.expected = expected | ||
470 | 139 | self._mismatch_string = mismatch_string | ||
471 | 140 | self.other = other | ||
472 | 141 | |||
473 | 142 | def describe(self): | ||
474 | 143 | return self._mismatch_string | ||
475 | 144 | |||
476 | 145 | |||
477 | 146 | class TestGetBoardConfig(TestCase): | ||
478 | 147 | |||
479 | 148 | expected_beagle_config = { | ||
480 | 149 | 'boot_cmd': ( | ||
481 | 150 | "setenv bootcmd 'fatload mmc 0:1 0x80000000 uImage; " | ||
482 | 151 | "fatload mmc 0:1 0x81600000 uInitrd; bootm 0x80000000 " | ||
483 | 152 | "0x81600000'\nsetenv bootargs ' console=tty0 " | ||
484 | 153 | "console=ttyS2,115200n8 root=UUID=%s rootwait ro earlyprintk " | ||
485 | 154 | "fixrtc nocompcache vram=12M omapfb.debug=y " | ||
486 | 155 | "omapfb.mode=dvi:1280x720MR-16@60'\nboot" % ROOTFS_UUID), | ||
487 | 156 | 'boot_args_options': ( | ||
488 | 157 | 'rootwait ro earlyprintk fixrtc nocompcache vram=12M ' | ||
489 | 158 | 'omapfb.debug=y omapfb.mode=dvi:1280x720MR-16@60'), | ||
490 | 159 | 'boot_script': 'boot.scr', | ||
491 | 160 | 'fat_size': 32, | ||
492 | 161 | 'initrd_addr': '0x81600000', | ||
493 | 162 | 'kernel_addr': '0x80000000', | ||
494 | 163 | 'load_addr': '0x80008000', | ||
495 | 164 | 'mmc_option': '0:1', | ||
496 | 165 | 'mmc_part_offset': 0, | ||
497 | 166 | 'serial_opts': ' console=tty0 console=ttyS2,115200n8', | ||
498 | 167 | 'sub_arch': 'linaro-omap', | ||
499 | 168 | 'uboot_flavor': 'omap3_beagle'} | ||
500 | 169 | |||
501 | 170 | expected_panda_config = { | ||
502 | 171 | 'boot_cmd': ( | ||
503 | 172 | "setenv bootcmd 'fatload mmc 0:1 0x80200000 uImage; fatload mmc " | ||
504 | 173 | "0:1 0x81600000 uInitrd; bootm 0x80200000 0x81600000'\nsetenv " | ||
505 | 174 | "bootargs ' console = tty0 console = ttyO2,115200n8 " | ||
506 | 175 | "root=UUID=%s rootwait ro earlyprintk fixrtc nocompcache " | ||
507 | 176 | "vram = 32M omapfb.debug = y omapfb.vram = 0:8M mem = 463M " | ||
508 | 177 | "ip = none'\nboot" % ROOTFS_UUID), | ||
509 | 178 | 'boot_args_options': ( | ||
510 | 179 | 'rootwait ro earlyprintk fixrtc nocompcache vram = 32M ' | ||
511 | 180 | 'omapfb.debug = y omapfb.vram = 0:8M mem = 463M ip = none'), | ||
512 | 181 | 'boot_script': 'boot.scr', | ||
513 | 182 | 'fat_size': 32, | ||
514 | 183 | 'initrd_addr': '0x81600000', | ||
515 | 184 | 'kernel_addr': '0x80200000', | ||
516 | 185 | 'load_addr': '0x80008000', | ||
517 | 186 | 'mmc_option': '0:1', | ||
518 | 187 | 'mmc_part_offset': 0, | ||
519 | 188 | 'serial_opts': ' console = tty0 console = ttyO2,115200n8', | ||
520 | 189 | 'sub_arch': 'omap4', | ||
521 | 190 | 'uboot_flavor': 'omap4_panda'} | ||
522 | 191 | |||
523 | 192 | expected_ux500_config = { | ||
524 | 193 | 'boot_args_options': ( | ||
525 | 194 | 'rootwait ro earlyprintk rootdelay = 1 fixrtc nocompcache ' | ||
526 | 195 | 'mem = 96M@0 mem_modem = 32M@96M mem = 44M@128M pmem = 22M@172M ' | ||
527 | 196 | 'mem = 30M@194M mem_mali = 32M@224M pmem_hwb = 54M@256M ' | ||
528 | 197 | 'hwmem = 48M@302M mem = 152M@360M'), | ||
529 | 198 | 'boot_cmd': ( | ||
556 | 199 | "setenv bootcmd 'fatload mmc 1:1 0x00100000 uImage; fatload mmc " | 122 | "setenv bootcmd 'fatload mmc 1:1 0x00100000 uImage; fatload mmc " |
557 | 200 | "1:1 0x08000000 uInitrd; bootm 0x00100000 0x08000000'\nsetenv " | 123 | "1:1 0x08000000 uInitrd; bootm 0x00100000 0x08000000'\nsetenv " |
558 | 201 | "bootargs ' console = tty0 console = ttyAMA2,115200n8 " | 124 | "bootargs ' console = tty0 console = ttyAMA2,115200n8 " |
559 | @@ -203,160 +126,32 @@ | |||
560 | 203 | "nocompcache mem = 96M@0 mem_modem = 32M@96M mem = 44M@128M " | 126 | "nocompcache mem = 96M@0 mem_modem = 32M@96M mem = 44M@128M " |
561 | 204 | "pmem = 22M@172M mem = 30M@194M mem_mali = 32M@224M " | 127 | "pmem = 22M@172M mem = 30M@194M mem_mali = 32M@224M " |
562 | 205 | "pmem_hwb = 54M@256M hwmem = 48M@302M mem = 152M@360M'\nboot" | 128 | "pmem_hwb = 54M@256M hwmem = 48M@302M mem = 152M@360M'\nboot" |
675 | 206 | % ROOTFS_UUID), | 129 | % ROOTFS_UUID) |
676 | 207 | 'boot_script': 'flash.scr', | 130 | self.assertEqual(expected, boot_cmd) |
565 | 208 | 'fat_size': 32, | ||
566 | 209 | 'initrd_addr': '0x08000000', | ||
567 | 210 | 'kernel_addr': '0x00100000', | ||
568 | 211 | 'load_addr': '0x00008000', | ||
569 | 212 | 'mmc_option': '1:1', | ||
570 | 213 | 'mmc_part_offset': 0, | ||
571 | 214 | 'serial_opts': ' console = tty0 console = ttyAMA2,115200n8', | ||
572 | 215 | 'sub_arch': 'ux500', | ||
573 | 216 | 'uboot_flavor': None} | ||
574 | 217 | |||
575 | 218 | expected_vexpress_config = { | ||
576 | 219 | 'boot_args_options': 'rootwait ro', | ||
577 | 220 | 'boot_cmd': ( | ||
578 | 221 | "setenv bootcmd 'fatload mmc 0:1 0x60008000 uImage; fatload mmc " | ||
579 | 222 | "0:1 0x81000000 uInitrd; bootm 0x60008000 0x81000000'\nsetenv " | ||
580 | 223 | "bootargs ' console = tty0 console = ttyAMA0,38400n8 " | ||
581 | 224 | "root=UUID=%s rootwait ro'\nboot" % ROOTFS_UUID), | ||
582 | 225 | 'boot_script': None, | ||
583 | 226 | 'fat_size': 16, | ||
584 | 227 | 'initrd_addr': '0x81000000', | ||
585 | 228 | 'kernel_addr': '0x60008000', | ||
586 | 229 | 'load_addr': '0x60008000', | ||
587 | 230 | 'mmc_option': '0:1', | ||
588 | 231 | 'mmc_part_offset': 0, | ||
589 | 232 | 'serial_opts': ' console = tty0 console = ttyAMA0,38400n8', | ||
590 | 233 | 'sub_arch': 'linaro-vexpress', | ||
591 | 234 | 'uboot_flavor': 'ca9x4_ct_vxp'} | ||
592 | 235 | |||
593 | 236 | expected_mx51evk_config = { | ||
594 | 237 | 'boot_args_options': 'rootwait ro', | ||
595 | 238 | 'boot_cmd': ( | ||
596 | 239 | "setenv bootcmd 'fatload mmc 0:2 0x90000000 uImage; fatload mmc " | ||
597 | 240 | "0:2 0x90800000 uInitrd; bootm 0x90000000 0x90800000'\nsetenv " | ||
598 | 241 | "bootargs ' console = tty0 console = ttymxc0,115200n8 " | ||
599 | 242 | "root=UUID=%s rootwait ro'\nboot" % ROOTFS_UUID), | ||
600 | 243 | 'boot_script': 'boot.scr', | ||
601 | 244 | 'fat_size': 32, | ||
602 | 245 | 'initrd_addr': '0x90800000', | ||
603 | 246 | 'kernel_addr': '0x90000000', | ||
604 | 247 | 'load_addr': '0x90008000', | ||
605 | 248 | 'mmc_option': '0:2', | ||
606 | 249 | 'mmc_part_offset': 1, | ||
607 | 250 | 'serial_opts': ' console = tty0 console = ttymxc0,115200n8', | ||
608 | 251 | 'sub_arch': 'linaro-mx51', | ||
609 | 252 | 'uboot_flavor': None} | ||
610 | 253 | |||
611 | 254 | def test_unknown_board(self): | ||
612 | 255 | self.assertRaises( | ||
613 | 256 | ValueError, get_board_config, 'foobar', is_live=True, | ||
614 | 257 | is_lowmem=False, consoles=None) | ||
615 | 258 | |||
616 | 259 | def test_vexpress_live(self): | ||
617 | 260 | config = get_board_config( | ||
618 | 261 | 'vexpress', is_live=True, is_lowmem=False, consoles=None) | ||
619 | 262 | expected = self.expected_vexpress_config.copy() | ||
620 | 263 | expected['boot_cmd'] = ( | ||
621 | 264 | "setenv bootcmd 'fatload mmc 0:1 0x60008000 uImage; fatload mmc " | ||
622 | 265 | "0:1 0x81000000 uInitrd; bootm 0x60008000 0x81000000'\nsetenv " | ||
623 | 266 | "bootargs ' console = tty0 console = ttyAMA0,38400n8 " | ||
624 | 267 | "serialtty = ttyAMA0 boot=casper rootwait ro'\nboot") | ||
625 | 268 | expected['serial_opts'] = ( | ||
626 | 269 | ' console = tty0 console = ttyAMA0,38400n8 serialtty = ttyAMA0') | ||
627 | 270 | self.assertThat(expected, IsEqualToDict(config)) | ||
628 | 271 | |||
629 | 272 | def test_vexpress(self): | ||
630 | 273 | config = get_board_config( | ||
631 | 274 | 'vexpress', is_live=False, is_lowmem=False, consoles=None) | ||
632 | 275 | self.assertThat(self.expected_vexpress_config, IsEqualToDict(config)) | ||
633 | 276 | |||
634 | 277 | def test_mx51evk_live(self): | ||
635 | 278 | config = get_board_config( | ||
636 | 279 | 'mx51evk', is_live=True, is_lowmem=False, consoles=None) | ||
637 | 280 | expected = self.expected_mx51evk_config.copy() | ||
638 | 281 | expected['boot_cmd'] = ( | ||
639 | 282 | "setenv bootcmd 'fatload mmc 0:2 0x90000000 uImage; " | ||
640 | 283 | "fatload mmc 0:2 0x90800000 uInitrd; bootm 0x90000000 " | ||
641 | 284 | "0x90800000'\nsetenv bootargs ' console = tty0 " | ||
642 | 285 | "console = ttymxc0,115200n8 serialtty = ttymxc0 boot=casper " | ||
643 | 286 | "rootwait ro'\nboot") | ||
644 | 287 | expected['serial_opts'] = ( | ||
645 | 288 | ' console = tty0 console = ttymxc0,115200n8 serialtty = ttymxc0') | ||
646 | 289 | self.assertThat(expected, IsEqualToDict(config)) | ||
647 | 290 | |||
648 | 291 | def test_mx51evk(self): | ||
649 | 292 | config = get_board_config( | ||
650 | 293 | 'mx51evk', is_live=False, is_lowmem=False, consoles=None) | ||
651 | 294 | self.assertThat(self.expected_mx51evk_config, IsEqualToDict(config)) | ||
652 | 295 | |||
653 | 296 | def test_ux500_live(self): | ||
654 | 297 | config = get_board_config( | ||
655 | 298 | 'ux500', is_live=True, is_lowmem=False, consoles=None) | ||
656 | 299 | boot_cmd = ( | ||
657 | 300 | "setenv bootcmd 'fatload mmc 1:1 0x00100000 uImage; fatload " | ||
658 | 301 | "mmc 1:1 0x08000000 uInitrd; bootm 0x00100000 0x08000000'\n" | ||
659 | 302 | "setenv bootargs ' console = tty0 console = ttyAMA2,115200n8 " | ||
660 | 303 | "serialtty = ttyAMA2 boot=casper rootwait ro earlyprintk " | ||
661 | 304 | "rootdelay = 1 fixrtc nocompcache mem = 96M@0 " | ||
662 | 305 | "mem_modem = 32M@96M mem = 44M@128M pmem = 22M@172M " | ||
663 | 306 | "mem = 30M@194M mem_mali = 32M@224M pmem_hwb = 54M@256M " | ||
664 | 307 | "hwmem = 48M@302M mem = 152M@360M'\nboot") | ||
665 | 308 | expected = self.expected_ux500_config.copy() | ||
666 | 309 | expected['boot_cmd'] = boot_cmd | ||
667 | 310 | expected['serial_opts'] = ( | ||
668 | 311 | ' console = tty0 console = ttyAMA2,115200n8 serialtty = ttyAMA2') | ||
669 | 312 | self.assertThat(expected, IsEqualToDict(config)) | ||
670 | 313 | |||
671 | 314 | def test_ux500(self): | ||
672 | 315 | config = get_board_config( | ||
673 | 316 | 'ux500', is_live=False, is_lowmem=False, consoles=None) | ||
674 | 317 | self.assertThat(self.expected_ux500_config, IsEqualToDict(config)) | ||
677 | 318 | 131 | ||
678 | 319 | def test_panda(self): | 132 | def test_panda(self): |
698 | 320 | config = get_board_config( | 133 | boot_cmd = board_configs['panda'].get_boot_cmd( |
699 | 321 | 'panda', is_live=False, is_lowmem=False, consoles=None) | 134 | is_live=False, is_lowmem=False, consoles=None) |
700 | 322 | self.assertThat(self.expected_panda_config, IsEqualToDict(config)) | 135 | expected = ( |
701 | 323 | 136 | "setenv bootcmd 'fatload mmc 0:1 0x80200000 uImage; fatload mmc " | |
702 | 324 | def test_panda_live(self): | 137 | "0:1 0x81600000 uInitrd; bootm 0x80200000 0x81600000'\nsetenv " |
703 | 325 | config = get_board_config( | 138 | "bootargs ' console = tty0 console = ttyO2,115200n8 " |
704 | 326 | 'panda', is_live=True, is_lowmem=False, consoles=None) | 139 | "root=UUID=%s rootwait ro earlyprintk fixrtc nocompcache " |
705 | 327 | boot_cmd = ( | 140 | "vram = 32M omapfb.debug = y omapfb.vram = 0:8M mem = 463M " |
706 | 328 | "setenv bootcmd 'fatload mmc 0:1 0x80200000 uImage; " | 141 | "ip = none'\nboot" % ROOTFS_UUID) |
707 | 329 | "fatload mmc 0:1 0x81600000 uInitrd; bootm 0x80200000 " | 142 | self.assertEqual(expected, boot_cmd) |
689 | 330 | "0x81600000'\nsetenv bootargs ' console = tty0 " | ||
690 | 331 | "console = ttyO2,115200n8 serialtty = ttyO2 boot=casper " | ||
691 | 332 | "rootwait ro earlyprintk fixrtc nocompcache vram = 32M " | ||
692 | 333 | "omapfb.debug = y omapfb.vram = 0:8M mem = 463M ip = none'\nboot") | ||
693 | 334 | expected = self.expected_panda_config.copy() | ||
694 | 335 | expected['boot_cmd'] = boot_cmd | ||
695 | 336 | expected['serial_opts'] = ( | ||
696 | 337 | ' console = tty0 console = ttyO2,115200n8 serialtty = ttyO2') | ||
697 | 338 | self.assertThat(expected, IsEqualToDict(config)) | ||
708 | 339 | 143 | ||
709 | 340 | def test_beagle(self): | 144 | def test_beagle(self): |
718 | 341 | config = get_board_config( | 145 | boot_cmd = board_configs['beagle'].get_boot_cmd( |
719 | 342 | 'beagle', is_live=False, is_lowmem=False, consoles=None) | 146 | is_live=False, is_lowmem=False, consoles=None) |
720 | 343 | self.assertThat(self.expected_beagle_config, IsEqualToDict(config)) | 147 | expected = ( |
713 | 344 | |||
714 | 345 | def test_beagle_live(self): | ||
715 | 346 | config = get_board_config( | ||
716 | 347 | 'beagle', is_live=True, is_lowmem=False, consoles=None) | ||
717 | 348 | boot_cmd = ( | ||
721 | 349 | "setenv bootcmd 'fatload mmc 0:1 0x80000000 uImage; " | 148 | "setenv bootcmd 'fatload mmc 0:1 0x80000000 uImage; " |
722 | 350 | "fatload mmc 0:1 0x81600000 uInitrd; bootm 0x80000000 " | 149 | "fatload mmc 0:1 0x81600000 uInitrd; bootm 0x80000000 " |
723 | 351 | "0x81600000'\nsetenv bootargs ' console=tty0 " | 150 | "0x81600000'\nsetenv bootargs ' console=tty0 " |
732 | 352 | "console=ttyS2,115200n8 serialtty=ttyS2 boot=casper rootwait ro " | 151 | "console=ttyS2,115200n8 root=UUID=%s rootwait ro earlyprintk " |
733 | 353 | "earlyprintk fixrtc nocompcache vram=12M omapfb.debug=y " | 152 | "fixrtc nocompcache vram=12M omapfb.debug=y " |
734 | 354 | "omapfb.mode=dvi:1280x720MR-16@60'\nboot") | 153 | "omapfb.mode=dvi:1280x720MR-16@60'\nboot" % ROOTFS_UUID) |
735 | 355 | expected = self.expected_beagle_config.copy() | 154 | self.assertEqual(expected, boot_cmd) |
728 | 356 | expected['boot_cmd'] = boot_cmd | ||
729 | 357 | expected['serial_opts'] = ( | ||
730 | 358 | ' console=tty0 console=ttyS2,115200n8 serialtty=ttyS2') | ||
731 | 359 | self.assertThat(expected, IsEqualToDict(config)) | ||
736 | 360 | 155 | ||
737 | 361 | 156 | ||
738 | 362 | class TestRemoveBinaryDir(TestCaseWithFixtures): | 157 | class TestRemoveBinaryDir(TestCaseWithFixtures): |
Looks good to me.
Thanks,
James