blob: 85a09dd29bb65252f363e4e1dda7e16025e4ee9b [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001# 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
28import subprocess
29import logging
30
31
32def subcommand_error(args):
33 logging.info("invalid subcommand %s" % args[0])
34
35
36def 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
50def 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
58def 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
80yocto_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
93yocto_bsp_help_usage = """
94
95 usage: yocto-bsp help <subcommand>
96
97 This command displays detailed help for the specified subcommand.
98"""
99
100yocto_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>]
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500106 [-c | --codedump] [-s | --skip-git-check]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500107
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
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500117 of the BSP. The possible values for the 'karch' parameter can be
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500118 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
127yocto_bsp_create_help = """
128
129NAME
130 yocto-bsp create - Create a new Yocto BSP
131
132SYNOPSIS
133 yocto-bsp create <bsp-name> <karch> [-o <DIRNAME> | --outdir <DIRNAME>]
134 [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>]
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500135 [-c | --codedump] [-s | --skip-git-check]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500136
137DESCRIPTION
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
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500147 portions of the BSP. The possible values for the 'karch' parameter
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500148 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 \\
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500178 /path/to/poky/meta-poky \\
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500179 /path/to/poky/meta-mybsp \\
180 "
181"""
182
183yocto_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
209yocto_bsp_list_help = """
210
211NAME
212 yocto-bsp list - List available values for options and BSP properties
213
214SYNOPSIS
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
221DESCRIPTION
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
346yocto_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
372yocto_kernel_help_usage = """
373
374 usage: yocto-kernel help <subcommand>
375
376 This command displays detailed help for the specified subcommand.
377"""
378
379yocto_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
394yocto_kernel_config_list_help = """
395
396NAME
397 yocto-kernel config list - List the modifiable set of bare kernel
398 config options for a BSP
399
400SYNOPSIS
401 yocto-kernel config list <bsp-name>
402
403DESCRIPTION
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
410yocto_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
421yocto_kernel_config_add_help = """
422
423NAME
424 yocto-kernel config add - Add or modify bare kernel config options
425 for a BSP
426
427SYNOPSIS
428 yocto-kernel config add <bsp-name> [<CONFIG_XXX=x> ...]
429
430DESCRIPTION
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
444yocto_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
458yocto_kernel_config_rm_help = """
459
460NAME
461 yocto-kernel config rm - Remove bare kernel config options from a
462 BSP
463
464SYNOPSIS
465 yocto-kernel config rm <bsp-name>
466
467DESCRIPTION
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
477yocto_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
490yocto_kernel_patch_list_help = """
491
492NAME
493 yocto-kernel patch list - List the patches associated with the kernel
494 for a BSP
495
496SYNOPSIS
497 yocto-kernel patch list <bsp-name>
498
499DESCRIPTION
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
507yocto_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
520yocto_kernel_patch_add_help = """
521
522NAME
523 yocto-kernel patch add - Patch the Yocto kernel for a specific BSP
524
525SYNOPSIS
526 yocto-kernel patch add <bsp-name> [<PATCH> ...]
527
528DESCRIPTION
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
542yocto_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
558yocto_kernel_patch_rm_help = """
559
560NAME
561 yocto-kernel patch rm - Remove a patch from the Yocto kernel for a specific BSP
562
563SYNOPSIS
564 yocto-kernel patch rm <bsp-name>
565
566DESCRIPTION
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
577yocto_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
592yocto_kernel_feature_list_help = """
593
594NAME
595 yocto-kernel feature list - List the modifiable set of features
596 being used by a BSP
597
598SYNOPSIS
599 yocto-kernel feature list <bsp-name>
600
601DESCRIPTION
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
608yocto_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
621yocto_kernel_feature_add_help = """
622
623NAME
624 yocto-kernel feature add - Add to or modify the list of features
625 being used for a BSP
626
627SYNOPSIS
628 yocto-kernel feature add <bsp-name> [/xxxx/yyyy/feature.scc ...]
629
630DESCRIPTION
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
638yocto_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
653yocto_kernel_feature_rm_help = """
654
655NAME
656 yocto-kernel feature rm - Remove a feature from the list of
657 features being used for a BSP
658
659SYNOPSIS
660 yocto-kernel feature rm <bsp-name>
661
662DESCRIPTION
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
673yocto_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
685yocto_kernel_available_features_list_help = """
686
687NAME
688 yocto-kernel features list - List the set of kernel features
689 available to a BSP
690
691SYNOPSIS
692 yocto-kernel features list <bsp-name>
693
694DESCRIPTION
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
702yocto_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
713yocto_kernel_feature_describe_help = """
714
715NAME
716 yocto-kernel feature describe - print the description and
717 compatibility information for a given kernel feature
718
719SYNOPSIS
720 yocto-kernel feature describe <bsp-name> [/xxxx/yyyy/feature.scc ...]
721
722DESCRIPTION
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
730yocto_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
742yocto_kernel_feature_create_help = """
743
744NAME
745 yocto-kernel feature create - create a recipe-space kernel feature
746 in a BSP
747
748SYNOPSIS
749 yocto-kernel feature create <bsp-name> newfeature.scc \
750 "Feature Description" capabilities [<CONFIG_XXX=x> ...] [<PATCH> ...]
751
752DESCRIPTION
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
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500761 description in double-quotes along with a capabilities string
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500762 (which for the time being can be one of: 'all' or 'board').
763"""
764
765
766yocto_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
777yocto_kernel_feature_destroy_help = """
778
779NAME
780 yocto-kernel feature destroy <bsp-name> feature.scc - destroy a
781 recipe-space kernel feature in a BSP
782
783SYNOPSIS
784 yocto-kernel feature destroy <bsp-name> feature.scc
785
786DESCRIPTION
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
799yocto_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
812yocto_layer_help_usage = """
813
814 usage: yocto-layer help <subcommand>
815
816 This command displays detailed help for the specified subcommand.
817"""
818
819yocto_layer_create_usage = """
820
821 Create a new generic Yocto layer
822
823 usage: yocto-layer create <layer-name> [layer_priority]
824 [-o <DIRNAME> | --outdir <DIRNAME>]
825 [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>]
826
827 This command creates a generic Yocto layer based on the specified
828 parameters. The new layer will be a new Yocto layer contained by
829 default within the top-level directory specified as
830 'meta-layer-name'. The -o option can be used to place the layer in a
831 directory with a different name and location.
832
833 If layer_priority is specified, a simple layer will be created using
834 the given layer priority, and the user will not be prompted for
835 further input.
836
837 NOTE: Once created, you should add your new layer to your
838 bblayers.conf file in order for it to be subsequently seen and
839 modified by the yocto-kernel tool. Instructions for doing this can
840 be found in the README file generated in the layer's top-level
841 directory.
842
843 See 'yocto layer help create' for more detailed instructions.
844"""
845
846yocto_layer_create_help = """
847
848NAME
849 yocto-layer create - Create a new generic Yocto layer
850
851SYNOPSIS
852 yocto-layer create <layer-name> [layer_priority]
853 [-o <DIRNAME> | --outdir <DIRNAME>]
854 [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>]
855
856DESCRIPTION
857 This command creates a generic Yocto layer based on the specified
858 parameters. The new layer will be a new Yocto layer contained by
859 default within the top-level directory specified as
860 'meta-layer-name'. The -o option can be used to place the layer
861 in a directory with a different name and location.
862
863 If layer_priority is specified, a simple layer will be created
864 using the given layer priority, and the user will not be prompted
865 for further input.
866
867 The layer-specific properties that define the values that will be
868 used to generate the layer can be specified on the command-line
869 using the -i option and supplying a JSON object consisting of the
870 set of name:value pairs needed by the layer.
871
872 If the -i option is not used, the user will be interactively
873 prompted for each of the required property values, which will then
874 be used as values for layer generation.
875
876 The set of properties available can be listed using the
877 'yocto-layer list' command.
878
879 Specifying -c causes the Python code generated and executed to
880 create the layer to be dumped to the 'bspgen.out' file in the
881 current directory, and is useful for debugging.
882
883 NOTE: Once created, you should add your new layer to your
884 bblayers.conf file in order for it to be subsequently seen and
885 modified by the yocto-kernel tool. Instructions for doing this
886 can be found in the README file generated in the layer's top-level
887 directory.
888
889 For example, assuming your poky repo is at /path/to/poky, your new
890 layer is at /path/to/poky/meta-mylayer, and your build directory
891 is /path/to/build:
892
893 $ gedit /path/to/build/conf/bblayers.conf
894
895 BBLAYERS ?= " \\
896 /path/to/poky/meta \\
897 /path/to/poky/meta-yocto \\
898 /path/to/poky/meta-mylayer \\
899 "
900"""
901
902yocto_layer_list_usage = """
903
904 usage: yocto-layer list properties
905 [-o <JSON PROPERTY FILE> | --outfile <JSON PROPERTY_FILE>]
906 yocto-layer list property <xxx>
907 [-o <JSON PROPERTY FILE> | --outfile <JSON PROPERTY_FILE>]
908
909 This command enumerates the complete set of possible values for a
910 specified option or property needed by the layer creation process.
911
912 The first form enumerates all the possible properties that exist and
913 must have values specified for them in the 'yocto-layer create'
914 command.
915
916 The second form enumerates all the possible values that exist and can
917 be specified for any of the enumerable properties in the 'yocto-layer
918 create' command.
919
920 See 'yocto-layer help list' for more details.
921"""
922
923yocto_layer_list_help = """
924
925NAME
926 yocto-layer list - List available values for layer input options and properties
927
928SYNOPSIS
929 yocto-layer list properties
930 [--o <JSON PROPERTY FILE> | -outfile <JSON PROPERTY_FILE>]
931 yocto-layer list property <xxx>
932 [--o <JSON PROPERTY FILE> | -outfile <JSON PROPERTY_FILE>]
933
934DESCRIPTION
935 This command enumerates the complete set of possible values for a
936 specified option or property needed by the layer creation process.
937
938 The first form enumerates all the possible properties that exist
939 and must have values specified for them in the 'yocto-layer
940 create' command. This command is mainly meant to aid the
941 development of user interface alternatives to the default
942 text-based prompting interface. If the -o option is specified,
943 the list of properties, in addition to being displayed, will be
944 written to the specified file as a JSON object. In this case, the
945 object will consist of the set of name:value pairs corresponding
946 to the (possibly nested) dictionary of properties defined by the
947 input statements used by the BSP. Some example output for the
948 'list properties' command:
949
950 $ yocto-layer list properties
951 "example_bbappend_name" : {
952 "default" : example
953 "msg" : Please enter the name you'd like to use for your bbappend file:
954 "type" : edit
955 "prio" : 20
956 "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall
957 }
958 "create_example_recipe" : {
959 "default" : n
960 "msg" : Would you like to have an example recipe created? (y/n)
961 "type" : boolean
962 "prio" : 20
963 "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall
964 }
965 "example_recipe_name" : {
966 "default" : example
967 "msg" : Please enter the name you'd like to use for your example recipe:
968 "type" : edit
969 "prio" : 20
970 "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall
971 }
972 "layer_priority" : {
973 "default" : 6
974 "msg" : Please enter the layer priority you'd like to use for the layer:
975 "type" : edit
976 "prio" : 20
977 "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall
978 }
979 "create_example_bbappend" : {
980 "default" : n
981 "msg" : Would you like to have an example bbappend file created? (y/n)
982 "type" : boolean
983 "prio" : 20
984 "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall
985 }
986 "example_bbappend_version" : {
987 "default" : 0.1
988 "msg" : Please enter the version number you'd like to use for your bbappend file (this should match the recipe you're appending to):
989 "type" : edit
990 "prio" : 20
991 "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall
992 }
993
994 Each entry in the output consists of the name of the input element
995 e.g. "layer_priority", followed by the properties defined for that
996 element enclosed in braces. This information should provide
997 sufficient information to create a complete user interface. Two
998 features of the scheme provide for conditional input. First, if a
999 Python "if" statement appears in place of an input element name,
1000 the set of enclosed input elements apply and should be presented
1001 to the user only if the 'if' statement evaluates to true. The
1002 test in the if statement will always reference another input
1003 element in the list, which means that the element being tested
1004 should be presented to the user before the elements enclosed by
1005 the if block. Secondly, in a similar way, some elements contain
1006 "depends-on" and depends-on-val" tags, which mean that the
1007 affected input element should only be presented to the user if the
1008 element it depends on has already been presented to the user and
1009 the user has selected the specified value for that element.
1010
1011 The second form enumerates all the possible values that exist and
1012 can be specified for any of the enumerable properties in the
1013 'yocto-layer create' command. If the -o option is specified, the
1014 list of values for the given property, in addition to being
1015 displayed, will be written to the specified file as a JSON object.
1016 In this case, the object will consist of the set of name:value
1017 pairs corresponding to the array of property values associated
1018 with the property.
1019
1020 $ yocto-layer list property layer_priority
1021 [no output - layer_priority is a text field that has no enumerable values]
1022
1023 The second form as well is meant mainly for developers of
1024 alternative interfaces - it allows the developer to fetch the
1025 possible values for a given input element on-demand. This
1026 on-demand capability is especially valuable for elements that
1027 require relatively expensive remote operations to fulfill, such as
1028 the example that returns the set of branches available in a remote
1029 git tree above.
1030
1031"""
1032
1033##
1034# test code
1035##
1036
1037test_bsp_properties = {
1038 'smp': 'yes',
1039 'touchscreen': 'yes',
1040 'keyboard': 'no',
1041 'xserver': 'yes',
1042 'xserver_choice': 'xserver-i915',
1043 'features': ['goodfeature', 'greatfeature'],
1044 'tunefile': 'tune-quark',
1045}
1046