diff options
author | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 13:38:32 +0100 |
---|---|---|
committer | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 13:50:20 +0100 |
commit | e2e6f6fe07049f33cb6348780fa975162752e421 (patch) | |
tree | b1813295411235d1297a0ed642b1346b24fdfb12 /scripts/lib/bsp/help.py | |
download | poky-e2e6f6fe07049f33cb6348780fa975162752e421.tar.gz |
initial commit of Enea Linux 3.1
Migrated from the internal git server on the dora-enea branch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'scripts/lib/bsp/help.py')
-rw-r--r-- | scripts/lib/bsp/help.py | 1044 |
1 files changed, 1044 insertions, 0 deletions
diff --git a/scripts/lib/bsp/help.py b/scripts/lib/bsp/help.py new file mode 100644 index 0000000000..a2eb7b6bf3 --- /dev/null +++ b/scripts/lib/bsp/help.py | |||
@@ -0,0 +1,1044 @@ | |||
1 | # ex:ts=4:sw=4:sts=4:et | ||
2 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- | ||
3 | # | ||
4 | # Copyright (c) 2012, Intel Corporation. | ||
5 | # All rights reserved. | ||
6 | # | ||
7 | # This program is free software; you can redistribute it and/or modify | ||
8 | # it under the terms of the GNU General Public License version 2 as | ||
9 | # published by the Free Software Foundation. | ||
10 | # | ||
11 | # This program is distributed in the hope that it will be useful, | ||
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | # GNU General Public License for more details. | ||
15 | # | ||
16 | # You should have received a copy of the GNU General Public License along | ||
17 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
19 | # | ||
20 | # DESCRIPTION | ||
21 | # This module implements some basic help invocation functions along | ||
22 | # with the bulk of the help topic text for the Yocto BSP Tools. | ||
23 | # | ||
24 | # AUTHORS | ||
25 | # Tom Zanussi <tom.zanussi (at] intel.com> | ||
26 | # | ||
27 | |||
28 | import subprocess | ||
29 | import logging | ||
30 | |||
31 | |||
32 | def subcommand_error(args): | ||
33 | logging.info("invalid subcommand %s" % args[0]) | ||
34 | |||
35 | |||
36 | def display_help(subcommand, subcommands): | ||
37 | """ | ||
38 | Display help for subcommand. | ||
39 | """ | ||
40 | if subcommand not in subcommands: | ||
41 | return False | ||
42 | |||
43 | help = subcommands.get(subcommand, subcommand_error)[2] | ||
44 | pager = subprocess.Popen('less', stdin=subprocess.PIPE) | ||
45 | pager.communicate(help) | ||
46 | |||
47 | return True | ||
48 | |||
49 | |||
50 | def yocto_help(args, usage_str, subcommands): | ||
51 | """ | ||
52 | Subcommand help dispatcher. | ||
53 | """ | ||
54 | if len(args) == 1 or not display_help(args[1], subcommands): | ||
55 | print(usage_str) | ||
56 | |||
57 | |||
58 | def invoke_subcommand(args, parser, main_command_usage, subcommands): | ||
59 | """ | ||
60 | Dispatch to subcommand handler borrowed from combo-layer. | ||
61 | Should use argparse, but has to work in 2.6. | ||
62 | """ | ||
63 | if not args: | ||
64 | logging.error("No subcommand specified, exiting") | ||
65 | parser.print_help() | ||
66 | elif args[0] == "help": | ||
67 | yocto_help(args, main_command_usage, subcommands) | ||
68 | elif args[0] not in subcommands: | ||
69 | logging.error("Unsupported subcommand %s, exiting\n" % (args[0])) | ||
70 | parser.print_help() | ||
71 | else: | ||
72 | usage = subcommands.get(args[0], subcommand_error)[1] | ||
73 | subcommands.get(args[0], subcommand_error)[0](args[1:], usage) | ||
74 | |||
75 | |||
76 | ## | ||
77 | # yocto-bsp help and usage strings | ||
78 | ## | ||
79 | |||
80 | yocto_bsp_usage = """ | ||
81 | |||
82 | Create a customized Yocto BSP layer. | ||
83 | |||
84 | usage: yocto-bsp [--version] [--help] COMMAND [ARGS] | ||
85 | |||
86 | Current 'yocto-bsp' commands are: | ||
87 | create Create a new Yocto BSP | ||
88 | list List available values for options and BSP properties | ||
89 | |||
90 | See 'yocto-bsp help COMMAND' for more information on a specific command. | ||
91 | """ | ||
92 | |||
93 | yocto_bsp_help_usage = """ | ||
94 | |||
95 | usage: yocto-bsp help <subcommand> | ||
96 | |||
97 | This command displays detailed help for the specified subcommand. | ||
98 | """ | ||
99 | |||
100 | yocto_bsp_create_usage = """ | ||
101 | |||
102 | Create a new Yocto BSP | ||
103 | |||
104 | usage: yocto-bsp create <bsp-name> <karch> [-o <DIRNAME> | --outdir <DIRNAME>] | ||
105 | [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>] | ||
106 | |||
107 | This command creates a Yocto BSP based on the specified parameters. | ||
108 | The new BSP will be a new Yocto BSP layer contained by default within | ||
109 | the top-level directory specified as 'meta-bsp-name'. The -o option | ||
110 | can be used to place the BSP layer in a directory with a different | ||
111 | name and location. | ||
112 | |||
113 | The value of the 'karch' parameter determines the set of files that | ||
114 | will be generated for the BSP, along with the specific set of | ||
115 | 'properties' that will be used to fill out the BSP-specific portions | ||
116 | of the BSP. The possible values for the 'karch' paramter can be | ||
117 | listed via 'yocto-bsp list karch'. | ||
118 | |||
119 | NOTE: Once created, you should add your new layer to your | ||
120 | bblayers.conf file in order for it to be subsequently seen and | ||
121 | modified by the yocto-kernel tool. | ||
122 | |||
123 | See 'yocto bsp help create' for more detailed instructions. | ||
124 | """ | ||
125 | |||
126 | yocto_bsp_create_help = """ | ||
127 | |||
128 | NAME | ||
129 | yocto-bsp create - Create a new Yocto BSP | ||
130 | |||
131 | SYNOPSIS | ||
132 | yocto-bsp create <bsp-name> <karch> [-o <DIRNAME> | --outdir <DIRNAME>] | ||
133 | [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>] | ||
134 | |||
135 | DESCRIPTION | ||
136 | This command creates a Yocto BSP based on the specified | ||
137 | parameters. The new BSP will be a new Yocto BSP layer contained | ||
138 | by default within the top-level directory specified as | ||
139 | 'meta-bsp-name'. The -o option can be used to place the BSP layer | ||
140 | in a directory with a different name and location. | ||
141 | |||
142 | The value of the 'karch' parameter determines the set of files | ||
143 | that will be generated for the BSP, along with the specific set of | ||
144 | 'properties' that will be used to fill out the BSP-specific | ||
145 | portions of the BSP. The possible values for the 'karch' paramter | ||
146 | can be listed via 'yocto-bsp list karch'. | ||
147 | |||
148 | The BSP-specific properties that define the values that will be | ||
149 | used to generate a particular BSP can be specified on the | ||
150 | command-line using the -i option and supplying a JSON object | ||
151 | consisting of the set of name:value pairs needed by the BSP. | ||
152 | |||
153 | If the -i option is not used, the user will be interactively | ||
154 | prompted for each of the required property values, which will then | ||
155 | be used as values for BSP generation. | ||
156 | |||
157 | The set of properties available for a given architecture can be | ||
158 | listed using the 'yocto-bsp list' command. | ||
159 | |||
160 | Specifying -c causes the Python code generated and executed to | ||
161 | create the BSP to be dumped to the 'bspgen.out' file in the | ||
162 | current directory, and is useful for debugging. | ||
163 | |||
164 | NOTE: Once created, you should add your new layer to your | ||
165 | bblayers.conf file in order for it to be subsequently seen and | ||
166 | modified by the yocto-kernel tool. | ||
167 | |||
168 | For example, assuming your poky repo is at /path/to/poky, your new | ||
169 | BSP layer is at /path/to/poky/meta-mybsp, and your build directory | ||
170 | is /path/to/build: | ||
171 | |||
172 | $ gedit /path/to/build/conf/bblayers.conf | ||
173 | |||
174 | BBLAYERS ?= " \\ | ||
175 | /path/to/poky/meta \\ | ||
176 | /path/to/poky/meta-yocto \\ | ||
177 | /path/to/poky/meta-mybsp \\ | ||
178 | " | ||
179 | """ | ||
180 | |||
181 | yocto_bsp_list_usage = """ | ||
182 | |||
183 | usage: yocto-bsp list karch | ||
184 | yocto-bsp list <karch> properties | ||
185 | [-o <JSON PROPERTY FILE> | --outfile <JSON PROPERTY_FILE>] | ||
186 | yocto-bsp list <karch> property <xxx> | ||
187 | [-o <JSON PROPERTY FILE> | --outfile <JSON PROPERTY_FILE>] | ||
188 | |||
189 | This command enumerates the complete set of possible values for a | ||
190 | specified option or property needed by the BSP creation process. | ||
191 | |||
192 | The first form enumerates all the possible values that exist and can | ||
193 | be specified for the 'karch' parameter to the 'yocto bsp create' | ||
194 | command. | ||
195 | |||
196 | The second form enumerates all the possible properties that exist and | ||
197 | must have values specified for them in the 'yocto bsp create' command | ||
198 | for the given 'karch'. | ||
199 | |||
200 | The third form enumerates all the possible values that exist and can | ||
201 | be specified for any of the enumerable properties of the given | ||
202 | 'karch' in the 'yocto bsp create' command. | ||
203 | |||
204 | See 'yocto-bsp help list' for more details. | ||
205 | """ | ||
206 | |||
207 | yocto_bsp_list_help = """ | ||
208 | |||
209 | NAME | ||
210 | yocto-bsp list - List available values for options and BSP properties | ||
211 | |||
212 | SYNOPSIS | ||
213 | yocto-bsp list karch | ||
214 | yocto-bsp list <karch> properties | ||
215 | [--o <JSON PROPERTY FILE> | -outfile <JSON PROPERTY_FILE>] | ||
216 | yocto-bsp list <karch> property <xxx> | ||
217 | [--o <JSON PROPERTY FILE> | -outfile <JSON PROPERTY_FILE>] | ||
218 | |||
219 | DESCRIPTION | ||
220 | This command enumerates the complete set of possible values for a | ||
221 | specified option or property needed by the BSP creation process. | ||
222 | |||
223 | The first form enumerates all the possible values that exist and | ||
224 | can be specified for the 'karch' parameter to the 'yocto bsp | ||
225 | create' command. Example output for the 'list karch' command: | ||
226 | |||
227 | $ yocto-bsp list karch | ||
228 | Architectures available: | ||
229 | arm | ||
230 | powerpc | ||
231 | i386 | ||
232 | mips | ||
233 | x86_64 | ||
234 | qemu | ||
235 | |||
236 | The second form enumerates all the possible properties that exist | ||
237 | and must have values specified for them in the 'yocto bsp create' | ||
238 | command for the given 'karch'. This command is mainly meant to | ||
239 | allow the development user interface alternatives to the default | ||
240 | text-based prompting interface. If the -o option is specified, | ||
241 | the list of properties, in addition to being displayed, will be | ||
242 | written to the specified file as a JSON object. In this case, the | ||
243 | object will consist of the set of name:value pairs corresponding | ||
244 | to the (possibly nested) dictionary of properties defined by the | ||
245 | input statements used by the BSP. Some example output for the | ||
246 | 'list properties' command: | ||
247 | |||
248 | $ yocto-bsp list arm properties | ||
249 | "touchscreen" : { | ||
250 | "msg" : Does your BSP have a touchscreen? (y/N) | ||
251 | "default" : n | ||
252 | "type" : boolean | ||
253 | } | ||
254 | "uboot_loadaddress" : { | ||
255 | "msg" : Please specify a value for UBOOT_LOADADDRESS. | ||
256 | "default" : 0x80008000 | ||
257 | "type" : edit | ||
258 | "prio" : 40 | ||
259 | } | ||
260 | "kernel_choice" : { | ||
261 | "prio" : 10 | ||
262 | "default" : linux-yocto_3.2 | ||
263 | "depends-on" : use_default_kernel | ||
264 | "depends-on-val" : n | ||
265 | "msg" : Please choose the kernel to use in this BSP => | ||
266 | "type" : choicelist | ||
267 | "gen" : bsp.kernel.kernels | ||
268 | } | ||
269 | "if kernel_choice == "linux-yocto_3.0":" : { | ||
270 | "base_kbranch_linux_yocto_3_0" : { | ||
271 | "prio" : 20 | ||
272 | "default" : yocto/standard | ||
273 | "depends-on" : new_kbranch_linux_yocto_3_0 | ||
274 | "depends-on-val" : y | ||
275 | "msg" : Please choose a machine branch to base this BSP on => | ||
276 | "type" : choicelist | ||
277 | "gen" : bsp.kernel.all_branches | ||
278 | } | ||
279 | . | ||
280 | . | ||
281 | . | ||
282 | |||
283 | Each entry in the output consists of the name of the input element | ||
284 | e.g. "touchscreen", followed by the properties defined for that | ||
285 | element enclosed in braces. This information should provide | ||
286 | sufficient information to create a complete user interface with. | ||
287 | Two features of the scheme provide for conditional input. First, | ||
288 | if a Python "if" statement appears in place of an input element | ||
289 | name, the set of enclosed input elements apply and should be | ||
290 | presented to the user only if the 'if' statement evaluates to | ||
291 | true. The test in the if statement will always reference another | ||
292 | input element in the list, which means that the element being | ||
293 | tested should be presented to the user before the elements | ||
294 | enclosed by the if block. Secondly, in a similar way, some | ||
295 | elements contain "depends-on" and depends-on-val" tags, which mean | ||
296 | that the affected input element should only be presented to the | ||
297 | user if the element it depends on has already been presented to | ||
298 | the user and the user has selected the specified value for that | ||
299 | element. | ||
300 | |||
301 | The third form enumerates all the possible values that exist and | ||
302 | can be specified for any of the enumerable properties of the given | ||
303 | 'karch' in the 'yocto bsp create' command. If the -o option is | ||
304 | specified, the list of values for the given property, in addition | ||
305 | to being displayed, will be written to the specified file as a | ||
306 | JSON object. In this case, the object will consist of the set of | ||
307 | name:value pairs corresponding to the array of property values | ||
308 | associated with the property. | ||
309 | |||
310 | $ yocto-bsp list i386 property xserver_choice | ||
311 | ["xserver_vesa", "VESA xserver support"] | ||
312 | ["xserver_i915", "i915 xserver support"] | ||
313 | |||
314 | $ yocto-bsp list arm property base_kbranch_linux_yocto_3_0 | ||
315 | Getting branches from remote repo git://git.yoctoproject.org/linux-yocto-3.0... | ||
316 | ["yocto/base", "yocto/base"] | ||
317 | ["yocto/eg20t", "yocto/eg20t"] | ||
318 | ["yocto/gma500", "yocto/gma500"] | ||
319 | ["yocto/pvr", "yocto/pvr"] | ||
320 | ["yocto/standard/arm-versatile-926ejs", "yocto/standard/arm-versatile-926ejs"] | ||
321 | ["yocto/standard/base", "yocto/standard/base"] | ||
322 | ["yocto/standard/beagleboard", "yocto/standard/beagleboard"] | ||
323 | ["yocto/standard/cedartrail", "yocto/standard/cedartrail"] | ||
324 | . | ||
325 | . | ||
326 | . | ||
327 | ["yocto/standard/qemu-ppc32", "yocto/standard/qemu-ppc32"] | ||
328 | ["yocto/standard/routerstationpro", "yocto/standard/routerstationpro"] | ||
329 | |||
330 | The third form as well is meant mainly for developers of | ||
331 | alternative interfaces - it allows the developer to fetch the | ||
332 | possible values for a given input element on-demand. This | ||
333 | on-demand capability is especially valuable for elements that | ||
334 | require relatively expensive remote operations to fulfill, such as | ||
335 | the example that returns the set of branches available in a remote | ||
336 | git tree above. | ||
337 | |||
338 | """ | ||
339 | |||
340 | ## | ||
341 | # yocto-kernel help and usage strings | ||
342 | ## | ||
343 | |||
344 | yocto_kernel_usage = """ | ||
345 | |||
346 | Modify and list Yocto BSP kernel config items and patches. | ||
347 | |||
348 | usage: yocto-kernel [--version] [--help] COMMAND [ARGS] | ||
349 | |||
350 | Current 'yocto-kernel' commands are: | ||
351 | config list List the modifiable set of bare kernel config options for a BSP | ||
352 | config add Add or modify bare kernel config options for a BSP | ||
353 | config rm Remove bare kernel config options from a BSP | ||
354 | patch list List the patches associated with a BSP | ||
355 | patch add Patch the Yocto kernel for a BSP | ||
356 | patch rm Remove patches from a BSP | ||
357 | feature list List the features used by a BSP | ||
358 | feature add Have a BSP use a feature | ||
359 | feature rm Have a BSP stop using a feature | ||
360 | features list List the features available to BSPs | ||
361 | feature describe Describe a particular feature | ||
362 | feature create Create a new BSP-local feature | ||
363 | feature destroy Remove a BSP-local feature | ||
364 | |||
365 | See 'yocto-kernel help COMMAND' for more information on a specific command. | ||
366 | |||
367 | """ | ||
368 | |||
369 | |||
370 | yocto_kernel_help_usage = """ | ||
371 | |||
372 | usage: yocto-kernel help <subcommand> | ||
373 | |||
374 | This command displays detailed help for the specified subcommand. | ||
375 | """ | ||
376 | |||
377 | yocto_kernel_config_list_usage = """ | ||
378 | |||
379 | List the modifiable set of bare kernel config options for a BSP | ||
380 | |||
381 | usage: yocto-kernel config list <bsp-name> | ||
382 | |||
383 | This command lists the 'modifiable' config items for a BSP i.e. the | ||
384 | items which are eligible for modification or removal by other | ||
385 | yocto-kernel commands. | ||
386 | |||
387 | 'modifiable' config items are the config items contained a BSP's | ||
388 | user-config.cfg base config. | ||
389 | """ | ||
390 | |||
391 | |||
392 | yocto_kernel_config_list_help = """ | ||
393 | |||
394 | NAME | ||
395 | yocto-kernel config list - List the modifiable set of bare kernel | ||
396 | config options for a BSP | ||
397 | |||
398 | SYNOPSIS | ||
399 | yocto-kernel config list <bsp-name> | ||
400 | |||
401 | DESCRIPTION | ||
402 | This command lists the 'modifiable' config items for a BSP | ||
403 | i.e. the items which are eligible for modification or removal by | ||
404 | other yocto-kernel commands. | ||
405 | """ | ||
406 | |||
407 | |||
408 | yocto_kernel_config_add_usage = """ | ||
409 | |||
410 | Add or modify bare kernel config options for a BSP | ||
411 | |||
412 | usage: yocto-kernel config add <bsp-name> [<CONFIG_XXX=x> ...] | ||
413 | |||
414 | This command adds one or more CONFIG_XXX=x items to a BSP's user-config.cfg | ||
415 | base config. | ||
416 | """ | ||
417 | |||
418 | |||
419 | yocto_kernel_config_add_help = """ | ||
420 | |||
421 | NAME | ||
422 | yocto-kernel config add - Add or modify bare kernel config options | ||
423 | for a BSP | ||
424 | |||
425 | SYNOPSIS | ||
426 | yocto-kernel config add <bsp-name> [<CONFIG_XXX=x> ...] | ||
427 | |||
428 | DESCRIPTION | ||
429 | This command adds one or more CONFIG_XXX=x items to a BSP's | ||
430 | foo.cfg base config. | ||
431 | |||
432 | NOTE: It's up to the user to determine whether or not the config | ||
433 | options being added make sense or not - this command does no | ||
434 | sanity checking or verification of any kind to ensure that a | ||
435 | config option really makes sense and will actually be set in in | ||
436 | the final config. For example, if a config option depends on | ||
437 | other config options, it will be turned off by kconfig if the | ||
438 | other options aren't set correctly. | ||
439 | """ | ||
440 | |||
441 | |||
442 | yocto_kernel_config_rm_usage = """ | ||
443 | |||
444 | Remove bare kernel config options from a BSP | ||
445 | |||
446 | usage: yocto-kernel config rm <bsp-name> | ||
447 | |||
448 | This command removes (turns off) one or more CONFIG_XXX items from a | ||
449 | BSP's user-config.cfg base config. | ||
450 | |||
451 | The set of config items available to be removed by this command for a | ||
452 | BSP is listed and the user prompted for the specific items to remove. | ||
453 | """ | ||
454 | |||
455 | |||
456 | yocto_kernel_config_rm_help = """ | ||
457 | |||
458 | NAME | ||
459 | yocto-kernel config rm - Remove bare kernel config options from a | ||
460 | BSP | ||
461 | |||
462 | SYNOPSIS | ||
463 | yocto-kernel config rm <bsp-name> | ||
464 | |||
465 | DESCRIPTION | ||
466 | This command removes (turns off) one or more CONFIG_XXX items from a | ||
467 | BSP's user-config.cfg base config. | ||
468 | |||
469 | The set of config items available to be removed by this command | ||
470 | for a BSP is listed and the user prompted for the specific items | ||
471 | to remove. | ||
472 | """ | ||
473 | |||
474 | |||
475 | yocto_kernel_patch_list_usage = """ | ||
476 | |||
477 | List the patches associated with the kernel for a BSP | ||
478 | |||
479 | usage: yocto-kernel patch list <bsp-name> | ||
480 | |||
481 | This command lists the patches associated with a BSP. | ||
482 | |||
483 | NOTE: this only applies to patches listed in the kernel recipe's | ||
484 | user-patches.scc file (and currently repeated in its SRC_URI). | ||
485 | """ | ||
486 | |||
487 | |||
488 | yocto_kernel_patch_list_help = """ | ||
489 | |||
490 | NAME | ||
491 | yocto-kernel patch list - List the patches associated with the kernel | ||
492 | for a BSP | ||
493 | |||
494 | SYNOPSIS | ||
495 | yocto-kernel patch list <bsp-name> | ||
496 | |||
497 | DESCRIPTION | ||
498 | This command lists the patches associated with a BSP. | ||
499 | |||
500 | NOTE: this only applies to patches listed in the kernel recipe's | ||
501 | user-patches.scc file (and currently repeated in its SRC_URI). | ||
502 | """ | ||
503 | |||
504 | |||
505 | yocto_kernel_patch_add_usage = """ | ||
506 | |||
507 | Patch the Yocto kernel for a specific BSP | ||
508 | |||
509 | usage: yocto-kernel patch add <bsp-name> [<PATCH> ...] | ||
510 | |||
511 | This command adds one or more patches to a BSP's machine branch. The | ||
512 | patch will be added to the BSP's linux-yocto kernel user-patches.scc | ||
513 | file (and currently repeated in its SRC_URI) and will be guaranteed | ||
514 | to be applied in the order specified. | ||
515 | """ | ||
516 | |||
517 | |||
518 | yocto_kernel_patch_add_help = """ | ||
519 | |||
520 | NAME | ||
521 | yocto-kernel patch add - Patch the Yocto kernel for a specific BSP | ||
522 | |||
523 | SYNOPSIS | ||
524 | yocto-kernel patch add <bsp-name> [<PATCH> ...] | ||
525 | |||
526 | DESCRIPTION | ||
527 | This command adds one or more patches to a BSP's machine branch. | ||
528 | The patch will be added to the BSP's linux-yocto kernel | ||
529 | user-patches.scc file (and currently repeated in its SRC_URI) and | ||
530 | will be guaranteed to be applied in the order specified. | ||
531 | |||
532 | NOTE: It's up to the user to determine whether or not the patches | ||
533 | being added makes sense or not - this command does no sanity | ||
534 | checking or verification of any kind to ensure that a patch can | ||
535 | actually be applied to the BSP's kernel branch; it's assumed that | ||
536 | the user has already done that. | ||
537 | """ | ||
538 | |||
539 | |||
540 | yocto_kernel_patch_rm_usage = """ | ||
541 | |||
542 | Remove a patch from the Yocto kernel for a specific BSP | ||
543 | |||
544 | usage: yocto-kernel patch rm <bsp-name> | ||
545 | |||
546 | This command removes one or more patches from a BSP's machine branch. | ||
547 | The patch will be removed from the BSP's linux-yocto kernel | ||
548 | user-patches.scc file (and currently repeated in its SRC_URI) and | ||
549 | kernel SRC_URI dir. | ||
550 | |||
551 | The set of patches available to be removed by this command for a BSP | ||
552 | is listed and the user prompted for the specific patches to remove. | ||
553 | """ | ||
554 | |||
555 | |||
556 | yocto_kernel_patch_rm_help = """ | ||
557 | |||
558 | NAME | ||
559 | yocto-kernel patch rm - Remove a patch from the Yocto kernel for a specific BSP | ||
560 | |||
561 | SYNOPSIS | ||
562 | yocto-kernel patch rm <bsp-name> | ||
563 | |||
564 | DESCRIPTION | ||
565 | This command removes one or more patches from a BSP's machine | ||
566 | branch. The patch will be removed from the BSP's linux-yocto | ||
567 | kernel user-patches.scc file (and currently repeated in its | ||
568 | SRC_URI). | ||
569 | |||
570 | The set of patches available to be removed by this command for a | ||
571 | BSP is listed and the user prompted for the specific patches to | ||
572 | remove. | ||
573 | """ | ||
574 | |||
575 | yocto_kernel_feature_list_usage = """ | ||
576 | |||
577 | List the BSP features that are being used by a BSP | ||
578 | |||
579 | usage: yocto-kernel feature list <bsp-name> | ||
580 | |||
581 | This command lists the features being used by a BSP i.e. the features | ||
582 | which are eligible for modification or removal by other yocto-kernel | ||
583 | commands. | ||
584 | |||
585 | 'modifiable' features are the features listed in a BSP's | ||
586 | user-features.scc file. | ||
587 | """ | ||
588 | |||
589 | |||
590 | yocto_kernel_feature_list_help = """ | ||
591 | |||
592 | NAME | ||
593 | yocto-kernel feature list - List the modifiable set of features | ||
594 | being used by a BSP | ||
595 | |||
596 | SYNOPSIS | ||
597 | yocto-kernel feature list <bsp-name> | ||
598 | |||
599 | DESCRIPTION | ||
600 | This command lists the 'modifiable' features being used by a BSP | ||
601 | i.e. the features which are eligible for modification or removal | ||
602 | by other yocto-kernel commands. | ||
603 | """ | ||
604 | |||
605 | |||
606 | yocto_kernel_feature_add_usage = """ | ||
607 | |||
608 | Add to or modify the list of features being used for a BSP | ||
609 | |||
610 | usage: yocto-kernel feature add <bsp-name> [/xxxx/yyyy/feature.scc ...] | ||
611 | |||
612 | This command adds one or more feature items to a BSP's kernel | ||
613 | user-features.scc file, which is the file used to manage features in | ||
614 | a yocto-bsp-generated BSP. Features to be added must be specified as | ||
615 | fully-qualified feature names. | ||
616 | """ | ||
617 | |||
618 | |||
619 | yocto_kernel_feature_add_help = """ | ||
620 | |||
621 | NAME | ||
622 | yocto-kernel feature add - Add to or modify the list of features | ||
623 | being used for a BSP | ||
624 | |||
625 | SYNOPSIS | ||
626 | yocto-kernel feature add <bsp-name> [/xxxx/yyyy/feature.scc ...] | ||
627 | |||
628 | DESCRIPTION | ||
629 | This command adds one or more feature items to a BSP's | ||
630 | user-features.scc file, which is the file used to manage features | ||
631 | in a yocto-bsp-generated BSP. Features to be added must be | ||
632 | specified as fully-qualified feature names. | ||
633 | """ | ||
634 | |||
635 | |||
636 | yocto_kernel_feature_rm_usage = """ | ||
637 | |||
638 | Remove a feature from the list of features being used for a BSP | ||
639 | |||
640 | usage: yocto-kernel feature rm <bsp-name> | ||
641 | |||
642 | This command removes (turns off) one or more features from a BSP's | ||
643 | user-features.scc file, which is the file used to manage features in | ||
644 | a yocto-bsp-generated BSP. | ||
645 | |||
646 | The set of features available to be removed by this command for a BSP | ||
647 | is listed and the user prompted for the specific items to remove. | ||
648 | """ | ||
649 | |||
650 | |||
651 | yocto_kernel_feature_rm_help = """ | ||
652 | |||
653 | NAME | ||
654 | yocto-kernel feature rm - Remove a feature from the list of | ||
655 | features being used for a BSP | ||
656 | |||
657 | SYNOPSIS | ||
658 | yocto-kernel feature rm <bsp-name> | ||
659 | |||
660 | DESCRIPTION | ||
661 | This command removes (turns off) one or more features from a BSP's | ||
662 | user-features.scc file, which is the file used to manage features | ||
663 | in a yocto-bsp-generated BSP. | ||
664 | |||
665 | The set of features available to be removed by this command for a | ||
666 | BSP is listed and the user prompted for the specific items to | ||
667 | remove. | ||
668 | """ | ||
669 | |||
670 | |||
671 | yocto_kernel_available_features_list_usage = """ | ||
672 | |||
673 | List the set of kernel features available to a BSP | ||
674 | |||
675 | usage: yocto-kernel features list <bsp-name> | ||
676 | |||
677 | This command lists the complete set of kernel features available to a | ||
678 | BSP. This includes the features contained in linux-yocto meta | ||
679 | branches as well as recipe-space features defined locally to the BSP. | ||
680 | """ | ||
681 | |||
682 | |||
683 | yocto_kernel_available_features_list_help = """ | ||
684 | |||
685 | NAME | ||
686 | yocto-kernel features list - List the set of kernel features | ||
687 | available to a BSP | ||
688 | |||
689 | SYNOPSIS | ||
690 | yocto-kernel features list <bsp-name> | ||
691 | |||
692 | DESCRIPTION | ||
693 | This command lists the complete set of kernel features available | ||
694 | to a BSP. This includes the features contained in linux-yocto | ||
695 | meta branches as well as recipe-space features defined locally to | ||
696 | the BSP. | ||
697 | """ | ||
698 | |||
699 | |||
700 | yocto_kernel_feature_describe_usage = """ | ||
701 | |||
702 | Print the description and compatibility information for a given kernel feature | ||
703 | |||
704 | usage: yocto-kernel feature describe <bsp-name> [/xxxx/yyyy/feature.scc ...] | ||
705 | |||
706 | This command prints the description and compatibility of a specific | ||
707 | feature in the format 'description [compatibility]. | ||
708 | """ | ||
709 | |||
710 | |||
711 | yocto_kernel_feature_describe_help = """ | ||
712 | |||
713 | NAME | ||
714 | yocto-kernel feature describe - print the description and | ||
715 | compatibility information for a given kernel feature | ||
716 | |||
717 | SYNOPSIS | ||
718 | yocto-kernel feature describe <bsp-name> [/xxxx/yyyy/feature.scc ...] | ||
719 | |||
720 | DESCRIPTION | ||
721 | This command prints the description and compatibility of a | ||
722 | specific feature in the format 'description [compatibility]. If | ||
723 | the feature doesn't define a description or compatibility, a | ||
724 | string with generic unknown values will be printed. | ||
725 | """ | ||
726 | |||
727 | |||
728 | yocto_kernel_feature_create_usage = """ | ||
729 | |||
730 | Create a recipe-space kernel feature in a BSP | ||
731 | |||
732 | usage: yocto-kernel feature create <bsp-name> newfeature.scc \ | ||
733 | "Feature Description" capabilities [<CONFIG_XXX=x> ...] [<PATCH> ...] | ||
734 | |||
735 | This command creates a new kernel feature from the bare config | ||
736 | options and patches specified on the command-line. | ||
737 | """ | ||
738 | |||
739 | |||
740 | yocto_kernel_feature_create_help = """ | ||
741 | |||
742 | NAME | ||
743 | yocto-kernel feature create - create a recipe-space kernel feature | ||
744 | in a BSP | ||
745 | |||
746 | SYNOPSIS | ||
747 | yocto-kernel feature create <bsp-name> newfeature.scc \ | ||
748 | "Feature Description" capabilities [<CONFIG_XXX=x> ...] [<PATCH> ...] | ||
749 | |||
750 | DESCRIPTION | ||
751 | This command creates a new kernel feature from the bare config | ||
752 | options and patches specified on the command-line. The new | ||
753 | feature will be created in recipe-space, specifically in either | ||
754 | the kernel .bbappend's /files/cfg or /files/features subdirectory, | ||
755 | depending on whether or not the feature contains config items only | ||
756 | or config items along with patches. The named feature must end | ||
757 | with .scc and must not contain a feature directory to contain the | ||
758 | feature (this will be determined automatically), and a feature | ||
759 | decription in double-quotes along with a capabilities string | ||
760 | (which for the time being can be one of: 'all' or 'board'). | ||
761 | """ | ||
762 | |||
763 | |||
764 | yocto_kernel_feature_destroy_usage = """ | ||
765 | |||
766 | Destroy a recipe-space kernel feature in a BSP | ||
767 | |||
768 | usage: yocto-kernel feature destroy <bsp-name> feature.scc | ||
769 | |||
770 | This command destroys a kernel feature defined in the specified BSP's | ||
771 | recipe-space kernel definition. | ||
772 | """ | ||
773 | |||
774 | |||
775 | yocto_kernel_feature_destroy_help = """ | ||
776 | |||
777 | NAME | ||
778 | yocto-kernel feature destroy <bsp-name> feature.scc - destroy a | ||
779 | recipe-space kernel feature in a BSP | ||
780 | |||
781 | SYNOPSIS | ||
782 | yocto-kernel feature destroy <bsp-name> feature.scc | ||
783 | |||
784 | DESCRIPTION | ||
785 | This command destroys a kernel feature defined in the specified | ||
786 | BSP's recipe-space kernel definition. The named feature must end | ||
787 | with .scc and must not contain a feature directory to contain the | ||
788 | feature (this will be determined automatically). If the kernel | ||
789 | feature is in use by a BSP, it can't be removed until the BSP | ||
790 | stops using it (see yocto-kernel feature rm to stop using it). | ||
791 | """ | ||
792 | |||
793 | ## | ||
794 | # yocto-layer help and usage strings | ||
795 | ## | ||
796 | |||
797 | yocto_layer_usage = """ | ||
798 | |||
799 | Create a generic Yocto layer. | ||
800 | |||
801 | usage: yocto-layer [--version] [--help] COMMAND [ARGS] | ||
802 | |||
803 | Current 'yocto-layer' commands are: | ||
804 | create Create a new generic Yocto layer | ||
805 | list List available values for input options and properties | ||
806 | |||
807 | See 'yocto-layer help COMMAND' for more information on a specific command. | ||
808 | """ | ||
809 | |||
810 | yocto_layer_help_usage = """ | ||
811 | |||
812 | usage: yocto-layer help <subcommand> | ||
813 | |||
814 | This command displays detailed help for the specified subcommand. | ||
815 | """ | ||
816 | |||
817 | yocto_layer_create_usage = """ | ||
818 | |||
819 | Create a new generic Yocto layer | ||
820 | |||
821 | usage: yocto-layer create <layer-name> [layer_priority] | ||
822 | [-o <DIRNAME> | --outdir <DIRNAME>] | ||
823 | [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>] | ||
824 | |||
825 | This command creates a generic Yocto layer based on the specified | ||
826 | parameters. The new layer will be a new Yocto layer contained by | ||
827 | default within the top-level directory specified as | ||
828 | 'meta-layer-name'. The -o option can be used to place the layer in a | ||
829 | directory with a different name and location. | ||
830 | |||
831 | If layer_priority is specified, a simple layer will be created using | ||
832 | the given layer priority, and the user will not be prompted for | ||
833 | further input. | ||
834 | |||
835 | NOTE: Once created, you should add your new layer to your | ||
836 | bblayers.conf file in order for it to be subsequently seen and | ||
837 | modified by the yocto-kernel tool. Instructions for doing this can | ||
838 | be found in the README file generated in the layer's top-level | ||
839 | directory. | ||
840 | |||
841 | See 'yocto layer help create' for more detailed instructions. | ||
842 | """ | ||
843 | |||
844 | yocto_layer_create_help = """ | ||
845 | |||
846 | NAME | ||
847 | yocto-layer create - Create a new generic Yocto layer | ||
848 | |||
849 | SYNOPSIS | ||
850 | yocto-layer create <layer-name> [layer_priority] | ||
851 | [-o <DIRNAME> | --outdir <DIRNAME>] | ||
852 | [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>] | ||
853 | |||
854 | DESCRIPTION | ||
855 | This command creates a generic Yocto layer based on the specified | ||
856 | parameters. The new layer will be a new Yocto layer contained by | ||
857 | default within the top-level directory specified as | ||
858 | 'meta-layer-name'. The -o option can be used to place the layer | ||
859 | in a directory with a different name and location. | ||
860 | |||
861 | If layer_priority is specified, a simple layer will be created | ||
862 | using the given layer priority, and the user will not be prompted | ||
863 | for further input. | ||
864 | |||
865 | The layer-specific properties that define the values that will be | ||
866 | used to generate the layer can be specified on the command-line | ||
867 | using the -i option and supplying a JSON object consisting of the | ||
868 | set of name:value pairs needed by the layer. | ||
869 | |||
870 | If the -i option is not used, the user will be interactively | ||
871 | prompted for each of the required property values, which will then | ||
872 | be used as values for layer generation. | ||
873 | |||
874 | The set of properties available can be listed using the | ||
875 | 'yocto-layer list' command. | ||
876 | |||
877 | Specifying -c causes the Python code generated and executed to | ||
878 | create the layer to be dumped to the 'bspgen.out' file in the | ||
879 | current directory, and is useful for debugging. | ||
880 | |||
881 | NOTE: Once created, you should add your new layer to your | ||
882 | bblayers.conf file in order for it to be subsequently seen and | ||
883 | modified by the yocto-kernel tool. Instructions for doing this | ||
884 | can be found in the README file generated in the layer's top-level | ||
885 | directory. | ||
886 | |||
887 | For example, assuming your poky repo is at /path/to/poky, your new | ||
888 | layer is at /path/to/poky/meta-mylayer, and your build directory | ||
889 | is /path/to/build: | ||
890 | |||
891 | $ gedit /path/to/build/conf/bblayers.conf | ||
892 | |||
893 | BBLAYERS ?= " \\ | ||
894 | /path/to/poky/meta \\ | ||
895 | /path/to/poky/meta-yocto \\ | ||
896 | /path/to/poky/meta-mylayer \\ | ||
897 | " | ||
898 | """ | ||
899 | |||
900 | yocto_layer_list_usage = """ | ||
901 | |||
902 | usage: yocto-layer list properties | ||
903 | [-o <JSON PROPERTY FILE> | --outfile <JSON PROPERTY_FILE>] | ||
904 | yocto-layer list property <xxx> | ||
905 | [-o <JSON PROPERTY FILE> | --outfile <JSON PROPERTY_FILE>] | ||
906 | |||
907 | This command enumerates the complete set of possible values for a | ||
908 | specified option or property needed by the layer creation process. | ||
909 | |||
910 | The first form enumerates all the possible properties that exist and | ||
911 | must have values specified for them in the 'yocto-layer create' | ||
912 | command. | ||
913 | |||
914 | The second form enumerates all the possible values that exist and can | ||
915 | be specified for any of the enumerable properties in the 'yocto-layer | ||
916 | create' command. | ||
917 | |||
918 | See 'yocto-layer help list' for more details. | ||
919 | """ | ||
920 | |||
921 | yocto_layer_list_help = """ | ||
922 | |||
923 | NAME | ||
924 | yocto-layer list - List available values for layer input options and properties | ||
925 | |||
926 | SYNOPSIS | ||
927 | yocto-layer list properties | ||
928 | [--o <JSON PROPERTY FILE> | -outfile <JSON PROPERTY_FILE>] | ||
929 | yocto-layer list property <xxx> | ||
930 | [--o <JSON PROPERTY FILE> | -outfile <JSON PROPERTY_FILE>] | ||
931 | |||
932 | DESCRIPTION | ||
933 | This command enumerates the complete set of possible values for a | ||
934 | specified option or property needed by the layer creation process. | ||
935 | |||
936 | The first form enumerates all the possible properties that exist | ||
937 | and must have values specified for them in the 'yocto-layer | ||
938 | create' command. This command is mainly meant to aid the | ||
939 | development of user interface alternatives to the default | ||
940 | text-based prompting interface. If the -o option is specified, | ||
941 | the list of properties, in addition to being displayed, will be | ||
942 | written to the specified file as a JSON object. In this case, the | ||
943 | object will consist of the set of name:value pairs corresponding | ||
944 | to the (possibly nested) dictionary of properties defined by the | ||
945 | input statements used by the BSP. Some example output for the | ||
946 | 'list properties' command: | ||
947 | |||
948 | $ yocto-layer list properties | ||
949 | "example_bbappend_name" : { | ||
950 | "default" : example | ||
951 | "msg" : Please enter the name you'd like to use for your bbappend file: | ||
952 | "type" : edit | ||
953 | "prio" : 20 | ||
954 | "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall | ||
955 | } | ||
956 | "create_example_recipe" : { | ||
957 | "default" : n | ||
958 | "msg" : Would you like to have an example recipe created? (y/n) | ||
959 | "type" : boolean | ||
960 | "prio" : 20 | ||
961 | "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall | ||
962 | } | ||
963 | "example_recipe_name" : { | ||
964 | "default" : example | ||
965 | "msg" : Please enter the name you'd like to use for your example recipe: | ||
966 | "type" : edit | ||
967 | "prio" : 20 | ||
968 | "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall | ||
969 | } | ||
970 | "layer_priority" : { | ||
971 | "default" : 6 | ||
972 | "msg" : Please enter the layer priority you'd like to use for the layer: | ||
973 | "type" : edit | ||
974 | "prio" : 20 | ||
975 | "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall | ||
976 | } | ||
977 | "create_example_bbappend" : { | ||
978 | "default" : n | ||
979 | "msg" : Would you like to have an example bbappend file created? (y/n) | ||
980 | "type" : boolean | ||
981 | "prio" : 20 | ||
982 | "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall | ||
983 | } | ||
984 | "example_bbappend_version" : { | ||
985 | "default" : 0.1 | ||
986 | "msg" : Please enter the version number you'd like to use for your bbappend file (this should match the recipe you're appending to): | ||
987 | "type" : edit | ||
988 | "prio" : 20 | ||
989 | "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall | ||
990 | } | ||
991 | |||
992 | Each entry in the output consists of the name of the input element | ||
993 | e.g. "layer_priority", followed by the properties defined for that | ||
994 | element enclosed in braces. This information should provide | ||
995 | sufficient information to create a complete user interface. Two | ||
996 | features of the scheme provide for conditional input. First, if a | ||
997 | Python "if" statement appears in place of an input element name, | ||
998 | the set of enclosed input elements apply and should be presented | ||
999 | to the user only if the 'if' statement evaluates to true. The | ||
1000 | test in the if statement will always reference another input | ||
1001 | element in the list, which means that the element being tested | ||
1002 | should be presented to the user before the elements enclosed by | ||
1003 | the if block. Secondly, in a similar way, some elements contain | ||
1004 | "depends-on" and depends-on-val" tags, which mean that the | ||
1005 | affected input element should only be presented to the user if the | ||
1006 | element it depends on has already been presented to the user and | ||
1007 | the user has selected the specified value for that element. | ||
1008 | |||
1009 | The second form enumerates all the possible values that exist and | ||
1010 | can be specified for any of the enumerable properties in the | ||
1011 | 'yocto-layer create' command. If the -o option is specified, the | ||
1012 | list of values for the given property, in addition to being | ||
1013 | displayed, will be written to the specified file as a JSON object. | ||
1014 | In this case, the object will consist of the set of name:value | ||
1015 | pairs corresponding to the array of property values associated | ||
1016 | with the property. | ||
1017 | |||
1018 | $ yocto-layer list property layer_priority | ||
1019 | [no output - layer_priority is a text field that has no enumerable values] | ||
1020 | |||
1021 | The second form as well is meant mainly for developers of | ||
1022 | alternative interfaces - it allows the developer to fetch the | ||
1023 | possible values for a given input element on-demand. This | ||
1024 | on-demand capability is especially valuable for elements that | ||
1025 | require relatively expensive remote operations to fulfill, such as | ||
1026 | the example that returns the set of branches available in a remote | ||
1027 | git tree above. | ||
1028 | |||
1029 | """ | ||
1030 | |||
1031 | ## | ||
1032 | # test code | ||
1033 | ## | ||
1034 | |||
1035 | test_bsp_properties = { | ||
1036 | 'smp': 'yes', | ||
1037 | 'touchscreen': 'yes', | ||
1038 | 'keyboard': 'no', | ||
1039 | 'xserver': 'yes', | ||
1040 | 'xserver_choice': 'xserver-i915', | ||
1041 | 'features': ['goodfeature', 'greatfeature'], | ||
1042 | 'tunefile': 'tune-quark', | ||
1043 | } | ||
1044 | |||