help.py 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838
  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. NOTE: For x86-based BSPs that select the EMGD xserver, the generated
  97. BSP assumes the presence of the meta-intel layer. Ensure the
  98. meta-intel layer is present and added to bblayers.conf.
  99. See 'yocto bsp help create' for more detailed instructions.
  100. """
  101. yocto_bsp_create_help = """
  102. NAME
  103. yocto-bsp create - Create a new Yocto BSP
  104. SYNOPSIS
  105. yocto-bsp create <bsp-name> <karch> [-o <DIRNAME> | --outdir <DIRNAME>]
  106. [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>]
  107. DESCRIPTION
  108. This command creates a Yocto BSP based on the specified
  109. parameters. The new BSP will be a new Yocto BSP layer contained
  110. by default within the top-level directory specified as
  111. 'meta-bsp-name'. The -o option can be used to place the BSP layer
  112. in a directory with a different name and location.
  113. The value of the 'karch' parameter determines the set of files
  114. that will be generated for the BSP, along with the specific set of
  115. 'properties' that will be used to fill out the BSP-specific
  116. portions of the BSP. The possible values for the 'karch' paramter
  117. can be listed via 'yocto-bsp list karch'.
  118. The BSP-specific properties that define the values that will be
  119. used to generate a particular BSP can be specified on the
  120. command-line using the -i option and supplying a JSON object
  121. consisting of the set of name:value pairs needed by the BSP.
  122. If the -i option is not used, the user will be interactively
  123. prompted for each of the required property values, which will then
  124. be used as values for BSP generation.
  125. The set of properties available for a given architecture can be
  126. listed using the 'yocto-bsp list' command.
  127. Specifying -c causes the Python code generated and executed to
  128. create the BSP to be dumped to the 'bspgen.out' file in the
  129. current directory, and is useful for debugging.
  130. NOTE: Once created, you should add your new layer to your
  131. bblayers.conf file in order for it to be subsequently seen and
  132. modified by the yocto-kernel tool.
  133. For example, assuming your poky repo is at /path/to/poky, your new
  134. BSP layer is at /path/to/poky/meta-mybsp, and your build directory
  135. is /path/to/build:
  136. $ gedit /path/to/build/conf/bblayers.conf
  137. BBLAYERS ?= " \\
  138. /path/to/poky/meta \\
  139. /path/to/poky/meta-yocto \\
  140. /path/to/poky/meta-mybsp \\
  141. "
  142. NOTE: For x86-based BSPs that select the EMGD xserver, the
  143. generated BSP assumes the presence of the meta-intel layer. Ensure
  144. the meta-intel layer is present and added to bblayers.conf.
  145. For example, assuming your poky repo is at /path/to/poky, your new
  146. BSP layer is at /path/to/poky/meta-mybsp, and your build directory
  147. is /path/to/build:
  148. $ cd /path/to/poky
  149. $ git clone git://git.yoctoproject.org/meta-intel.git
  150. $ gedit /path/to/build/conf/bblayers.conf
  151. BBLAYERS ?= " \\
  152. /path/to/poky/meta \\
  153. /path/to/poky/meta-yocto \\
  154. /path/to/poky/meta-intel \\
  155. /path/to/poky/meta-mybsp \\
  156. "
  157. """
  158. yocto_bsp_list_usage = """
  159. usage: yocto-bsp list karch
  160. yocto-bsp list <karch> properties
  161. [-o <JSON PROPERTY FILE> | --outfile <JSON PROPERTY_FILE>]
  162. yocto-bsp list <karch> property <xxx>
  163. [-o <JSON PROPERTY FILE> | --outfile <JSON PROPERTY_FILE>]
  164. This command enumerates the complete set of possible values for a
  165. specified option or property needed by the BSP creation process.
  166. The first form enumerates all the possible values that exist and can
  167. be specified for the 'karch' parameter to the 'yocto bsp create'
  168. command.
  169. The second form enumerates all the possible properties that exist and
  170. must have values specified for them in the 'yocto bsp create' command
  171. for the given 'karch'.
  172. The third form enumerates all the possible values that exist and can
  173. be specified for any of the enumerable properties of the given
  174. 'karch' in the 'yocto bsp create' command.
  175. See 'yocto-bsp help list' for more details.
  176. """
  177. yocto_bsp_list_help = """
  178. NAME
  179. yocto-bsp list - List available values for options and BSP properties
  180. SYNOPSIS
  181. yocto-bsp list karch
  182. yocto-bsp list <karch> properties
  183. [--o <JSON PROPERTY FILE> | -outfile <JSON PROPERTY_FILE>]
  184. yocto-bsp list <karch> property <xxx>
  185. [--o <JSON PROPERTY FILE> | -outfile <JSON PROPERTY_FILE>]
  186. DESCRIPTION
  187. This command enumerates the complete set of possible values for a
  188. specified option or property needed by the BSP creation process.
  189. The first form enumerates all the possible values that exist and
  190. can be specified for the 'karch' parameter to the 'yocto bsp
  191. create' command. Example output for the 'list karch' command:
  192. $ yocto-bsp list karch
  193. Architectures available:
  194. arm
  195. powerpc
  196. i386
  197. mips
  198. x86_64
  199. qemu
  200. The second form enumerates all the possible properties that exist
  201. and must have values specified for them in the 'yocto bsp create'
  202. command for the given 'karch'. This command is mainly meant to
  203. allow the development user interface alternatives to the default
  204. text-based prompting interface. If the -o option is specified,
  205. the list of properties, in addition to being displayed, will be
  206. written to the specified file as a JSON object. In this case, the
  207. object will consist of the set of name:value pairs corresponding
  208. to the (possibly nested) dictionary of properties defined by the
  209. input statements used by the BSP. Some example output for the
  210. 'list properties' command:
  211. $ yocto-bsp list arm properties
  212. "touchscreen" : {
  213. "msg" : Does your BSP have a touchscreen? (y/N)
  214. "default" : n
  215. "type" : boolean
  216. }
  217. "uboot_loadaddress" : {
  218. "msg" : Please specify a value for UBOOT_LOADADDRESS.
  219. "default" : 0x80008000
  220. "type" : edit
  221. "prio" : 40
  222. }
  223. "kernel_choice" : {
  224. "prio" : 10
  225. "default" : linux-yocto_3.2
  226. "depends-on" : use_default_kernel
  227. "depends-on-val" : n
  228. "msg" : Please choose the kernel to use in this BSP =>
  229. "type" : choicelist
  230. "gen" : bsp.kernel.kernels
  231. }
  232. "if kernel_choice == "linux-yocto_3.0":" : {
  233. "base_kbranch_linux_yocto_3_0" : {
  234. "prio" : 20
  235. "default" : yocto/standard
  236. "depends-on" : new_kbranch_linux_yocto_3_0
  237. "depends-on-val" : y
  238. "msg" : Please choose a machine branch to base this BSP on =>
  239. "type" : choicelist
  240. "gen" : bsp.kernel.all_branches
  241. }
  242. .
  243. .
  244. .
  245. Each entry in the output consists of the name of the input element
  246. e.g. "touchscreen", followed by the properties defined for that
  247. element enclosed in braces. This information should provide
  248. sufficient information to create a complete user interface with.
  249. Two features of the scheme provide for conditional input. First,
  250. if a Python "if" statement appears in place of an input element
  251. name, the set of enclosed input elements apply and should be
  252. presented to the user only if the 'if' statement evaluates to
  253. true. The test in the if statement will always reference another
  254. input element in the list, which means that the element being
  255. tested should be presented to the user before the elements
  256. enclosed by the if block. Secondly, in a similar way, some
  257. elements contain "depends-on" and depends-on-val" tags, which mean
  258. that the affected input element should only be presented to the
  259. user if the element it depends on has already been presented to
  260. the user and the user has selected the specified value for that
  261. element.
  262. The third form enumerates all the possible values that exist and
  263. can be specified for any of the enumerable properties of the given
  264. 'karch' in the 'yocto bsp create' command. If the -o option is
  265. specified, the list of values for the given property, in addition
  266. to being displayed, will be written to the specified file as a
  267. JSON object. In this case, the object will consist of the set of
  268. name:value pairs corresponding to the array of property values
  269. associated with the property.
  270. $ yocto-bsp list i386 property xserver_choice
  271. ["xserver_vesa", "VESA xserver support"]
  272. ["xserver_emgd", "EMGD xserver support (proprietary)"]
  273. ["xserver_i915", "i915 xserver support"]
  274. $ yocto-bsp list arm property base_kbranch_linux_yocto_3_0
  275. Getting branches from remote repo git://git.yoctoproject.org/linux-yocto-3.0...
  276. ["yocto/base", "yocto/base"]
  277. ["yocto/eg20t", "yocto/eg20t"]
  278. ["yocto/emgd", "yocto/emgd"]
  279. ["yocto/emgd-1.10", "yocto/emgd-1.10"]
  280. ["yocto/gma500", "yocto/gma500"]
  281. ["yocto/pvr", "yocto/pvr"]
  282. ["yocto/standard/arm-versatile-926ejs", "yocto/standard/arm-versatile-926ejs"]
  283. ["yocto/standard/base", "yocto/standard/base"]
  284. ["yocto/standard/beagleboard", "yocto/standard/beagleboard"]
  285. ["yocto/standard/cedartrail", "yocto/standard/cedartrail"]
  286. .
  287. .
  288. .
  289. ["yocto/standard/qemu-ppc32", "yocto/standard/qemu-ppc32"]
  290. ["yocto/standard/routerstationpro", "yocto/standard/routerstationpro"]
  291. The third form as well is meant mainly for developers of
  292. alternative interfaces - it allows the developer to fetch the
  293. possible values for a given input element on-demand. This
  294. on-demand capability is especially valuable for elements that
  295. require relatively expensive remote operations to fulfill, such as
  296. the example that returns the set of branches available in a remote
  297. git tree above.
  298. """
  299. ##
  300. # yocto-kernel help and usage strings
  301. ##
  302. yocto_kernel_usage = """
  303. Modify and list Yocto BSP kernel config items and patches.
  304. usage: yocto-kernel [--version] [--help] COMMAND [ARGS]
  305. Current 'yocto-kernel' commands are:
  306. config list List the modifiable set of bare kernel config options for a BSP
  307. config add Add or modify bare kernel config options for a BSP
  308. config rm Remove bare kernel config options from a BSP
  309. patch list List the patches associated with a BSP
  310. patch add Patch the Yocto kernel for a BSP
  311. patch rm Remove patches from a BSP
  312. See 'yocto-kernel help COMMAND' for more information on a specific command.
  313. """
  314. yocto_kernel_help_usage = """
  315. usage: yocto-kernel help <subcommand>
  316. This command displays detailed help for the specified subcommand.
  317. """
  318. yocto_kernel_config_list_usage = """
  319. List the modifiable set of bare kernel config options for a BSP
  320. usage: yocto-kernel config list <bsp-name>
  321. This command lists the 'modifiable' config items for a BSP i.e. the
  322. items which are eligible for modification or removal by other
  323. yocto-kernel commands.
  324. 'modifiable' config items are the config items contained a BSP's
  325. user-config.cfg base config.
  326. """
  327. yocto_kernel_config_list_help = """
  328. NAME
  329. yocto-kernel config list - List the modifiable set of bare kernel
  330. config options for a BSP
  331. SYNOPSIS
  332. yocto-kernel config list <bsp-name>
  333. DESCRIPTION
  334. This command lists the 'modifiable' config items for a BSP
  335. i.e. the items which are eligible for modification or removal by
  336. other yocto-kernel commands.
  337. """
  338. yocto_kernel_config_add_usage = """
  339. Add or modify bare kernel config options for a BSP
  340. usage: yocto-kernel config add <bsp-name> [<CONFIG_XXX=x> ...]
  341. This command adds one or more CONFIG_XXX=x items to a BSP's user-config.cfg
  342. base config.
  343. """
  344. yocto_kernel_config_add_help = """
  345. NAME
  346. yocto-kernel config add - Add or modify bare kernel config options
  347. for a BSP
  348. SYNOPSIS
  349. yocto-kernel config add <bsp-name> [<CONFIG_XXX=x> ...]
  350. DESCRIPTION
  351. This command adds one or more CONFIG_XXX=x items to a BSP's
  352. foo.cfg base config.
  353. NOTE: It's up to the user to determine whether or not the config
  354. options being added make sense or not - this command does no
  355. sanity checking or verification of any kind to ensure that a
  356. config option really makes sense and will actually be set in in
  357. the final config. For example, if a config option depends on
  358. other config options, it will be turned off by kconfig if the
  359. other options aren't set correctly.
  360. """
  361. yocto_kernel_config_rm_usage = """
  362. Remove bare kernel config options from a BSP
  363. usage: yocto-kernel config rm <bsp-name>
  364. This command removes (turns off) one or more CONFIG_XXX items from a
  365. BSP's user-config.cfg base config.
  366. The set of config items available to be removed by this command for a
  367. BSP is listed and the user prompted for the specific items to remove.
  368. """
  369. yocto_kernel_config_rm_help = """
  370. NAME
  371. yocto-kernel config rm - Remove bare kernel config options from a
  372. BSP
  373. SYNOPSIS
  374. yocto-kernel config rm <bsp-name>
  375. DESCRIPTION
  376. This command removes (turns off) one or more CONFIG_XXX items from a
  377. BSP's user-config.cfg base config.
  378. The set of config items available to be removed by this command
  379. for a BSP is listed and the user prompted for the specific items
  380. to remove.
  381. """
  382. yocto_kernel_patch_list_usage = """
  383. List the patches associated with the kernel for a BSP
  384. usage: yocto-kernel patch list <bsp-name>
  385. This command lists the patches associated with a BSP.
  386. NOTE: this only applies to patches listed in the kernel recipe's
  387. user-patches.scc file (and currently repeated in its SRC_URI).
  388. """
  389. yocto_kernel_patch_list_help = """
  390. NAME
  391. yocto-kernel patch list - List the patches associated with the kernel
  392. for a BSP
  393. SYNOPSIS
  394. yocto-kernel patch list <bsp-name>
  395. DESCRIPTION
  396. This command lists the patches associated with a BSP.
  397. NOTE: this only applies to patches listed in the kernel recipe's
  398. user-patches.scc file (and currently repeated in its SRC_URI).
  399. """
  400. yocto_kernel_patch_add_usage = """
  401. Patch the Yocto kernel for a specific BSP
  402. usage: yocto-kernel patch add <bsp-name> [<PATCH> ...]
  403. This command adds one or more patches to a BSP's machine branch. The
  404. patch will be added to the BSP's linux-yocto kernel user-patches.scc
  405. file (and currently repeated in its SRC_URI) and will be guaranteed
  406. to be applied in the order specified.
  407. """
  408. yocto_kernel_patch_add_help = """
  409. NAME
  410. yocto-kernel patch add - Patch the Yocto kernel for a specific BSP
  411. SYNOPSIS
  412. yocto-kernel patch add <bsp-name> [<PATCH> ...]
  413. DESCRIPTION
  414. This command adds one or more patches to a BSP's machine branch.
  415. The patch will be added to the BSP's linux-yocto kernel
  416. user-patches.scc file (and currently repeated in its SRC_URI) and
  417. will be guaranteed to be applied in the order specified.
  418. NOTE: It's up to the user to determine whether or not the patches
  419. being added makes sense or not - this command does no sanity
  420. checking or verification of any kind to ensure that a patch can
  421. actually be applied to the BSP's kernel branch; it's assumed that
  422. the user has already done that.
  423. """
  424. yocto_kernel_patch_rm_usage = """
  425. Remove a patch from the Yocto kernel for a specific BSP
  426. usage: yocto-kernel patch rm <bsp-name>
  427. This command removes one or more patches from a BSP's machine branch.
  428. The patch will be removed from the BSP's linux-yocto kernel
  429. user-patches.scc file (and currently repeated in its SRC_URI) and
  430. kernel SRC_URI dir.
  431. The set of patches available to be removed by this command for a BSP
  432. is listed and the user prompted for the specific patches to remove.
  433. """
  434. yocto_kernel_patch_rm_help = """
  435. NAME
  436. yocto-kernel patch rm - Remove a patch from the Yocto kernel for a specific BSP
  437. SYNOPSIS
  438. yocto-kernel patch rm <bsp-name>
  439. DESCRIPTION
  440. This command removes one or more patches from a BSP's machine
  441. branch. The patch will be removed from the BSP's linux-yocto
  442. kernel user-patches.scc file (and currently repeated in its
  443. SRC_URI).
  444. The set of patches available to be removed by this command for a
  445. BSP is listed and the user prompted for the specific patches to
  446. remove.
  447. """
  448. ##
  449. # yocto-layer help and usage strings
  450. ##
  451. yocto_layer_usage = """
  452. Create a generic Yocto layer.
  453. usage: yocto-layer [--version] [--help] COMMAND [ARGS]
  454. Current 'yocto-layer' commands are:
  455. create Create a new generic Yocto layer
  456. list List available values for input options and properties
  457. See 'yocto-layer help COMMAND' for more information on a specific command.
  458. """
  459. yocto_layer_help_usage = """
  460. usage: yocto-layer help <subcommand>
  461. This command displays detailed help for the specified subcommand.
  462. """
  463. yocto_layer_create_usage = """
  464. Create a new generic Yocto layer
  465. usage: yocto-layer create <layer-name> [-o <DIRNAME> | --outdir <DIRNAME>]
  466. [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>]
  467. This command creates a generic Yocto layer based on the specified
  468. parameters. The new layer will be a new Yocto layer contained by
  469. default within the top-level directory specified as
  470. 'meta-layer-name'. The -o option can be used to place the layer in a
  471. directory with a different name and location.
  472. NOTE: Once created, you should add your new layer to your
  473. bblayers.conf file in order for it to be subsequently seen and
  474. modified by the yocto-kernel tool. Instructions for doing this can
  475. be found in the README file generated in the layer's top-level
  476. directory.
  477. See 'yocto layer help create' for more detailed instructions.
  478. """
  479. yocto_layer_create_help = """
  480. NAME
  481. yocto-layer create - Create a new generic Yocto layer
  482. SYNOPSIS
  483. yocto-layer create <layer-name> [-o <DIRNAME> | --outdir <DIRNAME>]
  484. [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>]
  485. DESCRIPTION
  486. This command creates a generic Yocto layer based on the specified
  487. parameters. The new layer will be a new Yocto layer contained by
  488. default within the top-level directory specified as
  489. 'meta-layer-name'. The -o option can be used to place the layer
  490. in a directory with a different name and location.
  491. The layer-specific properties that define the values that will be
  492. used to generate the layer can be specified on the command-line
  493. using the -i option and supplying a JSON object consisting of the
  494. set of name:value pairs needed by the layer.
  495. If the -i option is not used, the user will be interactively
  496. prompted for each of the required property values, which will then
  497. be used as values for layer generation.
  498. The set of properties available can be listed using the
  499. 'yocto-layer list' command.
  500. Specifying -c causes the Python code generated and executed to
  501. create the layer to be dumped to the 'bspgen.out' file in the
  502. current directory, and is useful for debugging.
  503. NOTE: Once created, you should add your new layer to your
  504. bblayers.conf file in order for it to be subsequently seen and
  505. modified by the yocto-kernel tool. Instructions for doing this
  506. can be found in the README file generated in the layer's top-level
  507. directory.
  508. For example, assuming your poky repo is at /path/to/poky, your new
  509. layer is at /path/to/poky/meta-mylayer, and your build directory
  510. is /path/to/build:
  511. $ gedit /path/to/build/conf/bblayers.conf
  512. BBLAYERS ?= " \\
  513. /path/to/poky/meta \\
  514. /path/to/poky/meta-yocto \\
  515. /path/to/poky/meta-mylayer \\
  516. "
  517. """
  518. yocto_layer_list_usage = """
  519. usage: yocto-layer list properties
  520. [-o <JSON PROPERTY FILE> | --outfile <JSON PROPERTY_FILE>]
  521. yocto-layer list property <xxx>
  522. [-o <JSON PROPERTY FILE> | --outfile <JSON PROPERTY_FILE>]
  523. This command enumerates the complete set of possible values for a
  524. specified option or property needed by the layer creation process.
  525. The first form enumerates all the possible properties that exist and
  526. must have values specified for them in the 'yocto-layer create'
  527. command.
  528. The second form enumerates all the possible values that exist and can
  529. be specified for any of the enumerable properties in the 'yocto-layer
  530. create' command.
  531. See 'yocto-layer help list' for more details.
  532. """
  533. yocto_layer_list_help = """
  534. NAME
  535. yocto-layer list - List available values for layer input options and properties
  536. SYNOPSIS
  537. yocto-layer list properties
  538. [--o <JSON PROPERTY FILE> | -outfile <JSON PROPERTY_FILE>]
  539. yocto-layer list property <xxx>
  540. [--o <JSON PROPERTY FILE> | -outfile <JSON PROPERTY_FILE>]
  541. DESCRIPTION
  542. This command enumerates the complete set of possible values for a
  543. specified option or property needed by the layer creation process.
  544. The first form enumerates all the possible properties that exist
  545. and must have values specified for them in the 'yocto-layer
  546. create' command. This command is mainly meant to aid the
  547. development of user interface alternatives to the default
  548. text-based prompting interface. If the -o option is specified,
  549. the list of properties, in addition to being displayed, will be
  550. written to the specified file as a JSON object. In this case, the
  551. object will consist of the set of name:value pairs corresponding
  552. to the (possibly nested) dictionary of properties defined by the
  553. input statements used by the BSP. Some example output for the
  554. 'list properties' command:
  555. $ yocto-layer list properties
  556. "example_bbappend_name" : {
  557. "default" : example
  558. "msg" : Please enter the name you'd like to use for your bbappend file:
  559. "type" : edit
  560. "prio" : 20
  561. "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall
  562. }
  563. "create_example_recipe" : {
  564. "default" : n
  565. "msg" : Would you like to have an example recipe created? (y/n)
  566. "type" : boolean
  567. "prio" : 20
  568. "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall
  569. }
  570. "example_recipe_name" : {
  571. "default" : example
  572. "msg" : Please enter the name you'd like to use for your example recipe:
  573. "type" : edit
  574. "prio" : 20
  575. "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall
  576. }
  577. "layer_priority" : {
  578. "default" : 6
  579. "msg" : Please enter the layer priority you'd like to use for the layer:
  580. "type" : edit
  581. "prio" : 20
  582. "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall
  583. }
  584. "create_example_bbappend" : {
  585. "default" : n
  586. "msg" : Would you like to have an example bbappend file created? (y/n)
  587. "type" : boolean
  588. "prio" : 20
  589. "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall
  590. }
  591. "example_bbappend_version" : {
  592. "default" : 0.1
  593. "msg" : Please enter the version number you'd like to use for your bbappend file (this should match the recipe you're appending to):
  594. "type" : edit
  595. "prio" : 20
  596. "filename" : /home/trz/yocto/yocto-layer-dev/scripts/lib/bsp/substrate/target/arch/layer/layer-questions.noinstall
  597. }
  598. Each entry in the output consists of the name of the input element
  599. e.g. "layer_priority", followed by the properties defined for that
  600. element enclosed in braces. This information should provide
  601. sufficient information to create a complete user interface. Two
  602. features of the scheme provide for conditional input. First, if a
  603. Python "if" statement appears in place of an input element name,
  604. the set of enclosed input elements apply and should be presented
  605. to the user only if the 'if' statement evaluates to true. The
  606. test in the if statement will always reference another input
  607. element in the list, which means that the element being tested
  608. should be presented to the user before the elements enclosed by
  609. the if block. Secondly, in a similar way, some elements contain
  610. "depends-on" and depends-on-val" tags, which mean that the
  611. affected input element should only be presented to the user if the
  612. element it depends on has already been presented to the user and
  613. the user has selected the specified value for that element.
  614. The second form enumerates all the possible values that exist and
  615. can be specified for any of the enumerable properties in the
  616. 'yocto-layer create' command. If the -o option is specified, the
  617. list of values for the given property, in addition to being
  618. displayed, will be written to the specified file as a JSON object.
  619. In this case, the object will consist of the set of name:value
  620. pairs corresponding to the array of property values associated
  621. with the property.
  622. $ yocto-layer list property layer_priority
  623. [no output - layer_priority is a text field that has no enumerable values]
  624. The second form as well is meant mainly for developers of
  625. alternative interfaces - it allows the developer to fetch the
  626. possible values for a given input element on-demand. This
  627. on-demand capability is especially valuable for elements that
  628. require relatively expensive remote operations to fulfill, such as
  629. the example that returns the set of branches available in a remote
  630. git tree above.
  631. """
  632. ##
  633. # test code
  634. ##
  635. test_bsp_properties = {
  636. 'smp': 'yes',
  637. 'touchscreen': 'yes',
  638. 'keyboard': 'no',
  639. 'xserver': 'yes',
  640. 'xserver_choice': 'xserver-i915',
  641. 'features': ['goodfeature', 'greatfeature'],
  642. 'tunefile': 'tune-quark',
  643. }