diff options
Diffstat (limited to 'scripts/lib/bsp/help.py')
-rw-r--r-- | scripts/lib/bsp/help.py | 1043 |
1 files changed, 1043 insertions, 0 deletions
diff --git a/scripts/lib/bsp/help.py b/scripts/lib/bsp/help.py new file mode 100644 index 0000000000..7c436d6be0 --- /dev/null +++ b/scripts/lib/bsp/help.py | |||
@@ -0,0 +1,1043 @@ | |||
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/cedartrail", "yocto/standard/cedartrail"] | ||
323 | . | ||
324 | . | ||
325 | . | ||
326 | ["yocto/standard/qemu-ppc32", "yocto/standard/qemu-ppc32"] | ||
327 | ["yocto/standard/routerstationpro", "yocto/standard/routerstationpro"] | ||
328 | |||
329 | The third form as well is meant mainly for developers of | ||
330 | alternative interfaces - it allows the developer to fetch the | ||
331 | possible values for a given input element on-demand. This | ||
332 | on-demand capability is especially valuable for elements that | ||
333 | require relatively expensive remote operations to fulfill, such as | ||
334 | the example that returns the set of branches available in a remote | ||
335 | git tree above. | ||
336 | |||
337 | """ | ||
338 | |||
339 | ## | ||
340 | # yocto-kernel help and usage strings | ||
341 | ## | ||
342 | |||
343 | yocto_kernel_usage = """ | ||
344 | |||
345 | Modify and list Yocto BSP kernel config items and patches. | ||
346 | |||
347 | usage: yocto-kernel [--version] [--help] COMMAND [ARGS] | ||
348 | |||
349 | Current 'yocto-kernel' commands are: | ||
350 | config list List the modifiable set of bare kernel config options for a BSP | ||
351 | config add Add or modify bare kernel config options for a BSP | ||
352 | config rm Remove bare kernel config options from a BSP | ||
353 | patch list List the patches associated with a BSP | ||
354 | patch add Patch the Yocto kernel for a BSP | ||
355 | patch rm Remove patches from a BSP | ||
356 | feature list List the features used by a BSP | ||
357 | feature add Have a BSP use a feature | ||
358 | feature rm Have a BSP stop using a feature | ||
359 | features list List the features available to BSPs | ||
360 | feature describe Describe a particular feature | ||
361 | feature create Create a new BSP-local feature | ||
362 | feature destroy Remove a BSP-local feature | ||
363 | |||
364 | See 'yocto-kernel help COMMAND' for more information on a specific command. | ||
365 | |||
366 | """ | ||
367 | |||
368 | |||
369 | yocto_kernel_help_usage = """ | ||
370 | |||
371 | usage: yocto-kernel help <subcommand> | ||
372 | |||
373 | This command displays detailed help for the specified subcommand. | ||
374 | """ | ||
375 | |||
376 | yocto_kernel_config_list_usage = """ | ||
377 | |||
378 | List the modifiable set of bare kernel config options for a BSP | ||
379 | |||
380 | usage: yocto-kernel config list <bsp-name> | ||
381 | |||
382 | This command lists the 'modifiable' config items for a BSP i.e. the | ||
383 | items which are eligible for modification or removal by other | ||
384 | yocto-kernel commands. | ||
385 | |||
386 | 'modifiable' config items are the config items contained a BSP's | ||
387 | user-config.cfg base config. | ||
388 | """ | ||
389 | |||
390 | |||
391 | yocto_kernel_config_list_help = """ | ||
392 | |||
393 | NAME | ||
394 | yocto-kernel config list - List the modifiable set of bare kernel | ||
395 | config options for a BSP | ||
396 | |||
397 | SYNOPSIS | ||
398 | yocto-kernel config list <bsp-name> | ||
399 | |||
400 | DESCRIPTION | ||
401 | This command lists the 'modifiable' config items for a BSP | ||
402 | i.e. the items which are eligible for modification or removal by | ||
403 | other yocto-kernel commands. | ||
404 | """ | ||
405 | |||
406 | |||
407 | yocto_kernel_config_add_usage = """ | ||
408 | |||
409 | Add or modify bare kernel config options for a BSP | ||
410 | |||
411 | usage: yocto-kernel config add <bsp-name> [<CONFIG_XXX=x> ...] | ||
412 | |||
413 | This command adds one or more CONFIG_XXX=x items to a BSP's user-config.cfg | ||
414 | base config. | ||
415 | """ | ||
416 | |||
417 | |||
418 | yocto_kernel_config_add_help = """ | ||
419 | |||
420 | NAME | ||
421 | yocto-kernel config add - Add or modify bare kernel config options | ||
422 | for a BSP | ||
423 | |||
424 | SYNOPSIS | ||
425 | yocto-kernel config add <bsp-name> [<CONFIG_XXX=x> ...] | ||
426 | |||
427 | DESCRIPTION | ||
428 | This command adds one or more CONFIG_XXX=x items to a BSP's | ||
429 | foo.cfg base config. | ||
430 | |||
431 | NOTE: It's up to the user to determine whether or not the config | ||
432 | options being added make sense or not - this command does no | ||
433 | sanity checking or verification of any kind to ensure that a | ||
434 | config option really makes sense and will actually be set in in | ||
435 | the final config. For example, if a config option depends on | ||
436 | other config options, it will be turned off by kconfig if the | ||
437 | other options aren't set correctly. | ||
438 | """ | ||
439 | |||
440 | |||
441 | yocto_kernel_config_rm_usage = """ | ||
442 | |||
443 | Remove bare kernel config options from a BSP | ||
444 | |||
445 | usage: yocto-kernel config rm <bsp-name> | ||
446 | |||
447 | This command removes (turns off) one or more CONFIG_XXX items from a | ||
448 | BSP's user-config.cfg base config. | ||
449 | |||
450 | The set of config items available to be removed by this command for a | ||
451 | BSP is listed and the user prompted for the specific items to remove. | ||
452 | """ | ||
453 | |||
454 | |||
455 | yocto_kernel_config_rm_help = """ | ||
456 | |||
457 | NAME | ||
458 | yocto-kernel config rm - Remove bare kernel config options from a | ||
459 | BSP | ||
460 | |||
461 | SYNOPSIS | ||
462 | yocto-kernel config rm <bsp-name> | ||
463 | |||
464 | DESCRIPTION | ||
465 | This command removes (turns off) one or more CONFIG_XXX items from a | ||
466 | BSP's user-config.cfg base config. | ||
467 | |||
468 | The set of config items available to be removed by this command | ||
469 | for a BSP is listed and the user prompted for the specific items | ||
470 | to remove. | ||
471 | """ | ||
472 | |||
473 | |||
474 | yocto_kernel_patch_list_usage = """ | ||
475 | |||
476 | List the patches associated with the kernel for a BSP | ||
477 | |||
478 | usage: yocto-kernel patch list <bsp-name> | ||
479 | |||
480 | This command lists the patches associated with a BSP. | ||
481 | |||
482 | NOTE: this only applies to patches listed in the kernel recipe's | ||
483 | user-patches.scc file (and currently repeated in its SRC_URI). | ||
484 | """ | ||
485 | |||
486 | |||
487 | yocto_kernel_patch_list_help = """ | ||
488 | |||
489 | NAME | ||
490 | yocto-kernel patch list - List the patches associated with the kernel | ||
491 | for a BSP | ||
492 | |||
493 | SYNOPSIS | ||
494 | yocto-kernel patch list <bsp-name> | ||
495 | |||
496 | DESCRIPTION | ||
497 | This command lists the patches associated with a BSP. | ||
498 | |||
499 | NOTE: this only applies to patches listed in the kernel recipe's | ||
500 | user-patches.scc file (and currently repeated in its SRC_URI). | ||
501 | """ | ||
502 | |||
503 | |||
504 | yocto_kernel_patch_add_usage = """ | ||
505 | |||
506 | Patch the Yocto kernel for a specific BSP | ||
507 | |||
508 | usage: yocto-kernel patch add <bsp-name> [<PATCH> ...] | ||
509 | |||
510 | This command adds one or more patches to a BSP's machine branch. The | ||
511 | patch will be added to the BSP's linux-yocto kernel user-patches.scc | ||
512 | file (and currently repeated in its SRC_URI) and will be guaranteed | ||
513 | to be applied in the order specified. | ||
514 | """ | ||
515 | |||
516 | |||
517 | yocto_kernel_patch_add_help = """ | ||
518 | |||
519 | NAME | ||
520 | yocto-kernel patch add - Patch the Yocto kernel for a specific BSP | ||
521 | |||
522 | SYNOPSIS | ||
523 | yocto-kernel patch add <bsp-name> [<PATCH> ...] | ||
524 | |||
525 | DESCRIPTION | ||
526 | This command adds one or more patches to a BSP's machine branch. | ||
527 | The patch will be added to the BSP's linux-yocto kernel | ||
528 | user-patches.scc file (and currently repeated in its SRC_URI) and | ||
529 | will be guaranteed to be applied in the order specified. | ||
530 | |||
531 | NOTE: It's up to the user to determine whether or not the patches | ||
532 | being added makes sense or not - this command does no sanity | ||
533 | checking or verification of any kind to ensure that a patch can | ||
534 | actually be applied to the BSP's kernel branch; it's assumed that | ||
535 | the user has already done that. | ||
536 | """ | ||
537 | |||
538 | |||
539 | yocto_kernel_patch_rm_usage = """ | ||
540 | |||
541 | Remove a patch from the Yocto kernel for a specific BSP | ||
542 | |||
543 | usage: yocto-kernel patch rm <bsp-name> | ||
544 | |||
545 | This command removes one or more patches from a BSP's machine branch. | ||
546 | The patch will be removed from the BSP's linux-yocto kernel | ||
547 | user-patches.scc file (and currently repeated in its SRC_URI) and | ||
548 | kernel SRC_URI dir. | ||
549 | |||
550 | The set of patches available to be removed by this command for a BSP | ||
551 | is listed and the user prompted for the specific patches to remove. | ||
552 | """ | ||
553 | |||
554 | |||
555 | yocto_kernel_patch_rm_help = """ | ||
556 | |||
557 | NAME | ||
558 | yocto-kernel patch rm - Remove a patch from the Yocto kernel for a specific BSP | ||
559 | |||
560 | SYNOPSIS | ||
561 | yocto-kernel patch rm <bsp-name> | ||
562 | |||
563 | DESCRIPTION | ||
564 | This command removes one or more patches from a BSP's machine | ||
565 | branch. The patch will be removed from the BSP's linux-yocto | ||
566 | kernel user-patches.scc file (and currently repeated in its | ||
567 | SRC_URI). | ||
568 | |||
569 | The set of patches available to be removed by this command for a | ||
570 | BSP is listed and the user prompted for the specific patches to | ||
571 | remove. | ||
572 | """ | ||
573 | |||
574 | yocto_kernel_feature_list_usage = """ | ||
575 | |||
576 | List the BSP features that are being used by a BSP | ||
577 | |||
578 | usage: yocto-kernel feature list <bsp-name> | ||
579 | |||
580 | This command lists the features being used by a BSP i.e. the features | ||
581 | which are eligible for modification or removal by other yocto-kernel | ||
582 | commands. | ||
583 | |||
584 | 'modifiable' features are the features listed in a BSP's | ||
585 | user-features.scc file. | ||
586 | """ | ||
587 | |||
588 | |||
589 | yocto_kernel_feature_list_help = """ | ||
590 | |||
591 | NAME | ||
592 | yocto-kernel feature list - List the modifiable set of features | ||
593 | being used by a BSP | ||
594 | |||
595 | SYNOPSIS | ||
596 | yocto-kernel feature list <bsp-name> | ||
597 | |||
598 | DESCRIPTION | ||
599 | This command lists the 'modifiable' features being used by a BSP | ||
600 | i.e. the features which are eligible for modification or removal | ||
601 | by other yocto-kernel commands. | ||
602 | """ | ||
603 | |||
604 | |||
605 | yocto_kernel_feature_add_usage = """ | ||
606 | |||
607 | Add to or modify the list of features being used for a BSP | ||
608 | |||
609 | usage: yocto-kernel feature add <bsp-name> [/xxxx/yyyy/feature.scc ...] | ||
610 | |||
611 | This command adds one or more feature items to a BSP's kernel | ||
612 | user-features.scc file, which is the file used to manage features in | ||
613 | a yocto-bsp-generated BSP. Features to be added must be specified as | ||
614 | fully-qualified feature names. | ||
615 | """ | ||
616 | |||
617 | |||
618 | yocto_kernel_feature_add_help = """ | ||
619 | |||
620 | NAME | ||
621 | yocto-kernel feature add - Add to or modify the list of features | ||
622 | being used for a BSP | ||
623 | |||
624 | SYNOPSIS | ||
625 | yocto-kernel feature add <bsp-name> [/xxxx/yyyy/feature.scc ...] | ||
626 | |||
627 | DESCRIPTION | ||
628 | This command adds one or more feature items to a BSP's | ||
629 | user-features.scc file, which is the file used to manage features | ||
630 | in a yocto-bsp-generated BSP. Features to be added must be | ||
631 | specified as fully-qualified feature names. | ||
632 | """ | ||
633 | |||
634 | |||
635 | yocto_kernel_feature_rm_usage = """ | ||
636 | |||
637 | Remove a feature from the list of features being used for a BSP | ||
638 | |||
639 | usage: yocto-kernel feature rm <bsp-name> | ||
640 | |||
641 | This command removes (turns off) one or more features from a BSP's | ||
642 | user-features.scc file, which is the file used to manage features in | ||
643 | a yocto-bsp-generated BSP. | ||
644 | |||
645 | The set of features available to be removed by this command for a BSP | ||
646 | is listed and the user prompted for the specific items to remove. | ||
647 | """ | ||
648 | |||
649 | |||
650 | yocto_kernel_feature_rm_help = """ | ||
651 | |||
652 | NAME | ||
653 | yocto-kernel feature rm - Remove a feature from the list of | ||
654 | features being used for a BSP | ||
655 | |||
656 | SYNOPSIS | ||
657 | yocto-kernel feature rm <bsp-name> | ||
658 | |||
659 | DESCRIPTION | ||
660 | This command removes (turns off) one or more features from a BSP's | ||
661 | user-features.scc file, which is the file used to manage features | ||
662 | in a yocto-bsp-generated BSP. | ||
663 | |||
664 | The set of features available to be removed by this command for a | ||
665 | BSP is listed and the user prompted for the specific items to | ||
666 | remove. | ||
667 | """ | ||
668 | |||
669 | |||
670 | yocto_kernel_available_features_list_usage = """ | ||
671 | |||
672 | List the set of kernel features available to a BSP | ||
673 | |||
674 | usage: yocto-kernel features list <bsp-name> | ||
675 | |||
676 | This command lists the complete set of kernel features available to a | ||
677 | BSP. This includes the features contained in linux-yocto meta | ||
678 | branches as well as recipe-space features defined locally to the BSP. | ||
679 | """ | ||
680 | |||
681 | |||
682 | yocto_kernel_available_features_list_help = """ | ||
683 | |||
684 | NAME | ||
685 | yocto-kernel features list - List the set of kernel features | ||
686 | available to a BSP | ||
687 | |||
688 | SYNOPSIS | ||
689 | yocto-kernel features list <bsp-name> | ||
690 | |||
691 | DESCRIPTION | ||
692 | This command lists the complete set of kernel features available | ||
693 | to a BSP. This includes the features contained in linux-yocto | ||
694 | meta branches as well as recipe-space features defined locally to | ||
695 | the BSP. | ||
696 | """ | ||
697 | |||
698 | |||
699 | yocto_kernel_feature_describe_usage = """ | ||
700 | |||
701 | Print the description and compatibility information for a given kernel feature | ||
702 | |||
703 | usage: yocto-kernel feature describe <bsp-name> [/xxxx/yyyy/feature.scc ...] | ||
704 | |||
705 | This command prints the description and compatibility of a specific | ||
706 | feature in the format 'description [compatibility]. | ||
707 | """ | ||
708 | |||
709 | |||
710 | yocto_kernel_feature_describe_help = """ | ||
711 | |||
712 | NAME | ||
713 | yocto-kernel feature describe - print the description and | ||
714 | compatibility information for a given kernel feature | ||
715 | |||
716 | SYNOPSIS | ||
717 | yocto-kernel feature describe <bsp-name> [/xxxx/yyyy/feature.scc ...] | ||
718 | |||
719 | DESCRIPTION | ||
720 | This command prints the description and compatibility of a | ||
721 | specific feature in the format 'description [compatibility]. If | ||
722 | the feature doesn't define a description or compatibility, a | ||
723 | string with generic unknown values will be printed. | ||
724 | """ | ||
725 | |||
726 | |||
727 | yocto_kernel_feature_create_usage = """ | ||
728 | |||
729 | Create a recipe-space kernel feature in a BSP | ||
730 | |||
731 | usage: yocto-kernel feature create <bsp-name> newfeature.scc \ | ||
732 | "Feature Description" capabilities [<CONFIG_XXX=x> ...] [<PATCH> ...] | ||
733 | |||
734 | This command creates a new kernel feature from the bare config | ||
735 | options and patches specified on the command-line. | ||
736 | """ | ||
737 | |||
738 | |||
739 | yocto_kernel_feature_create_help = """ | ||
740 | |||
741 | NAME | ||
742 | yocto-kernel feature create - create a recipe-space kernel feature | ||
743 | in a BSP | ||
744 | |||
745 | SYNOPSIS | ||
746 | yocto-kernel feature create <bsp-name> newfeature.scc \ | ||
747 | "Feature Description" capabilities [<CONFIG_XXX=x> ...] [<PATCH> ...] | ||
748 | |||
749 | DESCRIPTION | ||
750 | This command creates a new kernel feature from the bare config | ||
751 | options and patches specified on the command-line. The new | ||
752 | feature will be created in recipe-space, specifically in either | ||
753 | the kernel .bbappend's /files/cfg or /files/features subdirectory, | ||
754 | depending on whether or not the feature contains config items only | ||
755 | or config items along with patches. The named feature must end | ||
756 | with .scc and must not contain a feature directory to contain the | ||
757 | feature (this will be determined automatically), and a feature | ||
758 | decription in double-quotes along with a capabilities string | ||
759 | (which for the time being can be one of: 'all' or 'board'). | ||
760 | """ | ||
761 | |||
762 | |||
763 | yocto_kernel_feature_destroy_usage = """ | ||
764 | |||
765 | Destroy a recipe-space kernel feature in a BSP | ||
766 | |||
767 | usage: yocto-kernel feature destroy <bsp-name> feature.scc | ||
768 | |||
769 | This command destroys a kernel feature defined in the specified BSP's | ||
770 | recipe-space kernel definition. | ||
771 | """ | ||
772 | |||
773 | |||
774 | yocto_kernel_feature_destroy_help = """ | ||
775 | |||
776 | NAME | ||
777 | yocto-kernel feature destroy <bsp-name> feature.scc - destroy a | ||
778 | recipe-space kernel feature in a BSP | ||
779 | |||
780 | SYNOPSIS | ||
781 | yocto-kernel feature destroy <bsp-name> feature.scc | ||
782 | |||
783 | DESCRIPTION | ||
784 | This command destroys a kernel feature defined in the specified | ||
785 | BSP's recipe-space kernel definition. The named feature must end | ||
786 | with .scc and must not contain a feature directory to contain the | ||
787 | feature (this will be determined automatically). If the kernel | ||
788 | feature is in use by a BSP, it can't be removed until the BSP | ||
789 | stops using it (see yocto-kernel feature rm to stop using it). | ||
790 | """ | ||
791 | |||
792 | ## | ||
793 | # yocto-layer help and usage strings | ||
794 | ## | ||
795 | |||
796 | yocto_layer_usage = """ | ||
797 | |||
798 | Create a generic Yocto layer. | ||
799 | |||
800 | usage: yocto-layer [--version] [--help] COMMAND [ARGS] | ||
801 | |||
802 | Current 'yocto-layer' commands are: | ||
803 | create Create a new generic Yocto layer | ||
804 | list List available values for input options and properties | ||
805 | |||
806 | See 'yocto-layer help COMMAND' for more information on a specific command. | ||
807 | """ | ||
808 | |||
809 | yocto_layer_help_usage = """ | ||
810 | |||
811 | usage: yocto-layer help <subcommand> | ||
812 | |||
813 | This command displays detailed help for the specified subcommand. | ||
814 | """ | ||
815 | |||
816 | yocto_layer_create_usage = """ | ||
817 | |||
818 | Create a new generic Yocto layer | ||
819 | |||
820 | usage: yocto-layer create <layer-name> [layer_priority] | ||
821 | [-o <DIRNAME> | --outdir <DIRNAME>] | ||
822 | [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>] | ||
823 | |||
824 | This command creates a generic Yocto layer based on the specified | ||
825 | parameters. The new layer will be a new Yocto layer contained by | ||
826 | default within the top-level directory specified as | ||
827 | 'meta-layer-name'. The -o option can be used to place the layer in a | ||
828 | directory with a different name and location. | ||
829 | |||
830 | If layer_priority is specified, a simple layer will be created using | ||
831 | the given layer priority, and the user will not be prompted for | ||
832 | further input. | ||
833 | |||
834 | NOTE: Once created, you should add your new layer to your | ||
835 | bblayers.conf file in order for it to be subsequently seen and | ||
836 | modified by the yocto-kernel tool. Instructions for doing this can | ||
837 | be found in the README file generated in the layer's top-level | ||
838 | directory. | ||
839 | |||
840 | See 'yocto layer help create' for more detailed instructions. | ||
841 | """ | ||
842 | |||
843 | yocto_layer_create_help = """ | ||
844 | |||
845 | NAME | ||
846 | yocto-layer create - Create a new generic Yocto layer | ||
847 | |||
848 | SYNOPSIS | ||
849 | yocto-layer create <layer-name> [layer_priority] | ||
850 | [-o <DIRNAME> | --outdir <DIRNAME>] | ||
851 | [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>] | ||
852 | |||
853 | DESCRIPTION | ||
854 | This command creates a generic Yocto layer based on the specified | ||
855 | parameters. The new layer will be a new Yocto layer contained by | ||
856 | default within the top-level directory specified as | ||
857 | 'meta-layer-name'. The -o option can be used to place the layer | ||
858 | in a directory with a different name and location. | ||
859 | |||
860 | If layer_priority is specified, a simple layer will be created | ||
861 | using the given layer priority, and the user will not be prompted | ||
862 | for further input. | ||
863 | |||
864 | The layer-specific properties that define the values that will be | ||
865 | used to generate the layer can be specified on the command-line | ||
866 | using the -i option and supplying a JSON object consisting of the | ||
867 | set of name:value pairs needed by the layer. | ||
868 | |||
869 | If the -i option is not used, the user will be interactively | ||
870 | prompted for each of the required property values, which will then | ||
871 | be used as values for layer generation. | ||
872 | |||
873 | The set of properties available can be listed using the | ||
874 | 'yocto-layer list' command. | ||
875 | |||
876 | Specifying -c causes the Python code generated and executed to | ||
877 | create the layer to be dumped to the 'bspgen.out' file in the | ||
878 | current directory, and is useful for debugging. | ||
879 | |||
880 | NOTE: Once created, you should add your new layer to your | ||
881 | bblayers.conf file in order for it to be subsequently seen and | ||
882 | modified by the yocto-kernel tool. Instructions for doing this | ||
883 | can be found in the README file generated in the layer's top-level | ||
884 | directory. | ||
885 | |||
886 | For example, assuming your poky repo is at /path/to/poky, your new | ||
887 | layer is at /path/to/poky/meta-mylayer, and your build directory | ||
888 | is /path/to/build: | ||
889 | |||
890 | $ gedit /path/to/build/conf/bblayers.conf | ||
891 | |||
892 | BBLAYERS ?= " \\ | ||
893 | /path/to/poky/meta \\ | ||
894 | /path/to/poky/meta-yocto \\ | ||
895 | /path/to/poky/meta-mylayer \\ | ||
896 | " | ||
897 | """ | ||
898 | |||
899 | yocto_layer_list_usage = """ | ||
900 | |||
901 | usage: yocto-layer list properties | ||
902 | [-o <JSON PROPERTY FILE> | --outfile <JSON PROPERTY_FILE>] | ||
903 | yocto-layer list property <xxx> | ||
904 | [-o <JSON PROPERTY FILE> | --outfile <JSON PROPERTY_FILE>] | ||
905 | |||
906 | This command enumerates the complete set of possible values for a | ||
907 | specified option or property needed by the layer creation process. | ||
908 | |||
909 | The first form enumerates all the possible properties that exist and | ||
910 | must have values specified for them in the 'yocto-layer create' | ||
911 | command. | ||
912 | |||
913 | The second form enumerates all the possible values that exist and can | ||
914 | be specified for any of the enumerable properties in the 'yocto-layer | ||
915 | create' command. | ||
916 | |||
917 | See 'yocto-layer help list' for more details. | ||
918 | """ | ||
919 | |||
920 | yocto_layer_list_help = """ | ||
921 | |||
922 | NAME | ||
923 | yocto-layer list - List available values for layer input options and properties | ||
924 | |||
925 | SYNOPSIS | ||
926 | yocto-layer list properties | ||
927 | [--o <JSON PROPERTY FILE> | -outfile <JSON PROPERTY_FILE>] | ||
928 | yocto-layer list property <xxx> | ||
929 | [--o <JSON PROPERTY FILE> | -outfile <JSON PROPERTY_FILE>] | ||
930 | |||
931 | DESCRIPTION | ||
932 | This command enumerates the complete set of possible values for a | ||
933 | specified option or property needed by the layer creation process. | ||
934 | |||
935 | The first form enumerates all the possible properties that exist | ||
936 | and must have values specified for them in the 'yocto-layer | ||
937 | create' command. This command is mainly meant to aid the | ||
938 | development of user interface alternatives to the default | ||
939 | text-based prompting interface. If the -o option is specified, | ||
940 | the list of properties, in addition to being displayed, will be | ||
941 | written to the specified file as a JSON object. In this case, the | ||
942 | object will consist of the set of name:value pairs corresponding | ||
943 | to the (possibly nested) dictionary of properties defined by the | ||
944 | input statements used by the BSP. Some example output for the | ||
945 | 'list properties' command: | ||
946 | |||
947 | $ yocto-layer list properties | ||
948 | "example_bbappend_name" : { | ||
949 | "default" : example | ||
950 | "msg" : Please enter the name you'd like to use for your bbappend file: | ||
951 | "type" : edit | ||
952 | "prio" : 20 | ||
953 | "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall | ||
954 | } | ||
955 | "create_example_recipe" : { | ||
956 | "default" : n | ||
957 | "msg" : Would you like to have an example recipe created? (y/n) | ||
958 | "type" : boolean | ||
959 | "prio" : 20 | ||
960 | "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall | ||
961 | } | ||
962 | "example_recipe_name" : { | ||
963 | "default" : example | ||
964 | "msg" : Please enter the name you'd like to use for your example recipe: | ||
965 | "type" : edit | ||
966 | "prio" : 20 | ||
967 | "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall | ||
968 | } | ||
969 | "layer_priority" : { | ||
970 | "default" : 6 | ||
971 | "msg" : Please enter the layer priority you'd like to use for the layer: | ||
972 | "type" : edit | ||
973 | "prio" : 20 | ||
974 | "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall | ||
975 | } | ||
976 | "create_example_bbappend" : { | ||
977 | "default" : n | ||
978 | "msg" : Would you like to have an example bbappend file created? (y/n) | ||
979 | "type" : boolean | ||
980 | "prio" : 20 | ||
981 | "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall | ||
982 | } | ||
983 | "example_bbappend_version" : { | ||
984 | "default" : 0.1 | ||
985 | "msg" : Please enter the version number you'd like to use for your bbappend file (this should match the recipe you're appending to): | ||
986 | "type" : edit | ||
987 | "prio" : 20 | ||
988 | "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall | ||
989 | } | ||
990 | |||
991 | Each entry in the output consists of the name of the input element | ||
992 | e.g. "layer_priority", followed by the properties defined for that | ||
993 | element enclosed in braces. This information should provide | ||
994 | sufficient information to create a complete user interface. Two | ||
995 | features of the scheme provide for conditional input. First, if a | ||
996 | Python "if" statement appears in place of an input element name, | ||
997 | the set of enclosed input elements apply and should be presented | ||
998 | to the user only if the 'if' statement evaluates to true. The | ||
999 | test in the if statement will always reference another input | ||
1000 | element in the list, which means that the element being tested | ||
1001 | should be presented to the user before the elements enclosed by | ||
1002 | the if block. Secondly, in a similar way, some elements contain | ||
1003 | "depends-on" and depends-on-val" tags, which mean that the | ||
1004 | affected input element should only be presented to the user if the | ||
1005 | element it depends on has already been presented to the user and | ||
1006 | the user has selected the specified value for that element. | ||
1007 | |||
1008 | The second form enumerates all the possible values that exist and | ||
1009 | can be specified for any of the enumerable properties in the | ||
1010 | 'yocto-layer create' command. If the -o option is specified, the | ||
1011 | list of values for the given property, in addition to being | ||
1012 | displayed, will be written to the specified file as a JSON object. | ||
1013 | In this case, the object will consist of the set of name:value | ||
1014 | pairs corresponding to the array of property values associated | ||
1015 | with the property. | ||
1016 | |||
1017 | $ yocto-layer list property layer_priority | ||
1018 | [no output - layer_priority is a text field that has no enumerable values] | ||
1019 | |||
1020 | The second form as well is meant mainly for developers of | ||
1021 | alternative interfaces - it allows the developer to fetch the | ||
1022 | possible values for a given input element on-demand. This | ||
1023 | on-demand capability is especially valuable for elements that | ||
1024 | require relatively expensive remote operations to fulfill, such as | ||
1025 | the example that returns the set of branches available in a remote | ||
1026 | git tree above. | ||
1027 | |||
1028 | """ | ||
1029 | |||
1030 | ## | ||
1031 | # test code | ||
1032 | ## | ||
1033 | |||
1034 | test_bsp_properties = { | ||
1035 | 'smp': 'yes', | ||
1036 | 'touchscreen': 'yes', | ||
1037 | 'keyboard': 'no', | ||
1038 | 'xserver': 'yes', | ||
1039 | 'xserver_choice': 'xserver-i915', | ||
1040 | 'features': ['goodfeature', 'greatfeature'], | ||
1041 | 'tunefile': 'tune-quark', | ||
1042 | } | ||
1043 | |||