blob: 10b46de3e61a5712d790c56ca4576a825f54f27b [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 Geissler5199d832021-09-24 16:47:35 -050037* 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 Williamsc124f4f2015-09-15 14:41:29 -050047
Andrew Geisslerc3d88e42020-10-02 09:45:00 -050048Each folder is self-contained regarding content and figures.
Patrick Williamsc124f4f2015-09-15 14:41:29 -050049
50If you want to find HTML versions of the Yocto Project manuals on the web,
Andrew Geissler5199d832021-09-24 16:47:35 -050051the current versions reside at https://docs.yoctoproject.org.
Patrick Williamsc124f4f2015-09-15 14:41:29 -050052
Andrew Geisslerc3d88e42020-10-02 09:45:00 -050053poky.yaml
54=========
Patrick Williamsc124f4f2015-09-15 14:41:29 -050055
56This file defines variables used for documentation production. The variables
57are used to define release pathnames, URLs for the published manuals, etc.
58
Andrew Geissler595f6302022-01-24 19:11:47 +000059standards.md
60============
61
62This file specifies some rules to follow when contributing to the documentation.
63
64template/
65=========
66
67Contains a template.svg, to make it easier to create consistent
68SVG diagrams.
Patrick Williamsc124f4f2015-09-15 14:41:29 -050069
Andrew Geisslerc3d88e42020-10-02 09:45:00 -050070Sphinx
71======
72
73The Yocto Project documentation was migrated from the original DocBook
74format to Sphinx based documentation for the Yocto Project 3.2
75release. This section will provide additional information related to
76the Sphinx migration, and guidelines for developers willing to
77contribute 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
84Extensive documentation is available on the Sphinx website:
85https://www.sphinx-doc.org/en/master/. Sphinx is designed to be
86extensible thanks to the ability to write our own custom extensions,
87as Python modules, which will be executed during the generation of the
88documentation.
89
90Yocto Project documentation website
91===================================
92
Andrew Geissler09036742021-06-25 14:25:14 -050093The website hosting the Yocto Project documentation, can be found
94at: https://docs.yoctoproject.org/.
Andrew Geisslerc3d88e42020-10-02 09:45:00 -050095
Andrew Geissler95ac1b82021-03-31 14:34:31 -050096The entire Yocto Project documentation, as well as the BitBake manual,
Andrew Geisslerc3d88e42020-10-02 09:45:00 -050097is published on this website, including all previously released
98versions. A version switcher was added, as a drop-down menu on the top
99of the page to switch back and forth between the various versions of
100the current active Yocto Project releases.
101
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500102Transition pages have been added (as rst files) to show links to old
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500103versions of the Yocto Project documentation with links to each manual
104generated with DocBook.
105
106How to build the Yocto Project documentation
107============================================
108
109Sphinx is written in Python. While it might work with Python2, for
110obvious reasons, we will only support building the Yocto Project
111documentation with Python3.
112
113Sphinx might be available in your Linux distro packages repositories,
Andrew Geissler3b8a17c2021-04-15 15:55:55 -0500114however it is not recommended to use distro packages, as they might be
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500115old versions, especially if you are using an LTS version of your
116distro. The recommended method to install Sphinx and all required
117dependencies is to use the Python Package Index (pip).
118
119To install all required packages run:
120
121 $ pip3 install sphinx sphinx_rtd_theme pyyaml
122
Andrew Geisslereff27472021-10-29 15:35:00 -0500123Also install the "inkscape" package from your distribution.
124Inkscape is need to convert SVG graphics to PNG (for EPUB
125export) and to PDF (for PDF export).
126
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500127To build the documentation locally, run:
128
129 $ cd documentation
Andrew Geisslerf0343792020-11-18 10:42:21 -0600130 $ make html
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500131
132The resulting HTML index page will be _build/html/index.html, and you
133can browse your own copy of the locally generated documentation with
134your browser.
135
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600136Alternatively, you can use Pipenv to automatically install all required
137dependencies in a virtual environment:
138
139 $ cd documentation
140 $ pipenv install
141 $ pipenv run make html
142
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500143Sphinx theme and CSS customization
144==================================
145
146The Yocto Project documentation is currently based on the "Read the
147Docs" Sphinx theme, with a few changes to make sure the look and feel
148of the project documentation is preserved.
149
150Most of the theme changes can be done using the file
151'sphinx-static/theme_overrides.css'. Most CSS changes in this file
152were inherited from the DocBook CSS stylesheets.
153
154Sphinx design guidelines and principles
155=======================================
156
157The initial Docbook to Sphinx migration was done with an automated
158tool called Pandoc (https://pandoc.org/). The tool produced some clean
159output markdown text files. After the initial automated conversion
160additional changes were done to fix up headings, images and links. In
161addition Sphinx has built in mechanisms (directives) which were used
162to replace similar functions implemented in Docbook such as glossary,
163variables substitutions, notes and references.
164
165Headings
166========
167
168The layout of the Yocto Project manuals is organized as follows
169
170 Book
171 Chapter
172 Section
173 Section
174 Section
175
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700176Here are the heading styles defined in Sphinx:
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500177
178 Book => overline ===
179 Chapter => overline ***
180 Section => ====
181 Section => ----
182 Section => ^^^^
183 Section => """" or ~~~~
184
185With this proposal, we preserve the same TOCs between Sphinx and Docbook.
186
187Built-in glossary
188=================
189
190Sphinx has a glossary directive. From
191https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#glossary:
192
193 This directive must contain a reST definition list with terms and
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500194 definitions. It's then possible to refer to each definition through the
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500195 [https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-term
196 'term' role].
197
198So anywhere in any of the Yocto Project manuals, :term:`VAR` can be
199used to refer to an item from the glossary, and a link is created
200automatically. A general index of terms is also generated by Sphinx
201automatically.
202
203Global substitutions
204====================
205
206The Yocto Project documentation makes heavy use of global
207variables. In Docbook these variables are stored in the file
208poky.ent. This Docbook feature is not handled automatically with
209Pandoc. Sphinx has builtin support for substitutions
210(https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#substitutions),
211however there are important shortcomings. For example they cannot be
212used/nested inside code-block sections.
213
214A Sphinx extension was implemented to support variable substitutions
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500215to mimic the DocBook based documentation behavior. Variable
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500216substitutions are done while reading/parsing the .rst files. The
217pattern for variables substitutions is the same as with DocBook,
218e.g. `&VAR;`.
219
220The implementation of the extension can be found here in the file
221documentation/sphinx/yocto-vars.py, this extension is enabled by
222default when building the Yocto Project documentation. All variables
223are set in a file call poky.yaml, which was initially generated from
224poky.ent. The file was converted into YAML so that it is easier to
225process by the custom Sphinx extension (which is a Python module).
226
227For example, the following .rst content will produce the 'expected'
228content:
229
230 .. code-block::
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500231 $ mkdir poky-&DISTRO;
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500232 or
233 $ git clone &YOCTO_GIT_URL;/git/poky -b &DISTRO_NAME_NO_CAP;
234
235Variables can be nested, like it was the case for DocBook:
236
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600237 YOCTO_HOME_URL : "https://www.yoctoproject.org"
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500238 YOCTO_DOCS_URL : "&YOCTO_HOME_URL;/docs"
239
240Note directive
241==============
242
243Sphinx has a builtin 'note' directive that produces clean Note section
244in the output file. There are various types of directives such as
245"attention", "caution", "danger", "error", "hint", "important", "tip",
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500246"warning", "admonition" that are supported, and additional directives
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500247can be added as Sphinx extension if needed.
248
249Figures
250=======
251
252The Yocto Project documentation has many figures/images. Sphinx has a
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500253'figure' directive which is straightforward to use. To include a
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500254figure in the body of the documentation:
255
256 .. image:: figures/YP-flow-diagram.png
257
258Links and References
259====================
260
261The following types of links can be used: links to other locations in
262the same document, to locations in other documents and to external
263websites.
264
265More information can be found here:
266https://sublime-and-sphinx-guide.readthedocs.io/en/latest/references.html.
267
Andrew Geissler3b8a17c2021-04-15 15:55:55 -0500268Anchor (<#link>) links are forbidden as they are not checked by Sphinx during
269the build and may be broken without knowing about it.
270
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500271References
272==========
273
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500274The following extension is enabled by default:
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500275sphinx.ext.autosectionlabel
276(https://www.sphinx-doc.org/en/master/usage/extensions/autosectionlabel.html).
277
278This extension allows you to refer sections by their titles. Note that
279autosectionlabel_prefix_document is enabled by default, so that we can
280insert references from any document.
281
282For example, to insert an HTML link to a section from
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500283documentation/manual/intro.rst, use:
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500284
285 Please check this :ref:`manual/intro:Cross-References to Locations in the Same Document`
286
287Alternatively a custom text can be used instead of using the section
288text:
289
290 Please check this :ref:`section <manual/intro:Cross-References to Locations in the Same Document>`
291
292TIP: The following command can be used to dump all the references that
293 are defined in the project documentation:
294
295 python -msphinx.ext.intersphinx <path to build folder>/html/objects.inv
296
297This dump contains all links and for each link it shows the default
298"Link Text" that Sphinx would use. If the default link text is not
299appropriate, a custom link text can be used in the ':ref:' directive.
300
301Extlinks
302========
303
304The sphinx.ext.extlinks extension is enabled by default
305(https://sublime-and-sphinx-guide.readthedocs.io/en/latest/references.html#use-the-external-links-extension),
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500306and it is configured with the 'extlinks' definitions in
307the 'documentation/conf.py' file:
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500308
309 'yocto_home': ('https://yoctoproject.org%s', None),
310 'yocto_wiki': ('https://wiki.yoctoproject.org%s', None),
311 'yocto_dl': ('https://downloads.yoctoproject.org%s', None),
312 'yocto_lists': ('https://lists.yoctoproject.org%s', None),
313 'yocto_bugs': ('https://bugzilla.yoctoproject.org%s', None),
314 'yocto_ab': ('https://autobuilder.yoctoproject.org%s', None),
315 'yocto_docs': ('https://docs.yoctoproject.org%s', None),
316 'yocto_git': ('https://git.yoctoproject.org%s', None),
317 'oe_home': ('https://www.openembedded.org%s', None),
318 'oe_lists': ('https://lists.openembedded.org%s', None),
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500319 'oe_git': ('https://git.openembedded.org%s', None),
320 'oe_wiki': ('https://www.openembedded.org/wiki%s', None),
321 'oe_layerindex': ('https://layers.openembedded.org%s', None),
322 'oe_layer': ('https://layers.openembedded.org/layerindex/branch/master/layer%s', None),
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500323
324It creates convenient shortcuts which can be used throughout the
325documentation rst files, as:
326
327 Please check this :yocto_wiki:`wiki page </Weekly_Status>`
328
329Intersphinx links
330=================
331
332The sphinx.ext.intersphinx extension is enabled by default
333(https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html),
334so that we can cross reference content from other Sphinx based
335documentation projects, such as the BitBake manual.
336
Patrick Williams213cb262021-08-07 19:21:33 -0500337References to the BitBake manual can be done:
338 - With a specific description instead of the section name:
339 :ref:`Azure Storage fetcher (az://) <bitbake:bitbake-user-manual/bitbake-user-manual-fetching:fetchers>`
340 - With the section name:
Andrew Geissler595f6302022-01-24 19:11:47 +0000341 :ref:`bitbake:bitbake-user-manual/bitbake-user-manual-intro:usage and syntax` option
Patrick Williams213cb262021-08-07 19:21:33 -0500342 - Linking to the entire BitBake manual:
343 :doc:`BitBake User Manual <bitbake:index>`
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500344
Patrick Williams213cb262021-08-07 19:21:33 -0500345Note that a reference to a variable (:term:`VARIABLE`) automatically points to
346the BitBake manual if the variable is not described in the Reference Manual's Variable Glossary.
347However, if you need to bypass this, you can explicitely refer to a description in the
348BitBake manual as follows:
349
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500350 :term:`bitbake:BB_NUMBER_PARSE_THREADS`
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600351
352Submitting documentation changes
353================================
354
355Please see the top level README file in this repository for details of where
356to send patches.