Paul Beesley | 5d3799b | 2019-10-07 10:04:48 +0000 | [diff] [blame] | 1 | Building Documentation |
| 2 | ====================== |
| 3 | |
| 4 | To 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 |
| 6 | pages. |
| 7 | |
| 8 | If you are building the documentation for the first time then you will need to |
| 9 | check 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 | |
| 17 | Prerequisites |
| 18 | ------------- |
| 19 | |
Boyan Karatotev | db85878 | 2022-10-27 13:55:12 +0100 | [diff] [blame] | 20 | For building a local copy of the |TF-A| documentation you will need: |
Paul Beesley | 5d3799b | 2019-10-07 10:04:48 +0000 | [diff] [blame] | 21 | |
| 22 | - Python 3 (3.5 or later) |
| 23 | - PlantUML (1.2017.15 or later) |
Boyan Karatotev | db85878 | 2022-10-27 13:55:12 +0100 | [diff] [blame] | 24 | - Python modules specified in ``docs/requirements.txt`` |
Paul Beesley | 5d3799b | 2019-10-07 10:04:48 +0000 | [diff] [blame] | 25 | |
Boyan Karatotev | db85878 | 2022-10-27 13:55:12 +0100 | [diff] [blame] | 26 | You can install these with ``pip3`` (the Python Package Installer) by |
| 27 | passing it the requirements file above (with ``-r``). An optional ``--user`` |
| 28 | argument will install them locally, but you have to add their location to |
| 29 | $PATH (pip will emit a warning). Alternatively, they can be installed |
| 30 | globally (but will probably require root privileges). |
Paul Beesley | d2fcc4e | 2019-05-29 13:59:40 +0100 | [diff] [blame] | 31 | |
Boyan Karatotev | db85878 | 2022-10-27 13:55:12 +0100 | [diff] [blame] | 32 | .. note:: |
| 33 | Although not necessary, it is recommended you use a virtual environment. |
| 34 | More advanced usage instructions for *pip* are beyond the scope of this |
| 35 | document but you can refer to the `pip homepage`_ for detailed guides. |
| 36 | |
| 37 | - Optionally, the `Dia`_ application can be installed if you need to edit |
| 38 | existing ``.dia`` diagram files, or create new ones. |
Paul Beesley | 5d3799b | 2019-10-07 10:04:48 +0000 | [diff] [blame] | 39 | |
Boyan Karatotev | 60c168c | 2022-11-15 17:39:22 +0000 | [diff] [blame] | 40 | An example set of installation commands for Ubuntu follows, assuming that the |
| 41 | working directory is ``docs``: |
Paul Beesley | 5d3799b | 2019-10-07 10:04:48 +0000 | [diff] [blame] | 42 | |
| 43 | .. code:: shell |
| 44 | |
Paul Beesley | d2fcc4e | 2019-05-29 13:59:40 +0100 | [diff] [blame] | 45 | sudo apt install python3 python3-pip plantuml [dia] |
Paul Beesley | 5d3799b | 2019-10-07 10:04:48 +0000 | [diff] [blame] | 46 | pip3 install [--user] -r requirements.txt |
| 47 | |
| 48 | .. note:: |
| 49 | Several other modules will be installed as dependencies. Please review |
| 50 | the list to ensure that there will be no conflicts with other modules already |
| 51 | installed in your environment. |
| 52 | |
Paul Beesley | 5d3799b | 2019-10-07 10:04:48 +0000 | [diff] [blame] | 53 | Building rendered documentation |
| 54 | ------------------------------- |
| 55 | |
Madhukar Pappireddy | 46adb1b | 2020-01-28 12:41:20 -0600 | [diff] [blame] | 56 | Documents can be built into HTML-formatted pages from project root directory by |
| 57 | running the following command. |
Paul Beesley | 5d3799b | 2019-10-07 10:04:48 +0000 | [diff] [blame] | 58 | |
| 59 | .. code:: shell |
| 60 | |
Madhukar Pappireddy | 46adb1b | 2020-01-28 12:41:20 -0600 | [diff] [blame] | 61 | make doc |
Paul Beesley | 5d3799b | 2019-10-07 10:04:48 +0000 | [diff] [blame] | 62 | |
| 63 | Output from the build process will be placed in: |
| 64 | |
| 65 | :: |
| 66 | |
Leonardo Sandoval | 8f9f688 | 2020-06-10 18:26:28 -0500 | [diff] [blame] | 67 | docs/build/html |
Madhukar Pappireddy | 46adb1b | 2020-01-28 12:41:20 -0600 | [diff] [blame] | 68 | |
| 69 | We also support building documentation in other formats. From the ``docs`` |
| 70 | directory of the project, run the following command to see the supported |
| 71 | formats. It is important to note that you will not get the correct result if |
| 72 | the command is run from the project root directory, as that would invoke the |
| 73 | top-level Makefile for |TF-A| itself. |
| 74 | |
| 75 | .. code:: shell |
| 76 | |
| 77 | make help |
Paul Beesley | 5d3799b | 2019-10-07 10:04:48 +0000 | [diff] [blame] | 78 | |
Leonardo Sandoval | 8f9f688 | 2020-06-10 18:26:28 -0500 | [diff] [blame] | 79 | Building rendered documentation from a container |
| 80 | ------------------------------------------------ |
| 81 | |
| 82 | There may be cases where you can not either install or upgrade required |
| 83 | dependencies to generate the documents, so in this case, one way to |
| 84 | create the documentation is through a docker container. The first step is |
| 85 | to check if `docker`_ is installed in your host, otherwise check main docker |
| 86 | page for installation instructions. Once installed, run the following script |
| 87 | from project root directory |
| 88 | |
| 89 | .. code:: shell |
| 90 | |
| 91 | docker run --rm -v $PWD:/TF sphinxdoc/sphinx \ |
| 92 | bash -c 'cd /TF && \ |
| 93 | pip3 install plantuml -r ./docs/requirements.txt && make doc' |
| 94 | |
| 95 | The above command fetches the ``sphinxdoc/sphinx`` container from `docker |
| 96 | hub`_, launches the container, installs documentation requirements and finally |
| 97 | creates the documentation. Once done, exit the container and output from the |
| 98 | build process will be placed in: |
| 99 | |
| 100 | :: |
| 101 | |
| 102 | docs/build/html |
| 103 | |
Paul Beesley | 5d3799b | 2019-10-07 10:04:48 +0000 | [diff] [blame] | 104 | -------------- |
| 105 | |
| 106 | *Copyright (c) 2019, Arm Limited. All rights reserved.* |
| 107 | |
| 108 | .. _Sphinx: http://www.sphinx-doc.org/en/master/ |
| 109 | .. _pip homepage: https://pip.pypa.io/en/stable/ |
Paul Beesley | d2fcc4e | 2019-05-29 13:59:40 +0100 | [diff] [blame] | 110 | .. _Dia: https://wiki.gnome.org/Apps/Dia |
Leonardo Sandoval | 8f9f688 | 2020-06-10 18:26:28 -0500 | [diff] [blame] | 111 | .. _docker: https://www.docker.com/ |
| 112 | .. _docker hub: https://hub.docker.com/repository/docker/sphinxdoc/sphinx |