help.py 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044
  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. import subprocess
  28. import logging
  29. def subcommand_error(args):
  30. logging.info("invalid subcommand %s" % args[0])
  31. def display_help(subcommand, subcommands):
  32. """
  33. Display help for subcommand.
  34. """
  35. if subcommand not in subcommands:
  36. return False
  37. help = subcommands.get(subcommand, subcommand_error)[2]
  38. pager = subprocess.Popen('less', stdin=subprocess.PIPE)
  39. pager.communicate(help)
  40. return True
  41. def yocto_help(args, usage_str, subcommands):
  42. """
  43. Subcommand help dispatcher.
  44. """
  45. if len(args) == 1 or not display_help(args[1], subcommands):
  46. print(usage_str)
  47. def invoke_subcommand(args, parser, main_command_usage, subcommands):
  48. """
  49. Dispatch to subcommand handler borrowed from combo-layer.
  50. Should use argparse, but has to work in 2.6.
  51. """
  52. if not args:
  53. logging.error("No subcommand specified, exiting")
  54. parser.print_help()
  55. elif args[0] == "help":
  56. yocto_help(args, main_command_usage, subcommands)
  57. elif args[0] not in subcommands:
  58. logging.error("Unsupported subcommand %s, exiting\n" % (args[0]))
  59. parser.print_help()
  60. else:
  61. usage = subcommands.get(args[0], subcommand_error)[1]
  62. subcommands.get(args[0], subcommand_error)[0](args[1:], usage)
  63. ##
  64. # yocto-bsp help and usage strings
  65. ##
  66. yocto_bsp_usage = """
  67. Create a customized Yocto BSP layer.
  68. usage: yocto-bsp [--version] [--help] COMMAND [ARGS]
  69. Current 'yocto-bsp' commands are:
  70. create Create a new Yocto BSP
  71. list List available values for options and BSP properties
  72. See 'yocto-bsp help COMMAND' for more information on a specific command.
  73. """
  74. yocto_bsp_help_usage = """
  75. usage: yocto-bsp help <subcommand>
  76. This command displays detailed help for the specified subcommand.
  77. """
  78. yocto_bsp_create_usage = """
  79. Create a new Yocto BSP
  80. usage: yocto-bsp create <bsp-name> <karch> [-o <DIRNAME> | --outdir <DIRNAME>]
  81. [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>]
  82. This command creates a Yocto BSP based on the specified parameters.
  83. The new BSP will be a new Yocto BSP layer contained by default within
  84. the top-level directory specified as 'meta-bsp-name'. The -o option
  85. can be used to place the BSP layer in a directory with a different
  86. name and location.
  87. The value of the 'karch' parameter determines the set of files that
  88. will be generated for the BSP, along with the specific set of
  89. 'properties' that will be used to fill out the BSP-specific portions
  90. of the BSP. The possible values for the 'karch' paramter can be
  91. listed via 'yocto-bsp list karch'.
  92. NOTE: Once created, you should add your new layer to your
  93. bblayers.conf file in order for it to be subsequently seen and
  94. modified by the yocto-kernel tool.
  95. See 'yocto bsp help create' for more detailed instructions.
  96. """
  97. yocto_bsp_create_help = """
  98. NAME
  99. yocto-bsp create - Create a new Yocto BSP
  100. SYNOPSIS
  101. yocto-bsp create <bsp-name> <karch> [-o <DIRNAME> | --outdir <DIRNAME>]
  102. [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>]
  103. DESCRIPTION
  104. This command creates a Yocto BSP based on the specified
  105. parameters. The new BSP will be a new Yocto BSP layer contained
  106. by default within the top-level directory specified as
  107. 'meta-bsp-name'. The -o option can be used to place the BSP layer
  108. in a directory with a different name and location.
  109. The value of the 'karch' parameter determines the set of files
  110. that will be generated for the BSP, along with the specific set of
  111. 'properties' that will be used to fill out the BSP-specific
  112. portions of the BSP. The possible values for the 'karch' paramter
  113. can be listed via 'yocto-bsp list karch'.
  114. The BSP-specific properties that define the values that will be
  115. used to generate a particular BSP can be specified on the
  116. command-line using the -i option and supplying a JSON object
  117. consisting of the set of name:value pairs needed by the BSP.
  118. If the -i option is not used, the user will be interactively
  119. prompted for each of the required property values, which will then
  120. be used as values for BSP generation.
  121. The set of properties available for a given architecture can be
  122. listed using the 'yocto-bsp list' command.
  123. Specifying -c causes the Python code generated and executed to
  124. create the BSP to be dumped to the 'bspgen.out' file in the
  125. current directory, and is useful for debugging.
  126. NOTE: Once created, you should add your new layer to your
  127. bblayers.conf file in order for it to be subsequently seen and
  128. modified by the yocto-kernel tool.
  129. For example, assuming your poky repo is at /path/to/poky, your new
  130. BSP layer is at /path/to/poky/meta-mybsp, and your build directory
  131. is /path/to/build:
  132. $ gedit /path/to/build/conf/bblayers.conf
  133. BBLAYERS ?= " \\
  134. /path/to/poky/meta \\
  135. /path/to/poky/meta-poky \\
  136. /path/to/poky/meta-mybsp \\
  137. "
  138. """
  139. yocto_bsp_list_usage = """
  140. usage: yocto-bsp list karch
  141. yocto-bsp list <karch> properties
  142. [-o <JSON PROPERTY FILE> | --outfile <JSON PROPERTY_FILE>]
  143. yocto-bsp list <karch> property <xxx>
  144. [-o <JSON PROPERTY FILE> | --outfile <JSON PROPERTY_FILE>]
  145. This command enumerates the complete set of possible values for a
  146. specified option or property needed by the BSP creation process.
  147. The first form enumerates all the possible values that exist and can
  148. be specified for the 'karch' parameter to the 'yocto bsp create'
  149. command.
  150. The second form enumerates all the possible properties that exist and
  151. must have values specified for them in the 'yocto bsp create' command
  152. for the given 'karch'.
  153. The third form enumerates all the possible values that exist and can
  154. be specified for any of the enumerable properties of the given
  155. 'karch' in the 'yocto bsp create' command.
  156. See 'yocto-bsp help list' for more details.
  157. """
  158. yocto_bsp_list_help = """
  159. NAME
  160. yocto-bsp list - List available values for options and BSP properties
  161. SYNOPSIS
  162. yocto-bsp list karch
  163. yocto-bsp list <karch> properties
  164. [--o <JSON PROPERTY FILE> | -outfile <JSON PROPERTY_FILE>]
  165. yocto-bsp list <karch> property <xxx>
  166. [--o <JSON PROPERTY FILE> | -outfile <JSON PROPERTY_FILE>]
  167. DESCRIPTION
  168. This command enumerates the complete set of possible values for a
  169. specified option or property needed by the BSP creation process.
  170. The first form enumerates all the possible values that exist and
  171. can be specified for the 'karch' parameter to the 'yocto bsp
  172. create' command. Example output for the 'list karch' command:
  173. $ yocto-bsp list karch
  174. Architectures available:
  175. arm
  176. powerpc
  177. i386
  178. mips
  179. mips64
  180. x86_64
  181. qemu
  182. The second form enumerates all the possible properties that exist
  183. and must have values specified for them in the 'yocto bsp create'
  184. command for the given 'karch'. This command is mainly meant to
  185. allow the development user interface alternatives to the default
  186. text-based prompting interface. If the -o option is specified,
  187. the list of properties, in addition to being displayed, will be
  188. written to the specified file as a JSON object. In this case, the
  189. object will consist of the set of name:value pairs corresponding
  190. to the (possibly nested) dictionary of properties defined by the
  191. input statements used by the BSP. Some example output for the
  192. 'list properties' command:
  193. $ yocto-bsp list arm properties
  194. "touchscreen" : {
  195. "msg" : Does your BSP have a touchscreen? (y/N)
  196. "default" : n
  197. "type" : boolean
  198. }
  199. "uboot_loadaddress" : {
  200. "msg" : Please specify a value for UBOOT_LOADADDRESS.
  201. "default" : 0x80008000
  202. "type" : edit
  203. "prio" : 40
  204. }
  205. "kernel_choice" : {
  206. "prio" : 10
  207. "default" : linux-yocto_3.2
  208. "depends-on" : use_default_kernel
  209. "depends-on-val" : n
  210. "msg" : Please choose the kernel to use in this BSP =>
  211. "type" : choicelist
  212. "gen" : bsp.kernel.kernels
  213. }
  214. "if kernel_choice == "linux-yocto_3.0":" : {
  215. "base_kbranch_linux_yocto_3_0" : {
  216. "prio" : 20
  217. "default" : yocto/standard
  218. "depends-on" : new_kbranch_linux_yocto_3_0
  219. "depends-on-val" : y
  220. "msg" : Please choose a machine branch to base this BSP on =>
  221. "type" : choicelist
  222. "gen" : bsp.kernel.all_branches
  223. }
  224. .
  225. .
  226. .
  227. Each entry in the output consists of the name of the input element
  228. e.g. "touchscreen", followed by the properties defined for that
  229. element enclosed in braces. This information should provide
  230. sufficient information to create a complete user interface with.
  231. Two features of the scheme provide for conditional input. First,
  232. if a Python "if" statement appears in place of an input element
  233. name, the set of enclosed input elements apply and should be
  234. presented to the user only if the 'if' statement evaluates to
  235. true. The test in the if statement will always reference another
  236. input element in the list, which means that the element being
  237. tested should be presented to the user before the elements
  238. enclosed by the if block. Secondly, in a similar way, some
  239. elements contain "depends-on" and depends-on-val" tags, which mean
  240. that the affected input element should only be presented to the
  241. user if the element it depends on has already been presented to
  242. the user and the user has selected the specified value for that
  243. element.
  244. The third form enumerates all the possible values that exist and
  245. can be specified for any of the enumerable properties of the given
  246. 'karch' in the 'yocto bsp create' command. If the -o option is
  247. specified, the list of values for the given property, in addition
  248. to being displayed, will be written to the specified file as a
  249. JSON object. In this case, the object will consist of the set of
  250. name:value pairs corresponding to the array of property values
  251. associated with the property.
  252. $ yocto-bsp list i386 property xserver_choice
  253. ["xserver_vesa", "VESA xserver support"]
  254. ["xserver_i915", "i915 xserver support"]
  255. $ yocto-bsp list arm property base_kbranch_linux_yocto_3_0
  256. Getting branches from remote repo git://git.yoctoproject.org/linux-yocto-3.0...
  257. ["yocto/base", "yocto/base"]
  258. ["yocto/eg20t", "yocto/eg20t"]
  259. ["yocto/gma500", "yocto/gma500"]
  260. ["yocto/pvr", "yocto/pvr"]
  261. ["yocto/standard/arm-versatile-926ejs", "yocto/standard/arm-versatile-926ejs"]
  262. ["yocto/standard/base", "yocto/standard/base"]
  263. ["yocto/standard/cedartrail", "yocto/standard/cedartrail"]
  264. .
  265. .
  266. .
  267. ["yocto/standard/qemu-ppc32", "yocto/standard/qemu-ppc32"]
  268. ["yocto/standard/routerstationpro", "yocto/standard/routerstationpro"]
  269. The third form as well is meant mainly for developers of
  270. alternative interfaces - it allows the developer to fetch the
  271. possible values for a given input element on-demand. This
  272. on-demand capability is especially valuable for elements that
  273. require relatively expensive remote operations to fulfill, such as
  274. the example that returns the set of branches available in a remote
  275. git tree above.
  276. """
  277. ##
  278. # yocto-kernel help and usage strings
  279. ##
  280. yocto_kernel_usage = """
  281. Modify and list Yocto BSP kernel config items and patches.
  282. usage: yocto-kernel [--version] [--help] COMMAND [ARGS]
  283. Current 'yocto-kernel' commands are:
  284. config list List the modifiable set of bare kernel config options for a BSP
  285. config add Add or modify bare kernel config options for a BSP
  286. config rm Remove bare kernel config options from a BSP
  287. patch list List the patches associated with a BSP
  288. patch add Patch the Yocto kernel for a BSP
  289. patch rm Remove patches from a BSP
  290. feature list List the features used by a BSP
  291. feature add Have a BSP use a feature
  292. feature rm Have a BSP stop using a feature
  293. features list List the features available to BSPs
  294. feature describe Describe a particular feature
  295. feature create Create a new BSP-local feature
  296. feature destroy Remove a BSP-local feature
  297. See 'yocto-kernel help COMMAND' for more information on a specific command.
  298. """
  299. yocto_kernel_help_usage = """
  300. usage: yocto-kernel help <subcommand>
  301. This command displays detailed help for the specified subcommand.
  302. """
  303. yocto_kernel_config_list_usage = """
  304. List the modifiable set of bare kernel config options for a BSP
  305. usage: yocto-kernel config list <bsp-name>
  306. This command lists the 'modifiable' config items for a BSP i.e. the
  307. items which are eligible for modification or removal by other
  308. yocto-kernel commands.
  309. 'modifiable' config items are the config items contained a BSP's
  310. user-config.cfg base config.
  311. """
  312. yocto_kernel_config_list_help = """
  313. NAME
  314. yocto-kernel config list - List the modifiable set of bare kernel
  315. config options for a BSP
  316. SYNOPSIS
  317. yocto-kernel config list <bsp-name>
  318. DESCRIPTION
  319. This command lists the 'modifiable' config items for a BSP
  320. i.e. the items which are eligible for modification or removal by
  321. other yocto-kernel commands.
  322. """
  323. yocto_kernel_config_add_usage = """
  324. Add or modify bare kernel config options for a BSP
  325. usage: yocto-kernel config add <bsp-name> [<CONFIG_XXX=x> ...]
  326. This command adds one or more CONFIG_XXX=x items to a BSP's user-config.cfg
  327. base config.
  328. """
  329. yocto_kernel_config_add_help = """
  330. NAME
  331. yocto-kernel config add - Add or modify bare kernel config options
  332. for a BSP
  333. SYNOPSIS
  334. yocto-kernel config add <bsp-name> [<CONFIG_XXX=x> ...]
  335. DESCRIPTION
  336. This command adds one or more CONFIG_XXX=x items to a BSP's
  337. foo.cfg base config.
  338. NOTE: It's up to the user to determine whether or not the config
  339. options being added make sense or not - this command does no
  340. sanity checking or verification of any kind to ensure that a
  341. config option really makes sense and will actually be set in in
  342. the final config. For example, if a config option depends on
  343. other config options, it will be turned off by kconfig if the
  344. other options aren't set correctly.
  345. """
  346. yocto_kernel_config_rm_usage = """
  347. Remove bare kernel config options from a BSP
  348. usage: yocto-kernel config rm <bsp-name>
  349. This command removes (turns off) one or more CONFIG_XXX items from a
  350. BSP's user-config.cfg base config.
  351. The set of config items available to be removed by this command for a
  352. BSP is listed and the user prompted for the specific items to remove.
  353. """
  354. yocto_kernel_config_rm_help = """
  355. NAME
  356. yocto-kernel config rm - Remove bare kernel config options from a
  357. BSP
  358. SYNOPSIS
  359. yocto-kernel config rm <bsp-name>
  360. DESCRIPTION
  361. This command removes (turns off) one or more CONFIG_XXX items from a
  362. BSP's user-config.cfg base config.
  363. The set of config items available to be removed by this command
  364. for a BSP is listed and the user prompted for the specific items
  365. to remove.
  366. """
  367. yocto_kernel_patch_list_usage = """
  368. List the patches associated with the kernel for a BSP
  369. usage: yocto-kernel patch list <bsp-name>
  370. This command lists the patches associated with a BSP.
  371. NOTE: this only applies to patches listed in the kernel recipe's
  372. user-patches.scc file (and currently repeated in its SRC_URI).
  373. """
  374. yocto_kernel_patch_list_help = """
  375. NAME
  376. yocto-kernel patch list - List the patches associated with the kernel
  377. for a BSP
  378. SYNOPSIS
  379. yocto-kernel patch list <bsp-name>
  380. DESCRIPTION
  381. This command lists the patches associated with a BSP.
  382. NOTE: this only applies to patches listed in the kernel recipe's
  383. user-patches.scc file (and currently repeated in its SRC_URI).
  384. """
  385. yocto_kernel_patch_add_usage = """
  386. Patch the Yocto kernel for a specific BSP
  387. usage: yocto-kernel patch add <bsp-name> [<PATCH> ...]
  388. This command adds one or more patches to a BSP's machine branch. The
  389. patch will be added to the BSP's linux-yocto kernel user-patches.scc
  390. file (and currently repeated in its SRC_URI) and will be guaranteed
  391. to be applied in the order specified.
  392. """
  393. yocto_kernel_patch_add_help = """
  394. NAME
  395. yocto-kernel patch add - Patch the Yocto kernel for a specific BSP
  396. SYNOPSIS
  397. yocto-kernel patch add <bsp-name> [<PATCH> ...]
  398. DESCRIPTION
  399. This command adds one or more patches to a BSP's machine branch.
  400. The patch will be added to the BSP's linux-yocto kernel
  401. user-patches.scc file (and currently repeated in its SRC_URI) and
  402. will be guaranteed to be applied in the order specified.
  403. NOTE: It's up to the user to determine whether or not the patches
  404. being added makes sense or not - this command does no sanity
  405. checking or verification of any kind to ensure that a patch can
  406. actually be applied to the BSP's kernel branch; it's assumed that
  407. the user has already done that.
  408. """
  409. yocto_kernel_patch_rm_usage = """
  410. Remove a patch from the Yocto kernel for a specific BSP
  411. usage: yocto-kernel patch rm <bsp-name>
  412. This command removes one or more patches from a BSP's machine branch.
  413. The patch will be removed from the BSP's linux-yocto kernel
  414. user-patches.scc file (and currently repeated in its SRC_URI) and
  415. kernel SRC_URI dir.
  416. The set of patches available to be removed by this command for a BSP
  417. is listed and the user prompted for the specific patches to remove.
  418. """
  419. yocto_kernel_patch_rm_help = """
  420. NAME
  421. yocto-kernel patch rm - Remove a patch from the Yocto kernel for a specific BSP
  422. SYNOPSIS
  423. yocto-kernel patch rm <bsp-name>
  424. DESCRIPTION
  425. This command removes one or more patches from a BSP's machine
  426. branch. The patch will be removed from the BSP's linux-yocto
  427. kernel user-patches.scc file (and currently repeated in its
  428. SRC_URI).
  429. The set of patches available to be removed by this command for a
  430. BSP is listed and the user prompted for the specific patches to
  431. remove.
  432. """
  433. yocto_kernel_feature_list_usage = """
  434. List the BSP features that are being used by a BSP
  435. usage: yocto-kernel feature list <bsp-name>
  436. This command lists the features being used by a BSP i.e. the features
  437. which are eligible for modification or removal by other yocto-kernel
  438. commands.
  439. 'modifiable' features are the features listed in a BSP's
  440. user-features.scc file.
  441. """
  442. yocto_kernel_feature_list_help = """
  443. NAME
  444. yocto-kernel feature list - List the modifiable set of features
  445. being used by a BSP
  446. SYNOPSIS
  447. yocto-kernel feature list <bsp-name>
  448. DESCRIPTION
  449. This command lists the 'modifiable' features being used by a BSP
  450. i.e. the features which are eligible for modification or removal
  451. by other yocto-kernel commands.
  452. """
  453. yocto_kernel_feature_add_usage = """
  454. Add to or modify the list of features being used for a BSP
  455. usage: yocto-kernel feature add <bsp-name> [/xxxx/yyyy/feature.scc ...]
  456. This command adds one or more feature items to a BSP's kernel
  457. user-features.scc file, which is the file used to manage features in
  458. a yocto-bsp-generated BSP. Features to be added must be specified as
  459. fully-qualified feature names.
  460. """
  461. yocto_kernel_feature_add_help = """
  462. NAME
  463. yocto-kernel feature add - Add to or modify the list of features
  464. being used for a BSP
  465. SYNOPSIS
  466. yocto-kernel feature add <bsp-name> [/xxxx/yyyy/feature.scc ...]
  467. DESCRIPTION
  468. This command adds one or more feature items to a BSP's
  469. user-features.scc file, which is the file used to manage features
  470. in a yocto-bsp-generated BSP. Features to be added must be
  471. specified as fully-qualified feature names.
  472. """
  473. yocto_kernel_feature_rm_usage = """
  474. Remove a feature from the list of features being used for a BSP
  475. usage: yocto-kernel feature rm <bsp-name>
  476. This command removes (turns off) one or more features from a BSP's
  477. user-features.scc file, which is the file used to manage features in
  478. a yocto-bsp-generated BSP.
  479. The set of features available to be removed by this command for a BSP
  480. is listed and the user prompted for the specific items to remove.
  481. """
  482. yocto_kernel_feature_rm_help = """
  483. NAME
  484. yocto-kernel feature rm - Remove a feature from the list of
  485. features being used for a BSP
  486. SYNOPSIS
  487. yocto-kernel feature rm <bsp-name>
  488. DESCRIPTION
  489. This command removes (turns off) one or more features from a BSP's
  490. user-features.scc file, which is the file used to manage features
  491. in a yocto-bsp-generated BSP.
  492. The set of features available to be removed by this command for a
  493. BSP is listed and the user prompted for the specific items to
  494. remove.
  495. """
  496. yocto_kernel_available_features_list_usage = """
  497. List the set of kernel features available to a BSP
  498. usage: yocto-kernel features list <bsp-name>
  499. This command lists the complete set of kernel features available to a
  500. BSP. This includes the features contained in linux-yocto meta
  501. branches as well as recipe-space features defined locally to the BSP.
  502. """
  503. yocto_kernel_available_features_list_help = """
  504. NAME
  505. yocto-kernel features list - List the set of kernel features
  506. available to a BSP
  507. SYNOPSIS
  508. yocto-kernel features list <bsp-name>
  509. DESCRIPTION
  510. This command lists the complete set of kernel features available
  511. to a BSP. This includes the features contained in linux-yocto
  512. meta branches as well as recipe-space features defined locally to
  513. the BSP.
  514. """
  515. yocto_kernel_feature_describe_usage = """
  516. Print the description and compatibility information for a given kernel feature
  517. usage: yocto-kernel feature describe <bsp-name> [/xxxx/yyyy/feature.scc ...]
  518. This command prints the description and compatibility of a specific
  519. feature in the format 'description [compatibility].
  520. """
  521. yocto_kernel_feature_describe_help = """
  522. NAME
  523. yocto-kernel feature describe - print the description and
  524. compatibility information for a given kernel feature
  525. SYNOPSIS
  526. yocto-kernel feature describe <bsp-name> [/xxxx/yyyy/feature.scc ...]
  527. DESCRIPTION
  528. This command prints the description and compatibility of a
  529. specific feature in the format 'description [compatibility]. If
  530. the feature doesn't define a description or compatibility, a
  531. string with generic unknown values will be printed.
  532. """
  533. yocto_kernel_feature_create_usage = """
  534. Create a recipe-space kernel feature in a BSP
  535. usage: yocto-kernel feature create <bsp-name> newfeature.scc \
  536. "Feature Description" capabilities [<CONFIG_XXX=x> ...] [<PATCH> ...]
  537. This command creates a new kernel feature from the bare config
  538. options and patches specified on the command-line.
  539. """
  540. yocto_kernel_feature_create_help = """
  541. NAME
  542. yocto-kernel feature create - create a recipe-space kernel feature
  543. in a BSP
  544. SYNOPSIS
  545. yocto-kernel feature create <bsp-name> newfeature.scc \
  546. "Feature Description" capabilities [<CONFIG_XXX=x> ...] [<PATCH> ...]
  547. DESCRIPTION
  548. This command creates a new kernel feature from the bare config
  549. options and patches specified on the command-line. The new
  550. feature will be created in recipe-space, specifically in either
  551. the kernel .bbappend's /files/cfg or /files/features subdirectory,
  552. depending on whether or not the feature contains config items only
  553. or config items along with patches. The named feature must end
  554. with .scc and must not contain a feature directory to contain the
  555. feature (this will be determined automatically), and a feature
  556. decription in double-quotes along with a capabilities string
  557. (which for the time being can be one of: 'all' or 'board').
  558. """
  559. yocto_kernel_feature_destroy_usage = """
  560. Destroy a recipe-space kernel feature in a BSP
  561. usage: yocto-kernel feature destroy <bsp-name> feature.scc
  562. This command destroys a kernel feature defined in the specified BSP's
  563. recipe-space kernel definition.
  564. """
  565. yocto_kernel_feature_destroy_help = """
  566. NAME
  567. yocto-kernel feature destroy <bsp-name> feature.scc - destroy a
  568. recipe-space kernel feature in a BSP
  569. SYNOPSIS
  570. yocto-kernel feature destroy <bsp-name> feature.scc
  571. DESCRIPTION
  572. This command destroys a kernel feature defined in the specified
  573. BSP's recipe-space kernel definition. The named feature must end
  574. with .scc and must not contain a feature directory to contain the
  575. feature (this will be determined automatically). If the kernel
  576. feature is in use by a BSP, it can't be removed until the BSP
  577. stops using it (see yocto-kernel feature rm to stop using it).
  578. """
  579. ##
  580. # yocto-layer help and usage strings
  581. ##
  582. yocto_layer_usage = """
  583. Create a generic Yocto layer.
  584. usage: yocto-layer [--version] [--help] COMMAND [ARGS]
  585. Current 'yocto-layer' commands are:
  586. create Create a new generic Yocto layer
  587. list List available values for input options and properties
  588. See 'yocto-layer help COMMAND' for more information on a specific command.
  589. """
  590. yocto_layer_help_usage = """
  591. usage: yocto-layer help <subcommand>
  592. This command displays detailed help for the specified subcommand.
  593. """
  594. yocto_layer_create_usage = """
  595. Create a new generic Yocto layer
  596. usage: yocto-layer create <layer-name> [layer_priority]
  597. [-o <DIRNAME> | --outdir <DIRNAME>]
  598. [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>]
  599. This command creates a generic Yocto layer based on the specified
  600. parameters. The new layer will be a new Yocto layer contained by
  601. default within the top-level directory specified as
  602. 'meta-layer-name'. The -o option can be used to place the layer in a
  603. directory with a different name and location.
  604. If layer_priority is specified, a simple layer will be created using
  605. the given layer priority, and the user will not be prompted for
  606. further input.
  607. NOTE: Once created, you should add your new layer to your
  608. bblayers.conf file in order for it to be subsequently seen and
  609. modified by the yocto-kernel tool. Instructions for doing this can
  610. be found in the README file generated in the layer's top-level
  611. directory.
  612. See 'yocto layer help create' for more detailed instructions.
  613. """
  614. yocto_layer_create_help = """
  615. NAME
  616. yocto-layer create - Create a new generic Yocto layer
  617. SYNOPSIS
  618. yocto-layer create <layer-name> [layer_priority]
  619. [-o <DIRNAME> | --outdir <DIRNAME>]
  620. [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>]
  621. DESCRIPTION
  622. This command creates a generic Yocto layer based on the specified
  623. parameters. The new layer will be a new Yocto layer contained by
  624. default within the top-level directory specified as
  625. 'meta-layer-name'. The -o option can be used to place the layer
  626. in a directory with a different name and location.
  627. If layer_priority is specified, a simple layer will be created
  628. using the given layer priority, and the user will not be prompted
  629. for further input.
  630. The layer-specific properties that define the values that will be
  631. used to generate the layer can be specified on the command-line
  632. using the -i option and supplying a JSON object consisting of the
  633. set of name:value pairs needed by the layer.
  634. If the -i option is not used, the user will be interactively
  635. prompted for each of the required property values, which will then
  636. be used as values for layer generation.
  637. The set of properties available can be listed using the
  638. 'yocto-layer list' command.
  639. Specifying -c causes the Python code generated and executed to
  640. create the layer to be dumped to the 'bspgen.out' file in the
  641. current directory, and is useful for debugging.
  642. NOTE: Once created, you should add your new layer to your
  643. bblayers.conf file in order for it to be subsequently seen and
  644. modified by the yocto-kernel tool. Instructions for doing this
  645. can be found in the README file generated in the layer's top-level
  646. directory.
  647. For example, assuming your poky repo is at /path/to/poky, your new
  648. layer is at /path/to/poky/meta-mylayer, and your build directory
  649. is /path/to/build:
  650. $ gedit /path/to/build/conf/bblayers.conf
  651. BBLAYERS ?= " \\
  652. /path/to/poky/meta \\
  653. /path/to/poky/meta-yocto \\
  654. /path/to/poky/meta-mylayer \\
  655. "
  656. """
  657. yocto_layer_list_usage = """
  658. usage: yocto-layer list properties
  659. [-o <JSON PROPERTY FILE> | --outfile <JSON PROPERTY_FILE>]
  660. yocto-layer list property <xxx>
  661. [-o <JSON PROPERTY FILE> | --outfile <JSON PROPERTY_FILE>]
  662. This command enumerates the complete set of possible values for a
  663. specified option or property needed by the layer creation process.
  664. The first form enumerates all the possible properties that exist and
  665. must have values specified for them in the 'yocto-layer create'
  666. command.
  667. The second form enumerates all the possible values that exist and can
  668. be specified for any of the enumerable properties in the 'yocto-layer
  669. create' command.
  670. See 'yocto-layer help list' for more details.
  671. """
  672. yocto_layer_list_help = """
  673. NAME
  674. yocto-layer list - List available values for layer input options and properties
  675. SYNOPSIS
  676. yocto-layer list properties
  677. [--o <JSON PROPERTY FILE> | -outfile <JSON PROPERTY_FILE>]
  678. yocto-layer list property <xxx>
  679. [--o <JSON PROPERTY FILE> | -outfile <JSON PROPERTY_FILE>]
  680. DESCRIPTION
  681. This command enumerates the complete set of possible values for a
  682. specified option or property needed by the layer creation process.
  683. The first form enumerates all the possible properties that exist
  684. and must have values specified for them in the 'yocto-layer
  685. create' command. This command is mainly meant to aid the
  686. development of user interface alternatives to the default
  687. text-based prompting interface. If the -o option is specified,
  688. the list of properties, in addition to being displayed, will be
  689. written to the specified file as a JSON object. In this case, the
  690. object will consist of the set of name:value pairs corresponding
  691. to the (possibly nested) dictionary of properties defined by the
  692. input statements used by the BSP. Some example output for the
  693. 'list properties' command:
  694. $ yocto-layer list properties
  695. "example_bbappend_name" : {
  696. "default" : example
  697. "msg" : Please enter the name you'd like to use for your bbappend file:
  698. "type" : edit
  699. "prio" : 20
  700. "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall
  701. }
  702. "create_example_recipe" : {
  703. "default" : n
  704. "msg" : Would you like to have an example recipe created? (y/n)
  705. "type" : boolean
  706. "prio" : 20
  707. "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall
  708. }
  709. "example_recipe_name" : {
  710. "default" : example
  711. "msg" : Please enter the name you'd like to use for your example recipe:
  712. "type" : edit
  713. "prio" : 20
  714. "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall
  715. }
  716. "layer_priority" : {
  717. "default" : 6
  718. "msg" : Please enter the layer priority you'd like to use for the layer:
  719. "type" : edit
  720. "prio" : 20
  721. "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall
  722. }
  723. "create_example_bbappend" : {
  724. "default" : n
  725. "msg" : Would you like to have an example bbappend file created? (y/n)
  726. "type" : boolean
  727. "prio" : 20
  728. "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall
  729. }
  730. "example_bbappend_version" : {
  731. "default" : 0.1
  732. "msg" : Please enter the version number you'd like to use for your bbappend file (this should match the recipe you're appending to):
  733. "type" : edit
  734. "prio" : 20
  735. "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall
  736. }
  737. Each entry in the output consists of the name of the input element
  738. e.g. "layer_priority", followed by the properties defined for that
  739. element enclosed in braces. This information should provide
  740. sufficient information to create a complete user interface. Two
  741. features of the scheme provide for conditional input. First, if a
  742. Python "if" statement appears in place of an input element name,
  743. the set of enclosed input elements apply and should be presented
  744. to the user only if the 'if' statement evaluates to true. The
  745. test in the if statement will always reference another input
  746. element in the list, which means that the element being tested
  747. should be presented to the user before the elements enclosed by
  748. the if block. Secondly, in a similar way, some elements contain
  749. "depends-on" and depends-on-val" tags, which mean that the
  750. affected input element should only be presented to the user if the
  751. element it depends on has already been presented to the user and
  752. the user has selected the specified value for that element.
  753. The second form enumerates all the possible values that exist and
  754. can be specified for any of the enumerable properties in the
  755. 'yocto-layer create' command. If the -o option is specified, the
  756. list of values for the given property, in addition to being
  757. displayed, will be written to the specified file as a JSON object.
  758. In this case, the object will consist of the set of name:value
  759. pairs corresponding to the array of property values associated
  760. with the property.
  761. $ yocto-layer list property layer_priority
  762. [no output - layer_priority is a text field that has no enumerable values]
  763. The second form as well is meant mainly for developers of
  764. alternative interfaces - it allows the developer to fetch the
  765. possible values for a given input element on-demand. This
  766. on-demand capability is especially valuable for elements that
  767. require relatively expensive remote operations to fulfill, such as
  768. the example that returns the set of branches available in a remote
  769. git tree above.
  770. """
  771. ##
  772. # test code
  773. ##
  774. test_bsp_properties = {
  775. 'smp': 'yes',
  776. 'touchscreen': 'yes',
  777. 'keyboard': 'no',
  778. 'xserver': 'yes',
  779. 'xserver_choice': 'xserver-i915',
  780. 'features': ['goodfeature', 'greatfeature'],
  781. 'tunefile': 'tune-quark',
  782. }