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