blob: 99cba1ec0a62892a5e223aaa88334a22de48c86f [file] [log] [blame]
Paul Beesley5d3799b2019-10-07 10:04:48 +00001Building Documentation
2======================
3
4To create a rendered copy of this documentation locally you can use the
5`Sphinx`_ tool to build and package the plain-text documents into HTML-formatted
6pages.
7
8If you are building the documentation for the first time then you will need to
9check that you have the required software packages, as described in the
10*Prerequisites* section that follows.
11
12.. note::
13 An online copy of the documentation is available at
14 https://www.trustedfirmware.org/docs/tf-a, if you want to view a rendered
15 copy without doing a local build.
16
17Prerequisites
18-------------
19
Boyan Karatotevdb858782022-10-27 13:55:12 +010020For building a local copy of the |TF-A| documentation you will need:
Paul Beesley5d3799b2019-10-07 10:04:48 +000021
Harrison Mutaib378ad42023-02-16 10:20:48 +000022- Python 3 (3.8 or later)
Paul Beesley5d3799b2019-10-07 10:04:48 +000023- PlantUML (1.2017.15 or later)
Harrison Mutaib378ad42023-02-16 10:20:48 +000024- Poetry Python dependency and package manager
25- Python modules specified in ``pyproject.toml``
Boyan Karatotevdb858782022-10-27 13:55:12 +010026- Optionally, the `Dia`_ application can be installed if you need to edit
27 existing ``.dia`` diagram files, or create new ones.
Paul Beesley5d3799b2019-10-07 10:04:48 +000028
Harrison Mutaib378ad42023-02-16 10:20:48 +000029
30Poetry will handle the creation of a virtual build environment, either creating
31a new environment or re-using one created by the user, and installing all
32dependencies herein. This ensures that the Python environment is isolated from
33your system environment.
34
35An example set of installation commands for Ubuntu follows:
Paul Beesley5d3799b2019-10-07 10:04:48 +000036
37.. code:: shell
38
Paul Beesleyd2fcc4e2019-05-29 13:59:40 +010039 sudo apt install python3 python3-pip plantuml [dia]
Harrison Mutaib378ad42023-02-16 10:20:48 +000040 curl -sSL https://install.python-poetry.org | python3 -
41 poetry install
Paul Beesley5d3799b2019-10-07 10:04:48 +000042
Paul Beesley5d3799b2019-10-07 10:04:48 +000043Building rendered documentation
44-------------------------------
45
Madhukar Pappireddy46adb1b2020-01-28 12:41:20 -060046Documents can be built into HTML-formatted pages from project root directory by
47running the following command.
Paul Beesley5d3799b2019-10-07 10:04:48 +000048
49.. code:: shell
50
Harrison Mutaib378ad42023-02-16 10:20:48 +000051 poetry run make doc
Paul Beesley5d3799b2019-10-07 10:04:48 +000052
53Output from the build process will be placed in:
54
55::
56
Leonardo Sandoval8f9f6882020-06-10 18:26:28 -050057 docs/build/html
Madhukar Pappireddy46adb1b2020-01-28 12:41:20 -060058
59We also support building documentation in other formats. From the ``docs``
60directory of the project, run the following command to see the supported
61formats. It is important to note that you will not get the correct result if
62the command is run from the project root directory, as that would invoke the
63top-level Makefile for |TF-A| itself.
64
65.. code:: shell
66
Harrison Mutaib378ad42023-02-16 10:20:48 +000067 poetry run make help
68
69.. note::
70
71 The ``run`` command used above executes ``make`` in the projects virtual
72 environment. To spawn a shell in this environment, use ``poetry
73 shell``. For other use cases, please see the official `Poetry`_
74 documentation.
Paul Beesley5d3799b2019-10-07 10:04:48 +000075
Leonardo Sandoval8f9f6882020-06-10 18:26:28 -050076Building rendered documentation from a container
77------------------------------------------------
78
79There may be cases where you can not either install or upgrade required
80dependencies to generate the documents, so in this case, one way to
81create the documentation is through a docker container. The first step is
82to check if `docker`_ is installed in your host, otherwise check main docker
83page for installation instructions. Once installed, run the following script
84from project root directory
85
86.. code:: shell
87
88 docker run --rm -v $PWD:/TF sphinxdoc/sphinx \
89 bash -c 'cd /TF && \
Harrison Mutaib378ad42023-02-16 10:20:48 +000090 poetry install && poetry run make doc'
Leonardo Sandoval8f9f6882020-06-10 18:26:28 -050091
92The above command fetches the ``sphinxdoc/sphinx`` container from `docker
93hub`_, launches the container, installs documentation requirements and finally
94creates the documentation. Once done, exit the container and output from the
95build process will be placed in:
96
97::
98
99 docs/build/html
100
Paul Beesley5d3799b2019-10-07 10:04:48 +0000101--------------
102
Harrison Mutaib378ad42023-02-16 10:20:48 +0000103*Copyright (c) 2019-2023, Arm Limited. All rights reserved.*
Paul Beesley5d3799b2019-10-07 10:04:48 +0000104
105.. _Sphinx: http://www.sphinx-doc.org/en/master/
Harrison Mutaib378ad42023-02-16 10:20:48 +0000106.. _Poetry: https://python-poetry.org/docs/cli/
Paul Beesley5d3799b2019-10-07 10:04:48 +0000107.. _pip homepage: https://pip.pypa.io/en/stable/
Paul Beesleyd2fcc4e2019-05-29 13:59:40 +0100108.. _Dia: https://wiki.gnome.org/Apps/Dia
Leonardo Sandoval8f9f6882020-06-10 18:26:28 -0500109.. _docker: https://www.docker.com/
110.. _docker hub: https://hub.docker.com/repository/docker/sphinxdoc/sphinx