xref: /rk3399_ARM-atf/docs/getting_started/docs-build.rst (revision 7be2b9838c3d0ff617eecb1c54749229ecd7ac2f)
1862c764aSPaul BeesleyBuilding Documentation
2862c764aSPaul Beesley======================
3862c764aSPaul Beesley
4862c764aSPaul BeesleyTo create a rendered copy of this documentation locally you can use the
5862c764aSPaul Beesley`Sphinx`_ tool to build and package the plain-text documents into HTML-formatted
6862c764aSPaul Beesleypages.
7862c764aSPaul Beesley
8862c764aSPaul BeesleyIf you are building the documentation for the first time then you will need to
9862c764aSPaul Beesleycheck that you have the required software packages, as described in the
10862c764aSPaul Beesley*Prerequisites* section that follows.
11862c764aSPaul Beesley
12862c764aSPaul Beesley.. note::
13862c764aSPaul Beesley   An online copy of the documentation is available at
14862c764aSPaul Beesley   https://www.trustedfirmware.org/docs/tf-a, if you want to view a rendered
15862c764aSPaul Beesley   copy without doing a local build.
16862c764aSPaul Beesley
17862c764aSPaul BeesleyPrerequisites
18862c764aSPaul Beesley-------------
19862c764aSPaul Beesley
20862c764aSPaul BeesleyFor building a local copy of the |TF-A| documentation you will need, at minimum:
21862c764aSPaul Beesley
22862c764aSPaul Beesley- Python 3 (3.5 or later)
23862c764aSPaul Beesley- PlantUML (1.2017.15 or later)
24862c764aSPaul Beesley
2543f35ef5SPaul BeesleyOptionally, the `Dia`_ application can be installed if you need to edit
2643f35ef5SPaul Beesleyexisting ``.dia`` diagram files, or create new ones.
2743f35ef5SPaul Beesley
28862c764aSPaul BeesleyYou must also install the Python modules that are specified in the
29862c764aSPaul Beesley``requirements.txt`` file in the root of the ``docs`` directory. These modules
30862c764aSPaul Beesleycan be installed using ``pip3`` (the Python Package Installer). Passing this
31862c764aSPaul Beesleyrequirements file as an argument to ``pip3`` automatically installs the specific
32862c764aSPaul Beesleymodule versions required by |TF-A|.
33862c764aSPaul Beesley
34862c764aSPaul BeesleyAn example set of installation commands for Ubuntu 18.04 LTS follows, assuming
35862c764aSPaul Beesleythat the working directory is ``docs``:
36862c764aSPaul Beesley
37862c764aSPaul Beesley.. code:: shell
38862c764aSPaul Beesley
3943f35ef5SPaul Beesley    sudo apt install python3 python3-pip plantuml [dia]
40862c764aSPaul Beesley    pip3 install [--user] -r requirements.txt
41862c764aSPaul Beesley
42862c764aSPaul Beesley.. note::
43862c764aSPaul Beesley   Several other modules will be installed as dependencies. Please review
44862c764aSPaul Beesley   the list to ensure that there will be no conflicts with other modules already
45862c764aSPaul Beesley   installed in your environment.
46862c764aSPaul Beesley
47862c764aSPaul BeesleyPassing the optional ``--user`` argument to ``pip3`` will install the Python
48862c764aSPaul Beesleypackages only for the current user. Omitting this argument will attempt to
49862c764aSPaul Beesleyinstall the packages globally and this will likely require the command to be run
50862c764aSPaul Beesleyas root or using ``sudo``.
51862c764aSPaul Beesley
52862c764aSPaul Beesley.. note::
53862c764aSPaul Beesley   More advanced usage instructions for *pip* are beyond the scope of this
54862c764aSPaul Beesley   document but you can refer to the `pip homepage`_ for detailed guides.
55862c764aSPaul Beesley
56862c764aSPaul BeesleyBuilding rendered documentation
57862c764aSPaul Beesley-------------------------------
58862c764aSPaul Beesley
596de32378SMadhukar PappireddyDocuments can be built into HTML-formatted pages from project root directory by
606de32378SMadhukar Pappireddyrunning the following command.
61862c764aSPaul Beesley
62862c764aSPaul Beesley.. code:: shell
63862c764aSPaul Beesley
646de32378SMadhukar Pappireddy   make doc
65862c764aSPaul Beesley
66862c764aSPaul BeesleyOutput from the build process will be placed in:
67862c764aSPaul Beesley
68862c764aSPaul Beesley::
69862c764aSPaul Beesley
70*7be2b983SLeonardo Sandoval   docs/build/html
716de32378SMadhukar Pappireddy
726de32378SMadhukar PappireddyWe also support building documentation in other formats. From the ``docs``
736de32378SMadhukar Pappireddydirectory of the project, run the following command to see the supported
746de32378SMadhukar Pappireddyformats. It is important to note that you will not get the correct result if
756de32378SMadhukar Pappireddythe command is run from the project root directory, as that would invoke the
766de32378SMadhukar Pappireddytop-level Makefile for |TF-A| itself.
776de32378SMadhukar Pappireddy
786de32378SMadhukar Pappireddy.. code:: shell
796de32378SMadhukar Pappireddy
806de32378SMadhukar Pappireddy   make help
81862c764aSPaul Beesley
82*7be2b983SLeonardo SandovalBuilding rendered documentation from a container
83*7be2b983SLeonardo Sandoval------------------------------------------------
84*7be2b983SLeonardo Sandoval
85*7be2b983SLeonardo SandovalThere may be cases where you can not either install or upgrade required
86*7be2b983SLeonardo Sandovaldependencies to generate the documents, so in this case, one way to
87*7be2b983SLeonardo Sandovalcreate the documentation is through a docker container. The first step is
88*7be2b983SLeonardo Sandovalto check if `docker`_ is installed in your host, otherwise check main docker
89*7be2b983SLeonardo Sandovalpage for installation instructions. Once installed, run the following script
90*7be2b983SLeonardo Sandovalfrom project root directory
91*7be2b983SLeonardo Sandoval
92*7be2b983SLeonardo Sandoval.. code:: shell
93*7be2b983SLeonardo Sandoval
94*7be2b983SLeonardo Sandoval   docker run --rm -v $PWD:/TF sphinxdoc/sphinx \
95*7be2b983SLeonardo Sandoval          bash -c 'cd /TF && \
96*7be2b983SLeonardo Sandoval          pip3 install plantuml -r ./docs/requirements.txt && make doc'
97*7be2b983SLeonardo Sandoval
98*7be2b983SLeonardo SandovalThe above command fetches the ``sphinxdoc/sphinx`` container from `docker
99*7be2b983SLeonardo Sandovalhub`_, launches the container, installs documentation requirements and finally
100*7be2b983SLeonardo Sandovalcreates the documentation. Once done, exit the container and output from the
101*7be2b983SLeonardo Sandovalbuild process will be placed in:
102*7be2b983SLeonardo Sandoval
103*7be2b983SLeonardo Sandoval::
104*7be2b983SLeonardo Sandoval
105*7be2b983SLeonardo Sandoval   docs/build/html
106*7be2b983SLeonardo Sandoval
107862c764aSPaul Beesley--------------
108862c764aSPaul Beesley
109862c764aSPaul Beesley*Copyright (c) 2019, Arm Limited. All rights reserved.*
110862c764aSPaul Beesley
111862c764aSPaul Beesley.. _Sphinx: http://www.sphinx-doc.org/en/master/
112862c764aSPaul Beesley.. _pip homepage: https://pip.pypa.io/en/stable/
11343f35ef5SPaul Beesley.. _Dia: https://wiki.gnome.org/Apps/Dia
114*7be2b983SLeonardo Sandoval.. _docker: https://www.docker.com/
115*7be2b983SLeonardo Sandoval.. _docker hub: https://hub.docker.com/repository/docker/sphinxdoc/sphinx
116