README 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. documentation
  2. =============
  3. This is the directory that contains the Yocto Project documentation. The Yocto
  4. Project source repositories at https://git.yoctoproject.org/cgit.cgi have two
  5. instances of the "documentation" directory. You should understand each of
  6. these instances.
  7. poky/documentation - The directory within the poky Git repository containing
  8. the set of Yocto Project manuals. When you clone the
  9. poky Git repository, the documentation directory
  10. contains the manuals. The state of the manuals in this
  11. directory is guaranteed to reflect the latest Yocto
  12. Project release. The manuals at the tip of this
  13. directory will also likely contain most manual
  14. development changes.
  15. yocto-docs/documentation - The Git repository for the Yocto Project manuals.
  16. This repository is where manual development
  17. occurs. If you plan on contributing back to the
  18. Yocto Project documentation, you should set up
  19. a local Git repository based on this upstream
  20. repository as follows:
  21. git clone git://git.yoctoproject.org/yocto-docs
  22. Changes and patches are first pushed to the
  23. yocto-docs Git repository. Later, they make it
  24. into the poky Git repository found at
  25. git://git.yoctoproject.org/poky.
  26. Manual Organization
  27. ===================
  28. Here the folders corresponding to individual manuals:
  29. * overview-manual - Yocto Project Overview and Concepts Manual
  30. * sdk-manual - Yocto Project Software Development Kit (SDK) Developer's Guide.
  31. * bsp-guide - Yocto Project Board Support Package (BSP) Developer's Guide
  32. * dev-manual - Yocto Project Development Tasks Manual
  33. * kernel-dev - Yocto Project Linux Kernel Development Manual
  34. * ref-manual - Yocto Project Reference Manual
  35. * brief-yoctoprojectqs - Yocto Project Quick Start
  36. * profile-manual - Yocto Project Profiling and Tracing Manual
  37. * toaster-manual - Toaster User Manual
  38. * test-manual - Yocto Project Test Environment Manual
  39. Each folder is self-contained regarding content and figures.
  40. If you want to find HTML versions of the Yocto Project manuals on the web,
  41. the current versions reside at https://docs.yoctoproject.org.
  42. poky.yaml
  43. =========
  44. This file defines variables used for documentation production. The variables
  45. are used to define release pathnames, URLs for the published manuals, etc.
  46. standards.md
  47. ============
  48. This file specifies some rules to follow when contributing to the documentation.
  49. template/
  50. =========
  51. Contains a template.svg, to make it easier to create consistent
  52. SVG diagrams.
  53. Sphinx
  54. ======
  55. The Yocto Project documentation was migrated from the original DocBook
  56. format to Sphinx based documentation for the Yocto Project 3.2
  57. release. This section will provide additional information related to
  58. the Sphinx migration, and guidelines for developers willing to
  59. contribute to the Yocto Project documentation.
  60. Sphinx is a tool that makes it easy to create intelligent and
  61. beautiful documentation, written by Georg Brandl and licensed under
  62. the BSD license. It was originally created for the Python
  63. documentation.
  64. Extensive documentation is available on the Sphinx website:
  65. https://www.sphinx-doc.org/en/master/. Sphinx is designed to be
  66. extensible thanks to the ability to write our own custom extensions,
  67. as Python modules, which will be executed during the generation of the
  68. documentation.
  69. Yocto Project documentation website
  70. ===================================
  71. The website hosting the Yocto Project documentation, can be found
  72. at: https://docs.yoctoproject.org/.
  73. The entire Yocto Project documentation, as well as the BitBake manual,
  74. is published on this website, including all previously released
  75. versions. A version switcher was added, as a drop-down menu on the top
  76. of the page to switch back and forth between the various versions of
  77. the current active Yocto Project releases.
  78. Transition pages have been added (as rst files) to show links to old
  79. versions of the Yocto Project documentation with links to each manual
  80. generated with DocBook.
  81. How to build the Yocto Project documentation
  82. ============================================
  83. Sphinx is written in Python. While it might work with Python2, for
  84. obvious reasons, we will only support building the Yocto Project
  85. documentation with Python3.
  86. Sphinx might be available in your Linux distro packages repositories,
  87. however it is not recommended to use distro packages, as they might be
  88. old versions, especially if you are using an LTS version of your
  89. distro. The recommended method to install Sphinx and all required
  90. dependencies is to use the Python Package Index (pip).
  91. To install all required packages run:
  92. $ pip3 install sphinx sphinx_rtd_theme pyyaml
  93. Also install the "inkscape" package from your distribution.
  94. Inkscape is need to convert SVG graphics to PNG (for EPUB
  95. export) and to PDF (for PDF export).
  96. To build the documentation locally, run:
  97. $ cd documentation
  98. $ make html
  99. The resulting HTML index page will be _build/html/index.html, and you
  100. can browse your own copy of the locally generated documentation with
  101. your browser.
  102. Alternatively, you can use Pipenv to automatically install all required
  103. dependencies in a virtual environment:
  104. $ cd documentation
  105. $ pipenv install
  106. $ pipenv run make html
  107. Sphinx theme and CSS customization
  108. ==================================
  109. The Yocto Project documentation is currently based on the "Read the
  110. Docs" Sphinx theme, with a few changes to make sure the look and feel
  111. of the project documentation is preserved.
  112. Most of the theme changes can be done using the file
  113. 'sphinx-static/theme_overrides.css'. Most CSS changes in this file
  114. were inherited from the DocBook CSS stylesheets.
  115. Sphinx design guidelines and principles
  116. =======================================
  117. The initial Docbook to Sphinx migration was done with an automated
  118. tool called Pandoc (https://pandoc.org/). The tool produced some clean
  119. output markdown text files. After the initial automated conversion
  120. additional changes were done to fix up headings, images and links. In
  121. addition Sphinx has built in mechanisms (directives) which were used
  122. to replace similar functions implemented in Docbook such as glossary,
  123. variables substitutions, notes and references.
  124. Headings
  125. ========
  126. The layout of the Yocto Project manuals is organized as follows
  127. Book
  128. Chapter
  129. Section
  130. Section
  131. Section
  132. Here are the heading styles defined in Sphinx:
  133. Book => overline ===
  134. Chapter => overline ***
  135. Section => ====
  136. Section => ----
  137. Section => ^^^^
  138. Section => """" or ~~~~
  139. With this proposal, we preserve the same TOCs between Sphinx and Docbook.
  140. Built-in glossary
  141. =================
  142. Sphinx has a glossary directive. From
  143. https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#glossary:
  144. This directive must contain a reST definition list with terms and
  145. definitions. It's then possible to refer to each definition through the
  146. [https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-term
  147. 'term' role].
  148. So anywhere in any of the Yocto Project manuals, :term:`VAR` can be
  149. used to refer to an item from the glossary, and a link is created
  150. automatically. A general index of terms is also generated by Sphinx
  151. automatically.
  152. Global substitutions
  153. ====================
  154. The Yocto Project documentation makes heavy use of global
  155. variables. In Docbook these variables are stored in the file
  156. poky.ent. This Docbook feature is not handled automatically with
  157. Pandoc. Sphinx has builtin support for substitutions
  158. (https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#substitutions),
  159. however there are important shortcomings. For example they cannot be
  160. used/nested inside code-block sections.
  161. A Sphinx extension was implemented to support variable substitutions
  162. to mimic the DocBook based documentation behavior. Variable
  163. substitutions are done while reading/parsing the .rst files. The
  164. pattern for variables substitutions is the same as with DocBook,
  165. e.g. `&VAR;`.
  166. The implementation of the extension can be found here in the file
  167. documentation/sphinx/yocto-vars.py, this extension is enabled by
  168. default when building the Yocto Project documentation. All variables
  169. are set in a file call poky.yaml, which was initially generated from
  170. poky.ent. The file was converted into YAML so that it is easier to
  171. process by the custom Sphinx extension (which is a Python module).
  172. For example, the following .rst content will produce the 'expected'
  173. content:
  174. .. code-block::
  175. $ mkdir poky-&DISTRO;
  176. or
  177. $ git clone &YOCTO_GIT_URL;/git/poky -b &DISTRO_NAME_NO_CAP;
  178. Variables can be nested, like it was the case for DocBook:
  179. YOCTO_HOME_URL : "https://www.yoctoproject.org"
  180. YOCTO_DOCS_URL : "&YOCTO_HOME_URL;/docs"
  181. Note directive
  182. ==============
  183. Sphinx has a builtin 'note' directive that produces clean Note section
  184. in the output file. There are various types of directives such as
  185. "attention", "caution", "danger", "error", "hint", "important", "tip",
  186. "warning", "admonition" that are supported, and additional directives
  187. can be added as Sphinx extension if needed.
  188. Figures
  189. =======
  190. The Yocto Project documentation has many figures/images. Sphinx has a
  191. 'figure' directive which is straightforward to use. To include a
  192. figure in the body of the documentation:
  193. .. image:: figures/YP-flow-diagram.png
  194. Links and References
  195. ====================
  196. The following types of links can be used: links to other locations in
  197. the same document, to locations in other documents and to external
  198. websites.
  199. More information can be found here:
  200. https://sublime-and-sphinx-guide.readthedocs.io/en/latest/references.html.
  201. Anchor (<#link>) links are forbidden as they are not checked by Sphinx during
  202. the build and may be broken without knowing about it.
  203. References
  204. ==========
  205. The following extension is enabled by default:
  206. sphinx.ext.autosectionlabel
  207. (https://www.sphinx-doc.org/en/master/usage/extensions/autosectionlabel.html).
  208. This extension allows you to refer sections by their titles. Note that
  209. autosectionlabel_prefix_document is enabled by default, so that we can
  210. insert references from any document.
  211. For example, to insert an HTML link to a section from
  212. documentation/manual/intro.rst, use:
  213. Please check this :ref:`manual/intro:Cross-References to Locations in the Same Document`
  214. Alternatively a custom text can be used instead of using the section
  215. text:
  216. Please check this :ref:`section <manual/intro:Cross-References to Locations in the Same Document>`
  217. TIP: The following command can be used to dump all the references that
  218. are defined in the project documentation:
  219. python -msphinx.ext.intersphinx <path to build folder>/html/objects.inv
  220. This dump contains all links and for each link it shows the default
  221. "Link Text" that Sphinx would use. If the default link text is not
  222. appropriate, a custom link text can be used in the ':ref:' directive.
  223. Extlinks
  224. ========
  225. The sphinx.ext.extlinks extension is enabled by default
  226. (https://sublime-and-sphinx-guide.readthedocs.io/en/latest/references.html#use-the-external-links-extension),
  227. and it is configured with the 'extlinks' definitions in
  228. the 'documentation/conf.py' file:
  229. 'yocto_home': ('https://yoctoproject.org%s', None),
  230. 'yocto_wiki': ('https://wiki.yoctoproject.org%s', None),
  231. 'yocto_dl': ('https://downloads.yoctoproject.org%s', None),
  232. 'yocto_lists': ('https://lists.yoctoproject.org%s', None),
  233. 'yocto_bugs': ('https://bugzilla.yoctoproject.org%s', None),
  234. 'yocto_ab': ('https://autobuilder.yoctoproject.org%s', None),
  235. 'yocto_docs': ('https://docs.yoctoproject.org%s', None),
  236. 'yocto_git': ('https://git.yoctoproject.org%s', None),
  237. 'oe_home': ('https://www.openembedded.org%s', None),
  238. 'oe_lists': ('https://lists.openembedded.org%s', None),
  239. 'oe_git': ('https://git.openembedded.org%s', None),
  240. 'oe_wiki': ('https://www.openembedded.org/wiki%s', None),
  241. 'oe_layerindex': ('https://layers.openembedded.org%s', None),
  242. 'oe_layer': ('https://layers.openembedded.org/layerindex/branch/master/layer%s', None),
  243. It creates convenient shortcuts which can be used throughout the
  244. documentation rst files, as:
  245. Please check this :yocto_wiki:`wiki page </Weekly_Status>`
  246. Intersphinx links
  247. =================
  248. The sphinx.ext.intersphinx extension is enabled by default
  249. (https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html),
  250. so that we can cross reference content from other Sphinx based
  251. documentation projects, such as the BitBake manual.
  252. References to the BitBake manual can be done:
  253. - With a specific description instead of the section name:
  254. :ref:`Azure Storage fetcher (az://) <bitbake:bitbake-user-manual/bitbake-user-manual-fetching:fetchers>`
  255. - With the section name:
  256. ":ref:`bitbake:bitbake-user-manual/bitbake-user-manual-intro:usage and syntax` option
  257. - Linking to the entire BitBake manual:
  258. :doc:`BitBake User Manual <bitbake:index>`
  259. Note that a reference to a variable (:term:`VARIABLE`) automatically points to
  260. the BitBake manual if the variable is not described in the Reference Manual's Variable Glossary.
  261. However, if you need to bypass this, you can explicitely refer to a description in the
  262. BitBake manual as follows:
  263. :term:`bitbake:BB_NUMBER_PARSE_THREADS`
  264. Submitting documentation changes
  265. ================================
  266. Please see the top level README file in this repository for details of where
  267. to send patches.