blob: 8035418cac0cad83244253e1a02028c784f3cfc0 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001documentation
2=============
3
4This is the directory that contains the Yocto Project documentation. The Yocto
Andrew Geisslerd1e89492021-02-12 15:35:20 -06005Project source repositories at https://git.yoctoproject.org/cgit.cgi have two
Patrick Williamsc124f4f2015-09-15 14:41:29 -05006instances of the "documentation" directory. You should understand each of
7these 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
32Manual Organization
33===================
34
William A. Kennington IIIac69b482021-06-02 12:28:27 -070035Here the folders corresponding to individual manuals:
Patrick Williamsc124f4f2015-09-15 14:41:29 -050036
Andrew Geissler5082cc72023-09-11 08:41:39 -040037* brief-yoctoprojectqs - Yocto Project Quick Start
Andrew Geissler5199d832021-09-24 16:47:35 -050038* overview-manual - Yocto Project Overview and Concepts Manual
Andrew Geissler5082cc72023-09-11 08:41:39 -040039* contributor-guide - Yocto Project and OpenEmbedded Contributor Guide
40* ref-manual - Yocto Project Reference Manual
Andrew Geissler5199d832021-09-24 16:47:35 -050041* bsp-guide - Yocto Project Board Support Package (BSP) Developer's Guide
42* dev-manual - Yocto Project Development Tasks Manual
43* kernel-dev - Yocto Project Linux Kernel Development Manual
Andrew Geissler5199d832021-09-24 16:47:35 -050044* profile-manual - Yocto Project Profiling and Tracing Manual
Andrew Geissler5082cc72023-09-11 08:41:39 -040045* sdk-manual - Yocto Project Software Development Kit (SDK) Developer's Guide.
Andrew Geissler5199d832021-09-24 16:47:35 -050046* toaster-manual - Toaster User Manual
47* test-manual - Yocto Project Test Environment Manual
Andrew Geissler5082cc72023-09-11 08:41:39 -040048* migration-guides - Yocto Project Release and Migration Notes
Patrick Williamsc124f4f2015-09-15 14:41:29 -050049
Andrew Geisslerc3d88e42020-10-02 09:45:00 -050050Each folder is self-contained regarding content and figures.
Patrick Williamsc124f4f2015-09-15 14:41:29 -050051
52If you want to find HTML versions of the Yocto Project manuals on the web,
Andrew Geissler5199d832021-09-24 16:47:35 -050053the current versions reside at https://docs.yoctoproject.org.
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054
Andrew Geisslerc3d88e42020-10-02 09:45:00 -050055poky.yaml
56=========
Patrick Williamsc124f4f2015-09-15 14:41:29 -050057
58This file defines variables used for documentation production. The variables
59are used to define release pathnames, URLs for the published manuals, etc.
60
Andrew Geissler595f6302022-01-24 19:11:47 +000061standards.md
62============
63
64This file specifies some rules to follow when contributing to the documentation.
65
66template/
67=========
68
69Contains a template.svg, to make it easier to create consistent
70SVG diagrams.
Patrick Williamsc124f4f2015-09-15 14:41:29 -050071
Andrew Geisslerc3d88e42020-10-02 09:45:00 -050072Sphinx
73======
74
75The Yocto Project documentation was migrated from the original DocBook
76format to Sphinx based documentation for the Yocto Project 3.2
77release. This section will provide additional information related to
78the Sphinx migration, and guidelines for developers willing to
79contribute to the Yocto Project documentation.
80
81 Sphinx is a tool that makes it easy to create intelligent and
82 beautiful documentation, written by Georg Brandl and licensed under
83 the BSD license. It was originally created for the Python
84 documentation.
85
86Extensive documentation is available on the Sphinx website:
87https://www.sphinx-doc.org/en/master/. Sphinx is designed to be
88extensible thanks to the ability to write our own custom extensions,
89as Python modules, which will be executed during the generation of the
90documentation.
91
92Yocto Project documentation website
93===================================
94
Andrew Geissler09036742021-06-25 14:25:14 -050095The website hosting the Yocto Project documentation, can be found
96at: https://docs.yoctoproject.org/.
Andrew Geisslerc3d88e42020-10-02 09:45:00 -050097
Andrew Geissler95ac1b82021-03-31 14:34:31 -050098The entire Yocto Project documentation, as well as the BitBake manual,
Andrew Geisslerc3d88e42020-10-02 09:45:00 -050099is published on this website, including all previously released
100versions. A version switcher was added, as a drop-down menu on the top
101of the page to switch back and forth between the various versions of
102the current active Yocto Project releases.
103
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500104Transition pages have been added (as rst files) to show links to old
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500105versions of the Yocto Project documentation with links to each manual
106generated with DocBook.
107
108How to build the Yocto Project documentation
109============================================
110
111Sphinx is written in Python. While it might work with Python2, for
112obvious reasons, we will only support building the Yocto Project
113documentation with Python3.
114
115Sphinx might be available in your Linux distro packages repositories,
Andrew Geissler3b8a17c2021-04-15 15:55:55 -0500116however it is not recommended to use distro packages, as they might be
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500117old versions, especially if you are using an LTS version of your
Andrew Geissler9aee5002022-03-30 16:27:02 +0000118distro. The recommended method to install the latest versions of Sphinx
119and of its required dependencies is to use the Python Package Index (pip).
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500120
121To install all required packages run:
122
123 $ pip3 install sphinx sphinx_rtd_theme pyyaml
124
Andrew Geissler9aee5002022-03-30 16:27:02 +0000125To make sure you always have the latest versions of such packages, you
126should regularly run the same command with an added "--upgrade" option:
127
128 $ pip3 install --upgrade sphinx sphinx_rtd_theme pyyaml
129
Andrew Geisslereff27472021-10-29 15:35:00 -0500130Also install the "inkscape" package from your distribution.
131Inkscape is need to convert SVG graphics to PNG (for EPUB
132export) and to PDF (for PDF export).
133
Patrick Williams92b42cb2022-09-03 06:53:57 -0500134Additionally install "fncychap.sty" TeX font if you want to build PDFs. Debian
135and Ubuntu have it in "texlive-latex-extra" package while RedHat distributions
136and OpenSUSE have it in "texlive-fncychap" package for example.
137
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500138To build the documentation locally, run:
139
140 $ cd documentation
Andrew Geisslerf0343792020-11-18 10:42:21 -0600141 $ make html
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500142
143The resulting HTML index page will be _build/html/index.html, and you
144can browse your own copy of the locally generated documentation with
145your browser.
146
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600147Alternatively, you can use Pipenv to automatically install all required
148dependencies in a virtual environment:
149
150 $ cd documentation
151 $ pipenv install
152 $ pipenv run make html
153
Patrick Williams03514f12024-04-05 07:04:11 -0500154Style checking the Yocto Project documentation
155==============================================
156
157The project is starting to use Vale (https://vale.sh/)
158to validate the text style.
159
160To install Vale:
161
162 $ pip install vale
163
164To run Vale:
165
166 $ make stylecheck
167
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500168Sphinx theme and CSS customization
169==================================
170
171The Yocto Project documentation is currently based on the "Read the
172Docs" Sphinx theme, with a few changes to make sure the look and feel
173of the project documentation is preserved.
174
175Most of the theme changes can be done using the file
176'sphinx-static/theme_overrides.css'. Most CSS changes in this file
177were inherited from the DocBook CSS stylesheets.
178
179Sphinx design guidelines and principles
180=======================================
181
182The initial Docbook to Sphinx migration was done with an automated
183tool called Pandoc (https://pandoc.org/). The tool produced some clean
184output markdown text files. After the initial automated conversion
185additional changes were done to fix up headings, images and links. In
186addition Sphinx has built in mechanisms (directives) which were used
187to replace similar functions implemented in Docbook such as glossary,
188variables substitutions, notes and references.
189
190Headings
191========
192
193The layout of the Yocto Project manuals is organized as follows
194
195 Book
196 Chapter
197 Section
Andrew Geissler9aee5002022-03-30 16:27:02 +0000198 Subsection
199 Subsubsection
200 Subsubsubsection
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500201
Andrew Geissler9aee5002022-03-30 16:27:02 +0000202Here are the heading styles that we use in the manuals:
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500203
Andrew Geissler9aee5002022-03-30 16:27:02 +0000204 Book => overline ===
205 Chapter => overline ***
206 Section => ====
207 Subsection => ----
208 Subsubsection => ~~~~
209 Subsubsubsection => ^^^^
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500210
211With this proposal, we preserve the same TOCs between Sphinx and Docbook.
212
213Built-in glossary
214=================
215
216Sphinx has a glossary directive. From
217https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#glossary:
218
219 This directive must contain a reST definition list with terms and
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500220 definitions. It's then possible to refer to each definition through the
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500221 [https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-term
222 'term' role].
223
224So anywhere in any of the Yocto Project manuals, :term:`VAR` can be
225used to refer to an item from the glossary, and a link is created
226automatically. A general index of terms is also generated by Sphinx
227automatically.
228
229Global substitutions
230====================
231
232The Yocto Project documentation makes heavy use of global
233variables. In Docbook these variables are stored in the file
234poky.ent. This Docbook feature is not handled automatically with
235Pandoc. Sphinx has builtin support for substitutions
236(https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#substitutions),
237however there are important shortcomings. For example they cannot be
238used/nested inside code-block sections.
239
240A Sphinx extension was implemented to support variable substitutions
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500241to mimic the DocBook based documentation behavior. Variable
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500242substitutions are done while reading/parsing the .rst files. The
243pattern for variables substitutions is the same as with DocBook,
244e.g. `&VAR;`.
245
246The implementation of the extension can be found here in the file
247documentation/sphinx/yocto-vars.py, this extension is enabled by
248default when building the Yocto Project documentation. All variables
249are set in a file call poky.yaml, which was initially generated from
250poky.ent. The file was converted into YAML so that it is easier to
251process by the custom Sphinx extension (which is a Python module).
252
253For example, the following .rst content will produce the 'expected'
254content:
255
256 .. code-block::
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500257 $ mkdir poky-&DISTRO;
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500258 or
259 $ git clone &YOCTO_GIT_URL;/git/poky -b &DISTRO_NAME_NO_CAP;
260
261Variables can be nested, like it was the case for DocBook:
262
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600263 YOCTO_HOME_URL : "https://www.yoctoproject.org"
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500264 YOCTO_DOCS_URL : "&YOCTO_HOME_URL;/docs"
265
266Note directive
267==============
268
269Sphinx has a builtin 'note' directive that produces clean Note section
270in the output file. There are various types of directives such as
271"attention", "caution", "danger", "error", "hint", "important", "tip",
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500272"warning", "admonition" that are supported, and additional directives
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500273can be added as Sphinx extension if needed.
274
275Figures
276=======
277
278The Yocto Project documentation has many figures/images. Sphinx has a
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500279'figure' directive which is straightforward to use. To include a
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500280figure in the body of the documentation:
281
282 .. image:: figures/YP-flow-diagram.png
283
284Links and References
285====================
286
287The following types of links can be used: links to other locations in
288the same document, to locations in other documents and to external
289websites.
290
291More information can be found here:
292https://sublime-and-sphinx-guide.readthedocs.io/en/latest/references.html.
293
Patrick Williams2390b1b2022-11-03 13:47:49 -0500294For external links, we use this syntax:
295`link text <link URL>`__
296
297instead of:
298`link text <link URL>`_
299
300Both syntaxes work, but the latter also creates a "link text" reference
301target which could conflict with other references with the same name.
302So, only use this variant when you wish to make multiple references
303to this link, reusing only the target name.
304
305See https://stackoverflow.com/questions/27420317/restructured-text-rst-http-links-underscore-vs-use
306
Andrew Geissler3b8a17c2021-04-15 15:55:55 -0500307Anchor (<#link>) links are forbidden as they are not checked by Sphinx during
308the build and may be broken without knowing about it.
309
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500310References
311==========
312
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500313The following extension is enabled by default:
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500314sphinx.ext.autosectionlabel
315(https://www.sphinx-doc.org/en/master/usage/extensions/autosectionlabel.html).
316
317This extension allows you to refer sections by their titles. Note that
318autosectionlabel_prefix_document is enabled by default, so that we can
319insert references from any document.
320
321For example, to insert an HTML link to a section from
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500322documentation/manual/intro.rst, use:
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500323
324 Please check this :ref:`manual/intro:Cross-References to Locations in the Same Document`
325
326Alternatively a custom text can be used instead of using the section
327text:
328
329 Please check this :ref:`section <manual/intro:Cross-References to Locations in the Same Document>`
330
331TIP: The following command can be used to dump all the references that
332 are defined in the project documentation:
333
334 python -msphinx.ext.intersphinx <path to build folder>/html/objects.inv
335
336This dump contains all links and for each link it shows the default
337"Link Text" that Sphinx would use. If the default link text is not
338appropriate, a custom link text can be used in the ':ref:' directive.
339
340Extlinks
341========
342
343The sphinx.ext.extlinks extension is enabled by default
344(https://sublime-and-sphinx-guide.readthedocs.io/en/latest/references.html#use-the-external-links-extension),
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500345and it is configured with the 'extlinks' definitions in
346the 'documentation/conf.py' file:
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500347
348 'yocto_home': ('https://yoctoproject.org%s', None),
349 'yocto_wiki': ('https://wiki.yoctoproject.org%s', None),
350 'yocto_dl': ('https://downloads.yoctoproject.org%s', None),
351 'yocto_lists': ('https://lists.yoctoproject.org%s', None),
352 'yocto_bugs': ('https://bugzilla.yoctoproject.org%s', None),
353 'yocto_ab': ('https://autobuilder.yoctoproject.org%s', None),
354 'yocto_docs': ('https://docs.yoctoproject.org%s', None),
355 'yocto_git': ('https://git.yoctoproject.org%s', None),
356 'oe_home': ('https://www.openembedded.org%s', None),
357 'oe_lists': ('https://lists.openembedded.org%s', None),
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500358 'oe_git': ('https://git.openembedded.org%s', None),
359 'oe_wiki': ('https://www.openembedded.org/wiki%s', None),
360 'oe_layerindex': ('https://layers.openembedded.org%s', None),
361 'oe_layer': ('https://layers.openembedded.org/layerindex/branch/master/layer%s', None),
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500362
363It creates convenient shortcuts which can be used throughout the
364documentation rst files, as:
365
366 Please check this :yocto_wiki:`wiki page </Weekly_Status>`
367
368Intersphinx links
369=================
370
371The sphinx.ext.intersphinx extension is enabled by default
372(https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html),
373so that we can cross reference content from other Sphinx based
374documentation projects, such as the BitBake manual.
375
Andrew Geisslerfc113ea2023-03-31 09:59:46 -0500376References to the BitBake manual can directly be done:
Patrick Williams213cb262021-08-07 19:21:33 -0500377 - With a specific description instead of the section name:
Andrew Geisslerfc113ea2023-03-31 09:59:46 -0500378 :ref:`Azure Storage fetcher (az://) <bitbake-user-manual/bitbake-user-manual-fetching:fetchers>`
Patrick Williams213cb262021-08-07 19:21:33 -0500379 - With the section name:
Andrew Geisslerfc113ea2023-03-31 09:59:46 -0500380 :ref:`bitbake-user-manual/bitbake-user-manual-intro:usage and syntax` option
381
382If you want to refer to an entire document (or chapter) in the BitBake manual,
383you have to use the ":doc:" macro with the "bitbake:" prefix:
384 - :doc:`BitBake User Manual <bitbake:index>`
385 - :doc:`bitbake:bitbake-user-manual/bitbake-user-manual-metadata`" chapter
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500386
Patrick Williams213cb262021-08-07 19:21:33 -0500387Note that a reference to a variable (:term:`VARIABLE`) automatically points to
388the BitBake manual if the variable is not described in the Reference Manual's Variable Glossary.
389However, if you need to bypass this, you can explicitely refer to a description in the
390BitBake manual as follows:
391
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500392 :term:`bitbake:BB_NUMBER_PARSE_THREADS`
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600393
Andrew Geisslerfc113ea2023-03-31 09:59:46 -0500394This would be the same if we had identical document filenames in
395both the Yocto Project and BitBake manuals:
396
397 :ref:`bitbake:directory/file:section title`
398
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600399Submitting documentation changes
400================================
401
402Please see the top level README file in this repository for details of where
403to send patches.