Merge lp:~milo/linaro-image-tools/android-boards into lp:linaro-image-tools/11.11
- android-boards
- Merge into trunk
Proposed by
Milo Casagrande
Status: | Merged |
---|---|
Approved by: | Данило Шеган |
Approved revision: | 599 |
Merged at revision: | 596 |
Proposed branch: | lp:~milo/linaro-image-tools/android-boards |
Merge into: | lp:linaro-image-tools/11.11 |
Prerequisite: | lp:~milo/linaro-image-tools/boards-refactoring |
Diff against target: |
689 lines (+316/-168) 2 files modified
linaro-android-media-create (+11/-9) linaro_image_tools/media_create/android_boards.py (+305/-159) |
To merge this branch: | bzr merge lp:~milo/linaro-image-tools/android-boards |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Данило Шеган (community) | Approve | ||
Review via email: mp+138233@code.launchpad.net |
Commit message
Android boards refactoring to support Android hwpack.
Description of the change
This is the biggest part of the work on the android_boards module.
The refactoring al class methods references into instance references. A method to read values from the hwpack file has been added.
Tests have not been fixed here.
To post a comment you must log in.
- 593. By Milo Casagrande
-
Merged boards-refactoring into android-boards.
- 594. By Milo Casagrande
-
Merged from pipe.
- 595. By Milo Casagrande
-
Merged boards-refactoring into android-boards.
- 596. By Milo Casagrande
-
Fixed wrong attribute name, added missing one.
- 597. By Milo Casagrande
-
Merged from boards-refactoring, fixed conflicts.
- 598. By Milo Casagrande
-
Merged boards-refactoring into android-boards.
- 599. By Milo Casagrande
-
Merged boards-refactoring into android-boards.
Revision history for this message
Данило Шеган (danilo) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'linaro-android-media-create' | |||
2 | --- linaro-android-media-create 2012-07-26 08:48:15 +0000 | |||
3 | +++ linaro-android-media-create 2012-12-27 15:00:31 +0000 | |||
4 | @@ -26,7 +26,7 @@ | |||
5 | 26 | from linaro_image_tools import cmd_runner | 26 | from linaro_image_tools import cmd_runner |
6 | 27 | 27 | ||
7 | 28 | from linaro_image_tools.media_create.android_boards import ( | 28 | from linaro_image_tools.media_create.android_boards import ( |
9 | 29 | android_board_configs, | 29 | get_board_config, |
10 | 30 | ) | 30 | ) |
11 | 31 | from linaro_image_tools.media_create.check_device import ( | 31 | from linaro_image_tools.media_create.check_device import ( |
12 | 32 | confirm_device_selection_and_ensure_it_is_ready) | 32 | confirm_device_selection_and_ensure_it_is_ready) |
13 | @@ -40,8 +40,10 @@ | |||
14 | 40 | unpack_android_binary_tarball | 40 | unpack_android_binary_tarball |
15 | 41 | ) | 41 | ) |
16 | 42 | from linaro_image_tools.media_create import get_android_args_parser | 42 | from linaro_image_tools.media_create import get_android_args_parser |
19 | 43 | from linaro_image_tools.utils import ensure_command | 43 | from linaro_image_tools.utils import ( |
20 | 44 | 44 | ensure_command, | |
21 | 45 | get_logger | ||
22 | 46 | ) | ||
23 | 45 | 47 | ||
24 | 46 | 48 | ||
25 | 47 | # Just define the global variables | 49 | # Just define the global variables |
26 | @@ -89,6 +91,8 @@ | |||
27 | 89 | parser = get_android_args_parser() | 91 | parser = get_android_args_parser() |
28 | 90 | args = parser.parse_args() | 92 | args = parser.parse_args() |
29 | 91 | 93 | ||
30 | 94 | logger = get_logger(debug=args.debug) | ||
31 | 95 | |||
32 | 92 | # If --help was specified this won't execute. | 96 | # If --help was specified this won't execute. |
33 | 93 | # Create temp dir and initialize rest of path vars. | 97 | # Create temp dir and initialize rest of path vars. |
34 | 94 | TMP_DIR = tempfile.mkdtemp() | 98 | TMP_DIR = tempfile.mkdtemp() |
35 | @@ -102,13 +106,14 @@ | |||
36 | 102 | DATA_DISK = os.path.join(TMP_DIR, 'userdata-disc') | 106 | DATA_DISK = os.path.join(TMP_DIR, 'userdata-disc') |
37 | 103 | SDCARD_DISK = os.path.join(TMP_DIR, 'sdcard-disc') | 107 | SDCARD_DISK = os.path.join(TMP_DIR, 'sdcard-disc') |
38 | 104 | 108 | ||
40 | 105 | board_config = android_board_configs[args.dev] | 109 | board_config = get_board_config(args.dev) |
41 | 106 | board_config.add_boot_args(args.extra_boot_args) | 110 | board_config.add_boot_args(args.extra_boot_args) |
42 | 107 | board_config.add_boot_args_from_file(args.extra_boot_args_file) | 111 | board_config.add_boot_args_from_file(args.extra_boot_args_file) |
43 | 108 | 112 | ||
44 | 109 | if args.dev == 'iMX53': | 113 | if args.dev == 'iMX53': |
45 | 110 | # XXX: remove this and the corresponding entry in android_board_configs | 114 | # XXX: remove this and the corresponding entry in android_board_configs |
47 | 111 | print "DEPRECATION WARNING: iMX53 is deprecated, please use mx53loco." | 115 | logger.warning("DEPRECATION WARNING: iMX53 is deprecated, please " |
48 | 116 | "use mx53loco.") | ||
49 | 112 | 117 | ||
50 | 113 | ensure_required_commands(args) | 118 | ensure_required_commands(args) |
51 | 114 | 119 | ||
52 | @@ -117,11 +122,8 @@ | |||
53 | 117 | if not confirm_device_selection_and_ensure_it_is_ready(args.device): | 122 | if not confirm_device_selection_and_ensure_it_is_ready(args.device): |
54 | 118 | sys.exit(1) | 123 | sys.exit(1) |
55 | 119 | elif not args.should_create_partitions: | 124 | elif not args.should_create_partitions: |
57 | 120 | print ("Do not use --no-part in conjunction with --image_file.") | 125 | logger.error("Do not use --no-part in conjunction with --image_file.") |
58 | 121 | sys.exit(1) | 126 | sys.exit(1) |
59 | 122 | else: | ||
60 | 123 | # All good, move on. | ||
61 | 124 | pass | ||
62 | 125 | 127 | ||
63 | 126 | cmd_runner.run(['mkdir', '-p', BOOT_DIR]).wait() | 128 | cmd_runner.run(['mkdir', '-p', BOOT_DIR]).wait() |
64 | 127 | cmd_runner.run(['mkdir', '-p', SYSTEM_DIR]).wait() | 129 | cmd_runner.run(['mkdir', '-p', SYSTEM_DIR]).wait() |
65 | 128 | 130 | ||
66 | === modified file 'linaro_image_tools/media_create/android_boards.py' | |||
67 | --- linaro_image_tools/media_create/android_boards.py 2012-12-12 09:35:49 +0000 | |||
68 | +++ linaro_image_tools/media_create/android_boards.py 2012-12-27 15:00:31 +0000 | |||
69 | @@ -20,45 +20,149 @@ | |||
70 | 20 | """Configuration for boards supported by linaro-android-media-create. | 20 | """Configuration for boards supported by linaro-android-media-create. |
71 | 21 | 21 | ||
72 | 22 | To add support for a new board, you need to create a subclass of | 22 | To add support for a new board, you need to create a subclass of |
75 | 23 | AndroidBoardConfig, set appropriate values for its variables and add it to | 23 | AndroidBoardConfig, create an Android hwpack as explained here: |
76 | 24 | android_board_configs at the bottom of this file. | 24 | |
77 | 25 | https://wiki.linaro.org/AndroidHardwarePacksV3 | ||
78 | 26 | |||
79 | 27 | and add the board to 'android_board_configs' at the end of this file. | ||
80 | 25 | """ | 28 | """ |
81 | 26 | 29 | ||
82 | 30 | import os | ||
83 | 31 | import yaml | ||
84 | 32 | import logging | ||
85 | 33 | |||
86 | 34 | from linaro_image_tools import cmd_runner | ||
87 | 27 | from linaro_image_tools.media_create.partitions import SECTOR_SIZE | 35 | from linaro_image_tools.media_create.partitions import SECTOR_SIZE |
88 | 28 | from linaro_image_tools.media_create.boards import PART_ALIGN_S | ||
89 | 29 | from linaro_image_tools.media_create.boards import BeagleConfig | ||
90 | 30 | from linaro_image_tools.media_create.boards import PandaConfig | ||
91 | 31 | from linaro_image_tools.media_create.boards import Mx53LoCoConfig | ||
92 | 32 | from linaro_image_tools.media_create.boards import SnowballSdConfig | ||
93 | 33 | from linaro_image_tools.media_create.boards import SnowballEmmcConfig | ||
94 | 34 | from linaro_image_tools.media_create.boards import SMDKV310Config | ||
95 | 35 | from linaro_image_tools.media_create.boards import OrigenConfig | ||
96 | 36 | from linaro_image_tools.media_create.boards import OrigenQuadConfig | ||
97 | 37 | from linaro_image_tools.media_create.boards import VexpressConfig | ||
98 | 38 | from linaro_image_tools.media_create.boards import ( | 36 | from linaro_image_tools.media_create.boards import ( |
99 | 37 | BeagleConfig, | ||
100 | 38 | BoardConfig, | ||
101 | 39 | BoardConfigException, | ||
102 | 40 | Mx53LoCoConfig, | ||
103 | 41 | OrigenConfig, | ||
104 | 42 | OrigenQuadConfig, | ||
105 | 43 | PART_ALIGN_S, | ||
106 | 44 | PandaConfig, | ||
107 | 45 | SMDKV310Config, | ||
108 | 46 | SnowballEmmcConfig, | ||
109 | 47 | SnowballSdConfig, | ||
110 | 48 | VexpressConfig, | ||
111 | 49 | align_partition, | ||
112 | 39 | align_up, | 50 | align_up, |
115 | 40 | align_partition, | 51 | install_mx5_boot_loader, |
114 | 41 | classproperty, | ||
116 | 42 | make_boot_script, | 52 | make_boot_script, |
117 | 43 | install_mx5_boot_loader, | ||
118 | 44 | ) | 53 | ) |
127 | 45 | 54 | from linaro_image_tools.utils import DEFAULT_LOGGER_NAME | |
128 | 46 | from linaro_image_tools import cmd_runner | 55 | |
129 | 47 | import os | 56 | logger = logging.getLogger(DEFAULT_LOGGER_NAME) |
130 | 48 | 57 | ||
131 | 49 | 58 | BOOT_MIN_SIZE_S = align_up(128 * 1024 * 1024, SECTOR_SIZE) / SECTOR_SIZE | |
132 | 50 | class AndroidBoardConfig(object): | 59 | SYSTEM_MIN_SIZE_S = align_up(512 * 1024 * 1024, SECTOR_SIZE) / SECTOR_SIZE |
133 | 51 | @classmethod | 60 | CACHE_MIN_SIZE_S = align_up(256 * 1024 * 1024, SECTOR_SIZE) / SECTOR_SIZE |
134 | 52 | def _get_bootargs(cls, consoles): | 61 | USERDATA_MIN_SIZE_S = align_up(512 * 1024 * 1024, SECTOR_SIZE) / SECTOR_SIZE |
135 | 62 | SDCARD_MIN_SIZE_S = align_up(512 * 1024 * 1024, SECTOR_SIZE) / SECTOR_SIZE | ||
136 | 63 | LOADER_MIN_SIZE_S = align_up(1 * 1024 * 1024, SECTOR_SIZE) / SECTOR_SIZE | ||
137 | 64 | |||
138 | 65 | |||
139 | 66 | class AndroidBoardConfig(BoardConfig): | ||
140 | 67 | |||
141 | 68 | def __init__(self): | ||
142 | 69 | super(AndroidBoardConfig, self).__init__() | ||
143 | 70 | self.dtb_name = None | ||
144 | 71 | self._extra_serial_opts = [] | ||
145 | 72 | self._android_specific_args = [] | ||
146 | 73 | self._extra_boot_args_options = [] | ||
147 | 74 | self._live_serial_options = [] | ||
148 | 75 | |||
149 | 76 | def _get_android_specific_args(self): | ||
150 | 77 | android_args = self._android_specific_args | ||
151 | 78 | if isinstance(android_args, list): | ||
152 | 79 | android_args = ' '.join(self._android_specific_args) | ||
153 | 80 | return android_args | ||
154 | 81 | |||
155 | 82 | def _set_android_specific_args(self, value): | ||
156 | 83 | self._android_specific_args = value | ||
157 | 84 | |||
158 | 85 | android_specific_args = property(_get_android_specific_args, | ||
159 | 86 | _set_android_specific_args) | ||
160 | 87 | |||
161 | 88 | def _get_extra_boot_args_options(self): | ||
162 | 89 | extra_boot_args = self._extra_boot_args_options | ||
163 | 90 | if isinstance(extra_boot_args, list): | ||
164 | 91 | extra_boot_args = ' '.join(self._extra_boot_args_options) | ||
165 | 92 | return extra_boot_args | ||
166 | 93 | |||
167 | 94 | def _set_extra_boot_args_options(self, value): | ||
168 | 95 | self._extra_boot_args_options = value | ||
169 | 96 | |||
170 | 97 | extra_boot_args_options = property(_get_extra_boot_args_options, | ||
171 | 98 | _set_extra_boot_args_options) | ||
172 | 99 | |||
173 | 100 | def _get_extra_serial_opts(self): | ||
174 | 101 | extra_serial = self._extra_serial_opts | ||
175 | 102 | if isinstance(extra_serial, list): | ||
176 | 103 | extra_serial = ' '.join(self._extra_serial_opts) | ||
177 | 104 | return extra_serial | ||
178 | 105 | |||
179 | 106 | def _set_extra_serial_opts(self, value): | ||
180 | 107 | self._extra_serial_opts = value | ||
181 | 108 | |||
182 | 109 | extra_serial_opts = property(_get_extra_serial_opts, | ||
183 | 110 | _set_extra_serial_opts) | ||
184 | 111 | |||
185 | 112 | def _get_live_serial_options(self): | ||
186 | 113 | serial_options = self._live_serial_options | ||
187 | 114 | if serial_options: | ||
188 | 115 | if isinstance(serial_options, list): | ||
189 | 116 | serial_options = ' '.join(self._live_serial_options) | ||
190 | 117 | if self._check_placeholder_presence(serial_options, '%s'): | ||
191 | 118 | serial_options = serial_options % self.serial_tty | ||
192 | 119 | return serial_options | ||
193 | 120 | |||
194 | 121 | def _set_live_serial_options(self, value): | ||
195 | 122 | self._live_serial_options = value | ||
196 | 123 | |||
197 | 124 | live_serial_options = property(_get_live_serial_options, | ||
198 | 125 | _set_live_serial_options) | ||
199 | 126 | |||
200 | 127 | def from_file(self, hwpack): | ||
201 | 128 | """Loads the Android board configuration from an Android hardware pack | ||
202 | 129 | configuration file and sets the config attributes with their values. | ||
203 | 130 | |||
204 | 131 | :param hwpack: The Android hwpack configuration file. | ||
205 | 132 | :return The configuration read from the file as a dictionary. | ||
206 | 133 | """ | ||
207 | 134 | try: | ||
208 | 135 | config = yaml.safe_load(hwpack) | ||
209 | 136 | self._set_attributes(config) | ||
210 | 137 | return config | ||
211 | 138 | except yaml.YAMLError, ex: | ||
212 | 139 | logger.debug("Error loading YAML file %s" % hwpack, ex) | ||
213 | 140 | raise BoardConfigException("Error reading Android hwpack %s" | ||
214 | 141 | % hwpack) | ||
215 | 142 | |||
216 | 143 | def _set_attributes(self, config): | ||
217 | 144 | """Initialize the class attributes with the values read from the | ||
218 | 145 | Android hardware pack configuration file. | ||
219 | 146 | |||
220 | 147 | :param config: The config read from the Android hwpack. | ||
221 | 148 | """ | ||
222 | 149 | for name, value in config.iteritems(): | ||
223 | 150 | if hasattr(self, name): | ||
224 | 151 | setattr(self, name, value) | ||
225 | 152 | else: | ||
226 | 153 | logger.warning("Attribute '%s' does not belong to this " | ||
227 | 154 | "instance of '%s'." % (name, self.__class__)) | ||
228 | 155 | |||
229 | 156 | def _get_bootargs(self, consoles): | ||
230 | 53 | """Get the bootargs for this board. | 157 | """Get the bootargs for this board. |
231 | 54 | 158 | ||
232 | 55 | In general subclasses should not have to override this. | 159 | In general subclasses should not have to override this. |
233 | 56 | """ | 160 | """ |
234 | 57 | boot_args_options = 'rootwait ro' | 161 | boot_args_options = 'rootwait ro' |
239 | 58 | if cls.extra_boot_args_options is not None: | 162 | if self.extra_boot_args_options: |
240 | 59 | boot_args_options += ' %s' % cls.extra_boot_args_options | 163 | boot_args_options += ' %s' % self.extra_boot_args_options |
241 | 60 | boot_args_options += ' %s' % cls.android_specific_args | 164 | boot_args_options += ' %s' % self.android_specific_args |
242 | 61 | serial_opts = cls._extra_serial_opts | 165 | serial_opts = self.extra_serial_opts |
243 | 62 | for console in consoles: | 166 | for console in consoles: |
244 | 63 | serial_opts += ' console=%s' % console | 167 | serial_opts += ' console=%s' % console |
245 | 64 | 168 | ||
246 | @@ -70,34 +174,32 @@ | |||
247 | 70 | "%(boot_args_options)s" | 174 | "%(boot_args_options)s" |
248 | 71 | % replacements) | 175 | % replacements) |
249 | 72 | 176 | ||
252 | 73 | @classmethod | 177 | def _get_boot_env(self, consoles): |
251 | 74 | def _get_boot_env(cls, consoles): | ||
253 | 75 | """Get the boot environment for this board. | 178 | """Get the boot environment for this board. |
254 | 76 | 179 | ||
255 | 77 | In general subclasses should not have to override this. | 180 | In general subclasses should not have to override this. |
256 | 78 | """ | 181 | """ |
257 | 79 | boot_env = {} | 182 | boot_env = {} |
259 | 80 | boot_env["bootargs"] = cls._get_bootargs(consoles) | 183 | boot_env["bootargs"] = self._get_bootargs(consoles) |
260 | 81 | initrd = False | 184 | initrd = False |
262 | 82 | if cls.initrd_addr: | 185 | if self.initrd_addr: |
263 | 83 | initrd = True | 186 | initrd = True |
264 | 84 | # On Android, the DTB file is always built as part of the kernel it | 187 | # On Android, the DTB file is always built as part of the kernel it |
265 | 85 | # comes from - and lives in the same directory in the boot tarball, so | 188 | # comes from - and lives in the same directory in the boot tarball, so |
266 | 86 | # here we don't need to pass the whole path to it. | 189 | # here we don't need to pass the whole path to it. |
270 | 87 | boot_env["bootcmd"] = cls._get_bootcmd(initrd, cls.dtb_name) | 190 | boot_env["bootcmd"] = self._get_bootcmd(initrd, self.dtb_name) |
271 | 88 | boot_env["initrd_high"] = cls.initrd_high | 191 | boot_env["initrd_high"] = self.initrd_high |
272 | 89 | boot_env["fdt_high"] = cls.fdt_high | 192 | boot_env["fdt_high"] = self.fdt_high |
273 | 90 | return boot_env | 193 | return boot_env |
274 | 91 | 194 | ||
277 | 92 | @classmethod | 195 | def populate_boot_script(self, boot_partition, boot_disk, consoles): |
276 | 93 | def populate_boot_script(cls, boot_partition, boot_disk, consoles): | ||
278 | 94 | cmd_runner.run(['mkdir', '-p', boot_disk]).wait() | 196 | cmd_runner.run(['mkdir', '-p', boot_disk]).wait() |
279 | 95 | # TODO: Use partition_mounted() here to make sure the partition is | 197 | # TODO: Use partition_mounted() here to make sure the partition is |
280 | 96 | # always umounted after we're done. | 198 | # always umounted after we're done. |
281 | 97 | cmd_runner.run(['mount', boot_partition, boot_disk], | 199 | cmd_runner.run(['mount', boot_partition, boot_disk], |
282 | 98 | as_root=True).wait() | 200 | as_root=True).wait() |
283 | 99 | 201 | ||
285 | 100 | boot_env = cls._get_boot_env(consoles) | 202 | boot_env = self._get_boot_env(consoles) |
286 | 101 | cmdline_filepath = os.path.join(boot_disk, "cmdline") | 203 | cmdline_filepath = os.path.join(boot_disk, "cmdline") |
287 | 102 | cmdline_file = open(cmdline_filepath, 'r') | 204 | cmdline_file = open(cmdline_filepath, 'r') |
288 | 103 | android_kernel_cmdline = cmdline_file.read() | 205 | android_kernel_cmdline = cmdline_file.read() |
289 | @@ -106,7 +208,7 @@ | |||
290 | 106 | cmdline_file.close() | 208 | cmdline_file.close() |
291 | 107 | 209 | ||
292 | 108 | boot_dir = boot_disk | 210 | boot_dir = boot_disk |
294 | 109 | boot_script_path = os.path.join(boot_dir, cls.boot_script) | 211 | boot_script_path = os.path.join(boot_dir, self.boot_script) |
295 | 110 | make_boot_script(boot_env, boot_script_path) | 212 | make_boot_script(boot_env, boot_script_path) |
296 | 111 | 213 | ||
297 | 112 | cmd_runner.run(['sync']).wait() | 214 | cmd_runner.run(['sync']).wait() |
298 | @@ -115,25 +217,13 @@ | |||
299 | 115 | except cmd_runner.SubcommandNonZeroReturnValue: | 217 | except cmd_runner.SubcommandNonZeroReturnValue: |
300 | 116 | pass | 218 | pass |
301 | 117 | 219 | ||
304 | 118 | @classmethod | 220 | def get_sfdisk_cmd(self, should_align_boot_part=False, |
303 | 119 | def get_sfdisk_cmd(cls, should_align_boot_part=False, | ||
305 | 120 | start_addr=0, extra_part=False): | 221 | start_addr=0, extra_part=False): |
307 | 121 | if cls.fat_size == 32: | 222 | if self.fat_size == 32: |
308 | 122 | partition_type = '0x0C' | 223 | partition_type = '0x0C' |
309 | 123 | else: | 224 | else: |
310 | 124 | partition_type = '0x0E' | 225 | partition_type = '0x0E' |
311 | 125 | 226 | ||
312 | 126 | BOOT_MIN_SIZE_S = align_up( | ||
313 | 127 | 128 * 1024 * 1024, SECTOR_SIZE) / SECTOR_SIZE | ||
314 | 128 | SYSTEM_MIN_SIZE_S = align_up( | ||
315 | 129 | 512 * 1024 * 1024, SECTOR_SIZE) / SECTOR_SIZE | ||
316 | 130 | CACHE_MIN_SIZE_S = align_up( | ||
317 | 131 | 256 * 1024 * 1024, SECTOR_SIZE) / SECTOR_SIZE | ||
318 | 132 | USERDATA_MIN_SIZE_S = align_up( | ||
319 | 133 | 512 * 1024 * 1024, SECTOR_SIZE) / SECTOR_SIZE | ||
320 | 134 | SDCARD_MIN_SIZE_S = align_up( | ||
321 | 135 | 512 * 1024 * 1024, SECTOR_SIZE) / SECTOR_SIZE | ||
322 | 136 | |||
323 | 137 | # align on sector 63 for compatibility with broken versions of x-loader | 227 | # align on sector 63 for compatibility with broken versions of x-loader |
324 | 138 | # unless align_boot_part is set | 228 | # unless align_boot_part is set |
325 | 139 | boot_align = 63 | 229 | boot_align = 63 |
326 | @@ -175,86 +265,89 @@ | |||
327 | 175 | cache_start, _cache_len, userdata_start, userdata_start, | 265 | cache_start, _cache_len, userdata_start, userdata_start, |
328 | 176 | _userdata_len, sdcard_start) | 266 | _userdata_len, sdcard_start) |
329 | 177 | 267 | ||
333 | 178 | @classmethod | 268 | def populate_raw_partition(self, media, boot_dir): |
334 | 179 | def populate_raw_partition(cls, media, boot_dir): | 269 | super(AndroidBoardConfig, self).populate_raw_partition(media, boot_dir) |
332 | 180 | super(AndroidBoardConfig, cls).populate_raw_partition(media, boot_dir) | ||
335 | 181 | 270 | ||
338 | 182 | @classmethod | 271 | def install_boot_loader(self, boot_partition, boot_device_or_file): |
337 | 183 | def install_boot_loader(cls, boot_partition, boot_device_or_file): | ||
339 | 184 | pass | 272 | pass |
340 | 185 | 273 | ||
341 | 186 | 274 | ||
342 | 187 | class AndroidOmapConfig(AndroidBoardConfig): | 275 | class AndroidOmapConfig(AndroidBoardConfig): |
344 | 188 | dtb_name = None | 276 | """Placeholder class for OMAP configuration inheritance.""" |
345 | 189 | 277 | ||
346 | 190 | 278 | ||
347 | 191 | class AndroidBeagleConfig(AndroidOmapConfig, BeagleConfig): | 279 | class AndroidBeagleConfig(AndroidOmapConfig, BeagleConfig): |
362 | 192 | _extra_serial_opts = 'console=tty0 console=ttyO2,115200n8' | 280 | """Placeholder class for Beagle configuration inheritance.""" |
363 | 193 | android_specific_args = 'init=/init androidboot.console=ttyO2' | 281 | def __init__(self): |
364 | 194 | dtb_name = None | 282 | super(AndroidBeagleConfig, self).__init__() |
365 | 195 | 283 | self._android_specific_args = 'init=/init androidboot.console=ttyO2' | |
366 | 196 | 284 | self._extra_serial_opts = 'console=tty0 console=ttyO2,115200n8' | |
367 | 197 | class AndroidPandaConfig(AndroidOmapConfig, PandaConfig): | 285 | |
368 | 198 | bootloader_flavor = 'omap4_panda' | 286 | |
369 | 199 | dtb_addr = '0x815f0000' | 287 | class AndroidPandaConfig(AndroidBoardConfig, PandaConfig): |
370 | 200 | dtb_name = 'board.dtb' | 288 | """Placeholder class for Panda configuration inheritance.""" |
371 | 201 | _extra_serial_opts = 'console=ttyO2,115200n8' | 289 | def __init__(self): |
372 | 202 | extra_boot_args_options = ( | 290 | super(AndroidPandaConfig, self).__init__() |
373 | 203 | 'earlyprintk fixrtc nocompcache vram=48M ' | 291 | self.dtb_name = 'board.dtb' |
374 | 204 | 'omapfb.vram=0:24M,1:24M mem=456M@0x80000000 mem=512M@0xA0000000') | 292 | self._extra_serial_opts = 'console=ttyO2,115200n8' |
375 | 205 | android_specific_args = 'init=/init androidboot.console=ttyO2' | 293 | self._extra_boot_args_options = ( |
376 | 294 | 'earlyprintk fixrtc nocompcache vram=48M ' | ||
377 | 295 | 'omapfb.vram=0:24M,1:24M mem=456M@0x80000000 mem=512M@0xA0000000') | ||
378 | 296 | self._android_specific_args = 'init=/init androidboot.console=ttyO2' | ||
379 | 297 | self.dtb_addr = '0x815f0000' | ||
380 | 298 | self.bootloader_flavor = 'omap4_panda' | ||
381 | 206 | 299 | ||
382 | 207 | 300 | ||
383 | 208 | class AndroidSnowballSdConfig(AndroidBoardConfig, SnowballSdConfig): | 301 | class AndroidSnowballSdConfig(AndroidBoardConfig, SnowballSdConfig): |
395 | 209 | boot_script = 'boot.scr' | 302 | """Placeholder class for Snowball Sd configuration inheritance.""" |
396 | 210 | fdt_high = '0x05000000' | 303 | def __init__(self): |
397 | 211 | initrd_addr = '0x05000000' | 304 | super(AndroidSnowballSdConfig, self).__init__() |
398 | 212 | initrd_high = '0x06000000' | 305 | self.dtb_name = 'board.dtb' |
399 | 213 | extra_boot_args_options = ( | 306 | self._android_specific_args = 'init=/init androidboot.console=ttyAMA2' |
400 | 214 | 'earlyprintk mem=128M@0 mali.mali_mem=64M@128M hwmem=168M@192M ' | 307 | self._extra_boot_args_options = ( |
401 | 215 | 'mem=22M@360M mem_issw=1M@383M mem=640M@384M vmalloc=500M') | 308 | 'earlyprintk mem=128M@0 mali.mali_mem=64M@128M hwmem=168M@192M ' |
402 | 216 | _extra_serial_opts = 'console=ttyAMA2,115200n8' | 309 | 'mem=22M@360M mem_issw=1M@383M mem=640M@384M vmalloc=500M') |
403 | 217 | android_specific_args = 'init=/init androidboot.console=ttyAMA2' | 310 | self._extra_serial_opts = 'console=ttyAMA2,115200n8' |
404 | 218 | dtb_name = 'board.dtb' | 311 | self.boot_script = 'boot.scr' |
405 | 219 | dtb_addr = '0x8000000' | 312 | self.fdt_high = '0x05000000' |
406 | 313 | self.initrd_addr = '0x05000000' | ||
407 | 314 | self.initrd_high = '0x06000000' | ||
408 | 315 | self.dtb_addr = '0x8000000' | ||
409 | 220 | 316 | ||
410 | 221 | 317 | ||
411 | 222 | class AndroidSnowballEmmcConfig(AndroidBoardConfig, SnowballEmmcConfig): | 318 | class AndroidSnowballEmmcConfig(AndroidBoardConfig, SnowballEmmcConfig): |
431 | 223 | boot_script = 'boot.scr' | 319 | """Class for Snowball Emmc configuration inheritance.""" |
432 | 224 | fdt_high = '0x05000000' | 320 | def __init__(self): |
433 | 225 | initrd_addr = '0x05000000' | 321 | super(AndroidSnowballEmmcConfig, self).__init__() |
434 | 226 | initrd_high = '0x06000000' | 322 | self.dtb_name = 'board.dtb' |
435 | 227 | extra_boot_args_options = ( | 323 | self._extra_boot_args_options = ( |
436 | 228 | 'earlyprintk mem=128M@0 mali.mali_mem=64M@128M hwmem=168M@192M ' | 324 | 'earlyprintk mem=128M@0 mali.mali_mem=64M@128M hwmem=168M@192M ' |
437 | 229 | 'mem=22M@360M mem_issw=1M@383M mem=640M@384M vmalloc=500M') | 325 | 'mem=22M@360M mem_issw=1M@383M mem=640M@384M vmalloc=500M') |
438 | 230 | _extra_serial_opts = 'console=ttyAMA2,115200n8' | 326 | self._extra_serial_opts = 'console=ttyAMA2,115200n8' |
439 | 231 | android_specific_args = 'init=/init androidboot.console=ttyAMA2' | 327 | self._android_specific_args = 'init=/init androidboot.console=ttyAMA2' |
440 | 232 | mmc_option = '0:2' | 328 | self.boot_script = 'boot.scr' |
441 | 233 | dtb_name = 'board.dtb' | 329 | self.fdt_high = '0x05000000' |
442 | 234 | dtb_addr = '0x8000000' | 330 | self.initrd_addr = '0x05000000' |
443 | 235 | 331 | self.initrd_high = '0x06000000' | |
444 | 236 | @classmethod | 332 | self.mmc_option = '0:2' |
445 | 237 | def get_sfdisk_cmd(cls, should_align_boot_part=False): | 333 | self.dtb_addr = '0x8000000' |
446 | 238 | 334 | ||
447 | 239 | LOADER_MIN_SIZE_S = align_up( | 335 | def get_sfdisk_cmd(self, should_align_boot_part=False): |
429 | 240 | 1 * 1024 * 1024, SECTOR_SIZE) / SECTOR_SIZE | ||
430 | 241 | |||
448 | 242 | loader_start, loader_end, loader_len = align_partition( | 336 | loader_start, loader_end, loader_len = align_partition( |
449 | 243 | SnowballEmmcConfig.SNOWBALL_LOADER_START_S, | 337 | SnowballEmmcConfig.SNOWBALL_LOADER_START_S, |
450 | 244 | LOADER_MIN_SIZE_S, 1, PART_ALIGN_S) | 338 | LOADER_MIN_SIZE_S, 1, PART_ALIGN_S) |
451 | 245 | 339 | ||
453 | 246 | command = super(AndroidSnowballEmmcConfig, cls).get_sfdisk_cmd( | 340 | command = super(AndroidSnowballEmmcConfig, self).get_sfdisk_cmd( |
454 | 247 | should_align_boot_part=True, start_addr=loader_end, | 341 | should_align_boot_part=True, start_addr=loader_end, |
455 | 248 | extra_part=True) | 342 | extra_part=True) |
456 | 249 | 343 | ||
457 | 250 | return '%s,%s,0xDA\n%s' % ( | 344 | return '%s,%s,0xDA\n%s' % ( |
458 | 251 | loader_start, loader_len, command) | 345 | loader_start, loader_len, command) |
459 | 252 | 346 | ||
462 | 253 | @classmethod | 347 | def populate_raw_partition(self, media, boot_dir): |
461 | 254 | def populate_raw_partition(cls, media, boot_dir): | ||
463 | 255 | # To avoid adding a Snowball specific command line option, we assume | 348 | # To avoid adding a Snowball specific command line option, we assume |
464 | 256 | # that the user already has unpacked the startfiles to ./startupfiles | 349 | # that the user already has unpacked the startfiles to ./startupfiles |
466 | 257 | config_files_dir = cls.snowball_config(boot_dir) | 350 | config_files_dir = self.snowball_config(boot_dir) |
467 | 258 | assert os.path.exists(config_files_dir), ( | 351 | assert os.path.exists(config_files_dir), ( |
468 | 259 | "You need to unpack the Snowball startupfiles to the directory " | 352 | "You need to unpack the Snowball startupfiles to the directory " |
469 | 260 | "'startupfiles' in your current working directory. See " | 353 | "'startupfiles' in your current working directory. See " |
470 | @@ -265,72 +358,98 @@ | |||
471 | 265 | for boot_file in boot_files: | 358 | for boot_file in boot_files: |
472 | 266 | cmd_runner.run(['cp', os.path.join(boot_dir, 'boot', boot_file), | 359 | cmd_runner.run(['cp', os.path.join(boot_dir, 'boot', boot_file), |
473 | 267 | config_files_dir], as_root=True).wait() | 360 | config_files_dir], as_root=True).wait() |
475 | 268 | super(AndroidSnowballEmmcConfig, cls).populate_raw_partition( | 361 | super(AndroidSnowballEmmcConfig, self).populate_raw_partition( |
476 | 269 | media, boot_dir) | 362 | media, boot_dir) |
477 | 270 | 363 | ||
480 | 271 | @classmethod | 364 | def snowball_config(self, chroot_dir): |
479 | 272 | def snowball_config(cls, chroot_dir): | ||
481 | 273 | # The user is expected to have unpacked the startupfiles to this subdir | 365 | # The user is expected to have unpacked the startupfiles to this subdir |
482 | 274 | # of their working dir. | 366 | # of their working dir. |
483 | 275 | return os.path.join('.', 'startupfiles') | 367 | return os.path.join('.', 'startupfiles') |
484 | 276 | 368 | ||
487 | 277 | @classproperty | 369 | @property |
488 | 278 | def delete_startupfiles(cls): | 370 | def delete_startupfiles(self): |
489 | 279 | # The startupfiles will have been unpacked to the user's working dir | 371 | # The startupfiles will have been unpacked to the user's working dir |
490 | 280 | # and should not be deleted after they have been installed. | 372 | # and should not be deleted after they have been installed. |
491 | 281 | return False | 373 | return False |
492 | 282 | 374 | ||
493 | 283 | 375 | ||
494 | 284 | class AndroidMx53LoCoConfig(AndroidBoardConfig, Mx53LoCoConfig): | 376 | class AndroidMx53LoCoConfig(AndroidBoardConfig, Mx53LoCoConfig): |
505 | 285 | extra_boot_args_options = ( | 377 | """Class for Mx53LoCo configuration inheritance.""" |
506 | 286 | 'earlyprintk rootdelay=1 fixrtc nocompcache di1_primary tve') | 378 | def __init__(self): |
507 | 287 | _extra_serial_opts = 'console=%s,115200n8' % ( | 379 | super(AndroidMx53LoCoConfig, self).__init__() |
508 | 288 | Mx53LoCoConfig.serial_tty) | 380 | self._extra_boot_args_options = ( |
509 | 289 | android_specific_args = 'init=/init androidboot.console=%s' % ( | 381 | 'earlyprintk rootdelay=1 fixrtc nocompcache di1_primary tve') |
510 | 290 | Mx53LoCoConfig.serial_tty) | 382 | self._extra_serial_opts = 'console=%s,115200n8' |
511 | 291 | dtb_name = None | 383 | self._android_specific_args = 'init=/init androidboot.console=%s' |
512 | 292 | 384 | ||
513 | 293 | @classmethod | 385 | def _get_extra_serial_opts(self): |
514 | 294 | def get_sfdisk_cmd(cls, should_align_boot_part=False): | 386 | serial_opts = self._extra_serial_opts |
515 | 387 | if serial_opts: | ||
516 | 388 | if isinstance(serial_opts, list): | ||
517 | 389 | serial_opts = ' '.join(serial_opts) | ||
518 | 390 | if self._check_placeholder_presence(serial_opts, '%s'): | ||
519 | 391 | serial_opts = serial_opts % self.serial_tty | ||
520 | 392 | return serial_opts | ||
521 | 393 | |||
522 | 394 | def _set_extra_serial_opts(self, value): | ||
523 | 395 | self._extra_serial_opts = value | ||
524 | 396 | |||
525 | 397 | extra_serial_opts = property(_get_extra_serial_opts, | ||
526 | 398 | _set_extra_serial_opts) | ||
527 | 399 | |||
528 | 400 | def _get_android_specific_args(self): | ||
529 | 401 | android_args = self._android_specific_args | ||
530 | 402 | if android_args: | ||
531 | 403 | if isinstance(android_args, list): | ||
532 | 404 | android_args = ' '.join(android_args) | ||
533 | 405 | if self._check_placeholder_presence(android_args, '%s'): | ||
534 | 406 | android_args = android_args % self.serial_tty | ||
535 | 407 | return android_args | ||
536 | 408 | |||
537 | 409 | def _set_android_specific_args(self, value): | ||
538 | 410 | self._android_specific_args = value | ||
539 | 411 | |||
540 | 412 | android_specific_args = property(_get_android_specific_args, | ||
541 | 413 | _set_android_specific_args) | ||
542 | 414 | |||
543 | 415 | def get_sfdisk_cmd(self, should_align_boot_part=False): | ||
544 | 295 | loader_start, loader_end, loader_len = align_partition( | 416 | loader_start, loader_end, loader_len = align_partition( |
546 | 296 | 1, cls.LOADER_MIN_SIZE_S, 1, PART_ALIGN_S) | 417 | 1, self.LOADER_MIN_SIZE_S, 1, PART_ALIGN_S) |
547 | 297 | 418 | ||
549 | 298 | command = super(AndroidMx53LoCoConfig, cls).get_sfdisk_cmd( | 419 | command = super(AndroidMx53LoCoConfig, self).get_sfdisk_cmd( |
550 | 299 | should_align_boot_part=True, start_addr=loader_end, | 420 | should_align_boot_part=True, start_addr=loader_end, |
551 | 300 | extra_part=True) | 421 | extra_part=True) |
552 | 301 | 422 | ||
553 | 302 | return '%s,%s,0xDA\n%s' % ( | 423 | return '%s,%s,0xDA\n%s' % ( |
554 | 303 | loader_start, loader_len, command) | 424 | loader_start, loader_len, command) |
555 | 304 | 425 | ||
558 | 305 | @classmethod | 426 | def install_boot_loader(self, boot_partition, boot_device_or_file): |
557 | 306 | def install_boot_loader(cls, boot_partition, boot_device_or_file): | ||
559 | 307 | install_mx5_boot_loader( | 427 | install_mx5_boot_loader( |
560 | 308 | os.path.join(boot_device_or_file, "u-boot.imx"), | 428 | os.path.join(boot_device_or_file, "u-boot.imx"), |
562 | 309 | boot_partition, cls.LOADER_MIN_SIZE_S) | 429 | boot_partition, self.LOADER_MIN_SIZE_S) |
563 | 310 | 430 | ||
564 | 311 | 431 | ||
565 | 312 | class AndroidMx6QSabreliteConfig(AndroidMx53LoCoConfig): | 432 | class AndroidMx6QSabreliteConfig(AndroidMx53LoCoConfig): |
572 | 313 | bootloader_flavor = 'mx6qsabrelite' | 433 | """Placeholder class for Mx6Q Sabrelite configuration inheritance.""" |
573 | 314 | kernel_addr = '0x10000000' | 434 | def __init__(self): |
574 | 315 | initrd_addr = '0x12000000' | 435 | super(AndroidMx6QSabreliteConfig, self).__init__() |
575 | 316 | load_addr = '0x10008000' | 436 | self.dtb_name = 'board.dtb' |
576 | 317 | dtb_addr = '0x11ff0000' | 437 | self.bootloader_flavor = 'mx6qsabrelite' |
577 | 318 | dtb_name = 'board.dtb' | 438 | self.kernel_addr = '0x10000000' |
578 | 439 | self.initrd_addr = '0x12000000' | ||
579 | 440 | self.load_addr = '0x10008000' | ||
580 | 441 | self.dtb_addr = '0x11ff0000' | ||
581 | 319 | 442 | ||
582 | 320 | 443 | ||
583 | 321 | class AndroidSamsungConfig(AndroidBoardConfig): | 444 | class AndroidSamsungConfig(AndroidBoardConfig): |
591 | 322 | dtb_name = None | 445 | def get_sfdisk_cmd(self, should_align_boot_part=False): |
592 | 323 | 446 | loaders_min_len = (self.samsung_bl1_start + self.samsung_bl1_len + | |
593 | 324 | @classmethod | 447 | self.samsung_bl2_len + self.samsung_env_len) |
587 | 325 | def get_sfdisk_cmd(cls, should_align_boot_part=False): | ||
588 | 326 | loaders_min_len = ( | ||
589 | 327 | cls.samsung_bl1_start + cls.samsung_bl1_len + cls.samsung_bl2_len + | ||
590 | 328 | cls.samsung_env_len) | ||
594 | 329 | 448 | ||
595 | 330 | loader_start, loader_end, loader_len = align_partition( | 449 | loader_start, loader_end, loader_len = align_partition( |
596 | 331 | 1, loaders_min_len, 1, PART_ALIGN_S) | 450 | 1, loaders_min_len, 1, PART_ALIGN_S) |
597 | 332 | 451 | ||
599 | 333 | command = super(AndroidSamsungConfig, cls).get_sfdisk_cmd( | 452 | command = super(AndroidSamsungConfig, self).get_sfdisk_cmd( |
600 | 334 | should_align_boot_part=False, start_addr=loader_end, | 453 | should_align_boot_part=False, start_addr=loader_end, |
601 | 335 | extra_part=True) | 454 | extra_part=True) |
602 | 336 | 455 | ||
603 | @@ -339,40 +458,67 @@ | |||
604 | 339 | 458 | ||
605 | 340 | 459 | ||
606 | 341 | class AndroidSMDKV310Config(AndroidSamsungConfig, SMDKV310Config): | 460 | class AndroidSMDKV310Config(AndroidSamsungConfig, SMDKV310Config): |
610 | 342 | _extra_serial_opts = 'console=tty0 console=ttySAC1,115200n8' | 461 | """Placeholder class for SMDKV310 configuration inheritance.""" |
611 | 343 | android_specific_args = 'init=/init androidboot.console=ttySAC1' | 462 | def __init__(self): |
612 | 344 | dtb_name = None | 463 | super(AndroidSMDKV310Config, self).__init__() |
613 | 464 | self._extra_serial_opts = 'console=tty0 console=ttySAC1,115200n8' | ||
614 | 465 | self._android_specific_args = 'init=/init androidboot.console=ttySAC1' | ||
615 | 345 | 466 | ||
616 | 346 | 467 | ||
617 | 347 | class AndroidOrigenConfig(AndroidSamsungConfig, OrigenConfig): | 468 | class AndroidOrigenConfig(AndroidSamsungConfig, OrigenConfig): |
621 | 348 | _extra_serial_opts = 'console=tty0 console=ttySAC2,115200n8' | 469 | """Placeholder class for Origen configuration inheritance.""" |
622 | 349 | android_specific_args = 'init=/init androidboot.console=ttySAC2' | 470 | def __init__(self): |
623 | 350 | dtb_name = None | 471 | super(AndroidOrigenConfig, self).__init__() |
624 | 472 | self._extra_serial_opts = 'console=tty0 console=ttySAC2,115200n8' | ||
625 | 473 | self._android_specific_args = 'init=/init androidboot.console=ttySAC2' | ||
626 | 351 | 474 | ||
627 | 352 | 475 | ||
628 | 353 | class AndroidOrigenQuadConfig(AndroidSamsungConfig, OrigenQuadConfig): | 476 | class AndroidOrigenQuadConfig(AndroidSamsungConfig, OrigenQuadConfig): |
632 | 354 | _extra_serial_opts = 'console=tty0 console=ttySAC2,115200n8' | 477 | def __init__(self): |
633 | 355 | android_specific_args = 'init=/init androidboot.console=ttySAC2' | 478 | super(AndroidOrigenQuadConfig, self).__init__() |
634 | 356 | dtb_name = None | 479 | self._extra_serial_opts = 'console=tty0 console=ttySAC2,115200n8' |
635 | 480 | self._android_specific_args = 'init=/init androidboot.console=ttySAC2' | ||
636 | 357 | 481 | ||
637 | 358 | 482 | ||
638 | 359 | class AndroidVexpressConfig(AndroidBoardConfig, VexpressConfig): | 483 | class AndroidVexpressConfig(AndroidBoardConfig, VexpressConfig): |
644 | 360 | _extra_serial_opts = 'console=tty0 console=ttyAMA0,38400n8' | 484 | """Placeholder class for Vexpress configuration inheritance.""" |
645 | 361 | android_specific_args = 'init=/init androidboot.console=ttyAMA0' | 485 | def __init__(self): |
646 | 362 | dtb_name = None | 486 | super(AndroidVexpressConfig, self).__init__() |
647 | 363 | 487 | self._extra_serial_opts = 'console=tty0 console=ttyAMA0,38400n8' | |
648 | 364 | 488 | self._android_specific_args = 'init=/init androidboot.console=ttyAMA0' | |
649 | 489 | |||
650 | 490 | |||
651 | 491 | # This dictionary is composed as follows: | ||
652 | 492 | # <device_name>: <class> | ||
653 | 493 | # The <device_name> is the command line argument passed to l-a-m-c, the | ||
654 | 494 | # <class> is the corresponding config class in this file (not the instance). | ||
655 | 495 | # If a new device does not have special needs, it is possible to use the | ||
656 | 496 | # general AndroidBoardConfig class. | ||
657 | 365 | android_board_configs = { | 497 | android_board_configs = { |
658 | 366 | 'beagle': AndroidBeagleConfig, | 498 | 'beagle': AndroidBeagleConfig, |
663 | 367 | 'panda': AndroidPandaConfig, | 499 | 'iMX53': AndroidMx53LoCoConfig, |
660 | 368 | 'snowball_sd': AndroidSnowballSdConfig, | ||
661 | 369 | 'snowball_emmc': AndroidSnowballEmmcConfig, | ||
662 | 370 | 'smdkv310': AndroidSMDKV310Config, | ||
664 | 371 | 'mx53loco': AndroidMx53LoCoConfig, | 500 | 'mx53loco': AndroidMx53LoCoConfig, |
665 | 372 | 'iMX53': AndroidMx53LoCoConfig, | ||
666 | 373 | 'mx6qsabrelite': AndroidMx6QSabreliteConfig, | 501 | 'mx6qsabrelite': AndroidMx6QSabreliteConfig, |
667 | 374 | 'origen': AndroidOrigenConfig, | 502 | 'origen': AndroidOrigenConfig, |
668 | 375 | 'origen_quad': AndroidOrigenQuadConfig, | 503 | 'origen_quad': AndroidOrigenQuadConfig, |
669 | 504 | 'panda': AndroidPandaConfig, | ||
670 | 505 | 'smdkv310': AndroidSMDKV310Config, | ||
671 | 506 | 'snowball_emmc': AndroidSnowballEmmcConfig, | ||
672 | 507 | 'snowball_sd': AndroidSnowballSdConfig, | ||
673 | 376 | 'vexpress': AndroidVexpressConfig, | 508 | 'vexpress': AndroidVexpressConfig, |
674 | 377 | 'vexpress-a9': AndroidVexpressConfig, | 509 | 'vexpress-a9': AndroidVexpressConfig, |
675 | 378 | } | 510 | } |
676 | 511 | |||
677 | 512 | |||
678 | 513 | def get_board_config(board): | ||
679 | 514 | """Get the board configuration for the specified board. | ||
680 | 515 | |||
681 | 516 | :param board: The name of the board to get the configuration of. | ||
682 | 517 | :type board: str | ||
683 | 518 | """ | ||
684 | 519 | clazz = android_board_configs.get(board, None) | ||
685 | 520 | if clazz: | ||
686 | 521 | return clazz() | ||
687 | 522 | else: | ||
688 | 523 | raise BoardConfigException("Board name '%s' has no configuration " | ||
689 | 524 | "available." % board) |