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