xref: /rk3399_ARM-atf/docs/getting_started/docs-build.rst (revision 8526472a46886f0a50c099ef17a1bf8add69ac06)
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
20*8526472aSBoyan KaratotevFor building a local copy of the |TF-A| documentation you will need:
21862c764aSPaul Beesley
22862c764aSPaul Beesley- Python 3 (3.5 or later)
23862c764aSPaul Beesley- PlantUML (1.2017.15 or later)
24*8526472aSBoyan Karatotev- Python modules specified in ``docs/requirements.txt``
25862c764aSPaul Beesley
26*8526472aSBoyan Karatotev   You can install these with ``pip3`` (the Python Package Installer) by
27*8526472aSBoyan Karatotev   passing it the requirements file above (with ``-r``). An optional ``--user``
28*8526472aSBoyan Karatotev   argument will install them locally, but you have to add their location to
29*8526472aSBoyan Karatotev   $PATH (pip will emit a warning). Alternatively, they can be installed
30*8526472aSBoyan Karatotev   globally (but will probably require root privileges).
31*8526472aSBoyan Karatotev
32*8526472aSBoyan Karatotev   .. note::
33*8526472aSBoyan Karatotev      Although not necessary, it is recommended you use a virtual environment.
34*8526472aSBoyan Karatotev      More advanced usage instructions for *pip* are beyond the scope of this
35*8526472aSBoyan Karatotev      document but you can refer to the `pip homepage`_ for detailed guides.
36*8526472aSBoyan Karatotev
37*8526472aSBoyan Karatotev- Optionally, the `Dia`_ application can be installed if you need to edit
3843f35ef5SPaul Beesley  existing ``.dia`` diagram files, or create new ones.
3943f35ef5SPaul Beesley
40862c764aSPaul BeesleyAn example set of installation commands for Ubuntu 18.04 LTS follows, assuming
41862c764aSPaul Beesleythat the working directory is ``docs``:
42862c764aSPaul Beesley
43862c764aSPaul Beesley.. code:: shell
44862c764aSPaul Beesley
4543f35ef5SPaul Beesley    sudo apt install python3 python3-pip plantuml [dia]
46862c764aSPaul Beesley    pip3 install [--user] -r requirements.txt
47862c764aSPaul Beesley
48862c764aSPaul Beesley.. note::
49862c764aSPaul Beesley   Several other modules will be installed as dependencies. Please review
50862c764aSPaul Beesley   the list to ensure that there will be no conflicts with other modules already
51862c764aSPaul Beesley   installed in your environment.
52862c764aSPaul Beesley
53862c764aSPaul BeesleyBuilding rendered documentation
54862c764aSPaul Beesley-------------------------------
55862c764aSPaul Beesley
566de32378SMadhukar PappireddyDocuments can be built into HTML-formatted pages from project root directory by
576de32378SMadhukar Pappireddyrunning the following command.
58862c764aSPaul Beesley
59862c764aSPaul Beesley.. code:: shell
60862c764aSPaul Beesley
616de32378SMadhukar Pappireddy   make doc
62862c764aSPaul Beesley
63862c764aSPaul BeesleyOutput from the build process will be placed in:
64862c764aSPaul Beesley
65862c764aSPaul Beesley::
66862c764aSPaul Beesley
677be2b983SLeonardo Sandoval   docs/build/html
686de32378SMadhukar Pappireddy
696de32378SMadhukar PappireddyWe also support building documentation in other formats. From the ``docs``
706de32378SMadhukar Pappireddydirectory of the project, run the following command to see the supported
716de32378SMadhukar Pappireddyformats. It is important to note that you will not get the correct result if
726de32378SMadhukar Pappireddythe command is run from the project root directory, as that would invoke the
736de32378SMadhukar Pappireddytop-level Makefile for |TF-A| itself.
746de32378SMadhukar Pappireddy
756de32378SMadhukar Pappireddy.. code:: shell
766de32378SMadhukar Pappireddy
776de32378SMadhukar Pappireddy   make help
78862c764aSPaul Beesley
797be2b983SLeonardo SandovalBuilding rendered documentation from a container
807be2b983SLeonardo Sandoval------------------------------------------------
817be2b983SLeonardo Sandoval
827be2b983SLeonardo SandovalThere may be cases where you can not either install or upgrade required
837be2b983SLeonardo Sandovaldependencies to generate the documents, so in this case, one way to
847be2b983SLeonardo Sandovalcreate the documentation is through a docker container. The first step is
857be2b983SLeonardo Sandovalto check if `docker`_ is installed in your host, otherwise check main docker
867be2b983SLeonardo Sandovalpage for installation instructions. Once installed, run the following script
877be2b983SLeonardo Sandovalfrom project root directory
887be2b983SLeonardo Sandoval
897be2b983SLeonardo Sandoval.. code:: shell
907be2b983SLeonardo Sandoval
917be2b983SLeonardo Sandoval   docker run --rm -v $PWD:/TF sphinxdoc/sphinx \
927be2b983SLeonardo Sandoval          bash -c 'cd /TF && \
937be2b983SLeonardo Sandoval          pip3 install plantuml -r ./docs/requirements.txt && make doc'
947be2b983SLeonardo Sandoval
957be2b983SLeonardo SandovalThe above command fetches the ``sphinxdoc/sphinx`` container from `docker
967be2b983SLeonardo Sandovalhub`_, launches the container, installs documentation requirements and finally
977be2b983SLeonardo Sandovalcreates the documentation. Once done, exit the container and output from the
987be2b983SLeonardo Sandovalbuild process will be placed in:
997be2b983SLeonardo Sandoval
1007be2b983SLeonardo Sandoval::
1017be2b983SLeonardo Sandoval
1027be2b983SLeonardo Sandoval   docs/build/html
1037be2b983SLeonardo Sandoval
104862c764aSPaul Beesley--------------
105862c764aSPaul Beesley
106862c764aSPaul Beesley*Copyright (c) 2019, Arm Limited. All rights reserved.*
107862c764aSPaul Beesley
108862c764aSPaul Beesley.. _Sphinx: http://www.sphinx-doc.org/en/master/
109862c764aSPaul Beesley.. _pip homepage: https://pip.pypa.io/en/stable/
11043f35ef5SPaul Beesley.. _Dia: https://wiki.gnome.org/Apps/Dia
1117be2b983SLeonardo Sandoval.. _docker: https://www.docker.com/
1127be2b983SLeonardo Sandoval.. _docker hub: https://hub.docker.com/repository/docker/sphinxdoc/sphinx
113