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