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