blob: 1e7b4f0e65dd9f7533a289951ade17d8680572f3 [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
59template
60========
61Contains various templates, fonts, and some old PNG files.
62
Andrew Geisslerc3d88e42020-10-02 09:45:00 -050063Sphinx
64======
65
66The Yocto Project documentation was migrated from the original DocBook
67format to Sphinx based documentation for the Yocto Project 3.2
68release. This section will provide additional information related to
69the Sphinx migration, and guidelines for developers willing to
70contribute to the Yocto Project documentation.
71
72 Sphinx is a tool that makes it easy to create intelligent and
73 beautiful documentation, written by Georg Brandl and licensed under
74 the BSD license. It was originally created for the Python
75 documentation.
76
77Extensive documentation is available on the Sphinx website:
78https://www.sphinx-doc.org/en/master/. Sphinx is designed to be
79extensible thanks to the ability to write our own custom extensions,
80as Python modules, which will be executed during the generation of the
81documentation.
82
83Yocto Project documentation website
84===================================
85
Andrew Geissler09036742021-06-25 14:25:14 -050086The website hosting the Yocto Project documentation, can be found
87at: https://docs.yoctoproject.org/.
Andrew Geisslerc3d88e42020-10-02 09:45:00 -050088
Andrew Geissler95ac1b82021-03-31 14:34:31 -050089The entire Yocto Project documentation, as well as the BitBake manual,
Andrew Geisslerc3d88e42020-10-02 09:45:00 -050090is published on this website, including all previously released
91versions. A version switcher was added, as a drop-down menu on the top
92of the page to switch back and forth between the various versions of
93the current active Yocto Project releases.
94
Andrew Geissler95ac1b82021-03-31 14:34:31 -050095Transition pages have been added (as rst files) to show links to old
Andrew Geisslerc3d88e42020-10-02 09:45:00 -050096versions of the Yocto Project documentation with links to each manual
97generated with DocBook.
98
99How to build the Yocto Project documentation
100============================================
101
102Sphinx is written in Python. While it might work with Python2, for
103obvious reasons, we will only support building the Yocto Project
104documentation with Python3.
105
106Sphinx might be available in your Linux distro packages repositories,
Andrew Geissler3b8a17c2021-04-15 15:55:55 -0500107however it is not recommended to use distro packages, as they might be
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500108old versions, especially if you are using an LTS version of your
109distro. The recommended method to install Sphinx and all required
110dependencies is to use the Python Package Index (pip).
111
112To install all required packages run:
113
114 $ pip3 install sphinx sphinx_rtd_theme pyyaml
115
116To build the documentation locally, run:
117
118 $ cd documentation
Andrew Geisslerf0343792020-11-18 10:42:21 -0600119 $ make html
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500120
121The resulting HTML index page will be _build/html/index.html, and you
122can browse your own copy of the locally generated documentation with
123your browser.
124
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600125Alternatively, you can use Pipenv to automatically install all required
126dependencies in a virtual environment:
127
128 $ cd documentation
129 $ pipenv install
130 $ pipenv run make html
131
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500132Sphinx theme and CSS customization
133==================================
134
135The Yocto Project documentation is currently based on the "Read the
136Docs" Sphinx theme, with a few changes to make sure the look and feel
137of the project documentation is preserved.
138
139Most of the theme changes can be done using the file
140'sphinx-static/theme_overrides.css'. Most CSS changes in this file
141were inherited from the DocBook CSS stylesheets.
142
143Sphinx design guidelines and principles
144=======================================
145
146The initial Docbook to Sphinx migration was done with an automated
147tool called Pandoc (https://pandoc.org/). The tool produced some clean
148output markdown text files. After the initial automated conversion
149additional changes were done to fix up headings, images and links. In
150addition Sphinx has built in mechanisms (directives) which were used
151to replace similar functions implemented in Docbook such as glossary,
152variables substitutions, notes and references.
153
154Headings
155========
156
157The layout of the Yocto Project manuals is organized as follows
158
159 Book
160 Chapter
161 Section
162 Section
163 Section
164
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700165Here are the heading styles defined in Sphinx:
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500166
167 Book => overline ===
168 Chapter => overline ***
169 Section => ====
170 Section => ----
171 Section => ^^^^
172 Section => """" or ~~~~
173
174With this proposal, we preserve the same TOCs between Sphinx and Docbook.
175
176Built-in glossary
177=================
178
179Sphinx has a glossary directive. From
180https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#glossary:
181
182 This directive must contain a reST definition list with terms and
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500183 definitions. It's then possible to refer to each definition through the
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500184 [https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-term
185 'term' role].
186
187So anywhere in any of the Yocto Project manuals, :term:`VAR` can be
188used to refer to an item from the glossary, and a link is created
189automatically. A general index of terms is also generated by Sphinx
190automatically.
191
192Global substitutions
193====================
194
195The Yocto Project documentation makes heavy use of global
196variables. In Docbook these variables are stored in the file
197poky.ent. This Docbook feature is not handled automatically with
198Pandoc. Sphinx has builtin support for substitutions
199(https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#substitutions),
200however there are important shortcomings. For example they cannot be
201used/nested inside code-block sections.
202
203A Sphinx extension was implemented to support variable substitutions
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500204to mimic the DocBook based documentation behavior. Variable
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500205substitutions are done while reading/parsing the .rst files. The
206pattern for variables substitutions is the same as with DocBook,
207e.g. `&VAR;`.
208
209The implementation of the extension can be found here in the file
210documentation/sphinx/yocto-vars.py, this extension is enabled by
211default when building the Yocto Project documentation. All variables
212are set in a file call poky.yaml, which was initially generated from
213poky.ent. The file was converted into YAML so that it is easier to
214process by the custom Sphinx extension (which is a Python module).
215
216For example, the following .rst content will produce the 'expected'
217content:
218
219 .. code-block::
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500220 $ mkdir poky-&DISTRO;
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500221 or
222 $ git clone &YOCTO_GIT_URL;/git/poky -b &DISTRO_NAME_NO_CAP;
223
224Variables can be nested, like it was the case for DocBook:
225
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600226 YOCTO_HOME_URL : "https://www.yoctoproject.org"
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500227 YOCTO_DOCS_URL : "&YOCTO_HOME_URL;/docs"
228
229Note directive
230==============
231
232Sphinx has a builtin 'note' directive that produces clean Note section
233in the output file. There are various types of directives such as
234"attention", "caution", "danger", "error", "hint", "important", "tip",
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500235"warning", "admonition" that are supported, and additional directives
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500236can be added as Sphinx extension if needed.
237
238Figures
239=======
240
241The Yocto Project documentation has many figures/images. Sphinx has a
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500242'figure' directive which is straightforward to use. To include a
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500243figure in the body of the documentation:
244
245 .. image:: figures/YP-flow-diagram.png
246
247Links and References
248====================
249
250The following types of links can be used: links to other locations in
251the same document, to locations in other documents and to external
252websites.
253
254More information can be found here:
255https://sublime-and-sphinx-guide.readthedocs.io/en/latest/references.html.
256
Andrew Geissler3b8a17c2021-04-15 15:55:55 -0500257Anchor (<#link>) links are forbidden as they are not checked by Sphinx during
258the build and may be broken without knowing about it.
259
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500260References
261==========
262
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500263The following extension is enabled by default:
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500264sphinx.ext.autosectionlabel
265(https://www.sphinx-doc.org/en/master/usage/extensions/autosectionlabel.html).
266
267This extension allows you to refer sections by their titles. Note that
268autosectionlabel_prefix_document is enabled by default, so that we can
269insert references from any document.
270
271For example, to insert an HTML link to a section from
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500272documentation/manual/intro.rst, use:
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500273
274 Please check this :ref:`manual/intro:Cross-References to Locations in the Same Document`
275
276Alternatively a custom text can be used instead of using the section
277text:
278
279 Please check this :ref:`section <manual/intro:Cross-References to Locations in the Same Document>`
280
281TIP: The following command can be used to dump all the references that
282 are defined in the project documentation:
283
284 python -msphinx.ext.intersphinx <path to build folder>/html/objects.inv
285
286This dump contains all links and for each link it shows the default
287"Link Text" that Sphinx would use. If the default link text is not
288appropriate, a custom link text can be used in the ':ref:' directive.
289
290Extlinks
291========
292
293The sphinx.ext.extlinks extension is enabled by default
294(https://sublime-and-sphinx-guide.readthedocs.io/en/latest/references.html#use-the-external-links-extension),
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500295and it is configured with the 'extlinks' definitions in
296the 'documentation/conf.py' file:
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500297
298 'yocto_home': ('https://yoctoproject.org%s', None),
299 'yocto_wiki': ('https://wiki.yoctoproject.org%s', None),
300 'yocto_dl': ('https://downloads.yoctoproject.org%s', None),
301 'yocto_lists': ('https://lists.yoctoproject.org%s', None),
302 'yocto_bugs': ('https://bugzilla.yoctoproject.org%s', None),
303 'yocto_ab': ('https://autobuilder.yoctoproject.org%s', None),
304 'yocto_docs': ('https://docs.yoctoproject.org%s', None),
305 'yocto_git': ('https://git.yoctoproject.org%s', None),
306 'oe_home': ('https://www.openembedded.org%s', None),
307 'oe_lists': ('https://lists.openembedded.org%s', None),
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500308 'oe_git': ('https://git.openembedded.org%s', None),
309 'oe_wiki': ('https://www.openembedded.org/wiki%s', None),
310 'oe_layerindex': ('https://layers.openembedded.org%s', None),
311 'oe_layer': ('https://layers.openembedded.org/layerindex/branch/master/layer%s', None),
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500312
313It creates convenient shortcuts which can be used throughout the
314documentation rst files, as:
315
316 Please check this :yocto_wiki:`wiki page </Weekly_Status>`
317
318Intersphinx links
319=================
320
321The sphinx.ext.intersphinx extension is enabled by default
322(https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html),
323so that we can cross reference content from other Sphinx based
324documentation projects, such as the BitBake manual.
325
Patrick Williams213cb262021-08-07 19:21:33 -0500326References to the BitBake manual can be done:
327 - With a specific description instead of the section name:
328 :ref:`Azure Storage fetcher (az://) <bitbake:bitbake-user-manual/bitbake-user-manual-fetching:fetchers>`
329 - With the section name:
330 ":ref:`bitbake:bitbake-user-manual/bitbake-user-manual-intro:usage and syntax` option
331 - Linking to the entire BitBake manual:
332 :doc:`BitBake User Manual <bitbake:index>`
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500333
Patrick Williams213cb262021-08-07 19:21:33 -0500334Note that a reference to a variable (:term:`VARIABLE`) automatically points to
335the BitBake manual if the variable is not described in the Reference Manual's Variable Glossary.
336However, if you need to bypass this, you can explicitely refer to a description in the
337BitBake manual as follows:
338
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500339 :term:`bitbake:BB_NUMBER_PARSE_THREADS`
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600340
341Submitting documentation changes
342================================
343
344Please see the top level README file in this repository for details of where
345to send patches.