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 208526472aSBoyan KaratotevFor building a local copy of the |TF-A| documentation you will need: 21862c764aSPaul Beesley 22793f72c0SHarrison Mutai- Python 3 (3.8 or later) 23862c764aSPaul Beesley- PlantUML (1.2017.15 or later) 2495f4abedSHarrison Mutai- `Poetry`_ (Python dependency manager) 258526472aSBoyan Karatotev- Optionally, the `Dia`_ application can be installed if you need to edit 2643f35ef5SPaul Beesley existing ``.dia`` diagram files, or create new ones. 2743f35ef5SPaul Beesley 28793f72c0SHarrison Mutai 2995f4abedSHarrison MutaiBelow is an example set of instructions to get a working environment (tested on 3095f4abedSHarrison MutaiUbuntu): 31862c764aSPaul Beesley 32862c764aSPaul Beesley.. code:: shell 33862c764aSPaul Beesley 3443f35ef5SPaul Beesley sudo apt install python3 python3-pip plantuml [dia] 35793f72c0SHarrison Mutai curl -sSL https://install.python-poetry.org | python3 - 36862c764aSPaul Beesley 37862c764aSPaul BeesleyBuilding rendered documentation 38862c764aSPaul Beesley------------------------------- 39862c764aSPaul Beesley 409db2b059STamas BanThe documentation can be compiled into HTML-formatted pages from the project 419db2b059STamas Banroot directory by running: 42862c764aSPaul Beesley 43862c764aSPaul Beesley.. code:: shell 44862c764aSPaul Beesley 45*c61c9a31SHarrison Mutai make doc 46862c764aSPaul Beesley 4795f4abedSHarrison MutaiOutput from the build process will be placed in: ``docs/build/html``. 48862c764aSPaul Beesley 4995f4abedSHarrison MutaiOther Output Formats 5095f4abedSHarrison Mutai~~~~~~~~~~~~~~~~~~~~ 516de32378SMadhukar Pappireddy 526de32378SMadhukar PappireddyWe also support building documentation in other formats. From the ``docs`` 536de32378SMadhukar Pappireddydirectory of the project, run the following command to see the supported 5495f4abedSHarrison Mutaiformats. 556de32378SMadhukar Pappireddy 566de32378SMadhukar Pappireddy.. code:: shell 576de32378SMadhukar Pappireddy 58*c61c9a31SHarrison Mutai make -C docs help 59793f72c0SHarrison Mutai 605ac3fdcdSElizabeth HoTo build the documentation in PDF format, additionally ensure that the following 615ac3fdcdSElizabeth Hopackages are installed: 625ac3fdcdSElizabeth Ho 635ac3fdcdSElizabeth Ho- FreeSerif font 645ac3fdcdSElizabeth Ho- latexmk 655ac3fdcdSElizabeth Ho- librsvg2-bin 665ac3fdcdSElizabeth Ho- xelatex 675ac3fdcdSElizabeth Ho- xindy 685ac3fdcdSElizabeth Ho 695ac3fdcdSElizabeth HoBelow is an example set of instructions to install the required packages 705ac3fdcdSElizabeth Ho(tested on Ubuntu): 715ac3fdcdSElizabeth Ho 725ac3fdcdSElizabeth Ho.. code:: shell 735ac3fdcdSElizabeth Ho 745ac3fdcdSElizabeth Ho sudo apt install fonts-freefont-otf latexmk librsvg2-bin texlive-xetex xindy 755ac3fdcdSElizabeth Ho 765ac3fdcdSElizabeth HoOnce all the dependencies are installed, run the command ``poetry run make -C 775ac3fdcdSElizabeth Hodocs latexpdf`` to build the documentation. Output from the build process 785ac3fdcdSElizabeth Ho(``trustedfirmware-a.pdf``) can be found in ``docs/build/latex``. 795ac3fdcdSElizabeth Ho 8095f4abedSHarrison MutaiBuilding rendered documentation from Poetry's virtual environment 8195f4abedSHarrison Mutai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 82793f72c0SHarrison Mutai 83*c61c9a31SHarrison MutaiIf Poetry is installed, the ``doc`` target wraps its build steps with ``poetry 84*c61c9a31SHarrison Mutairun``, which runs the specified command within the project's virtual 85*c61c9a31SHarrison Mutaienvironment. The easiest way to activate this environment manually is by using 86*c61c9a31SHarrison Mutaithe ``poetry shell`` command. 8795f4abedSHarrison Mutai 8895f4abedSHarrison MutaiRunning ``poetry shell`` from the directory containing this project, activates 8995f4abedSHarrison Mutaithe same virtual environment. This creates a sub-shell through which you can 9095f4abedSHarrison Mutaibuild the documentation directly with ``make``. 9195f4abedSHarrison Mutai 9295f4abedSHarrison Mutai.. code:: shell 9395f4abedSHarrison Mutai 9495f4abedSHarrison Mutai poetry shell 95*c61c9a31SHarrison Mutai make -C docs html 9695f4abedSHarrison Mutai 9795f4abedSHarrison MutaiType ``exit`` to deactivate the virtual environment and exit this new shell. For 9895f4abedSHarrison Mutaiother use cases, please see the official `Poetry`_ documentation. 99862c764aSPaul Beesley 1007be2b983SLeonardo SandovalBuilding rendered documentation from a container 1017be2b983SLeonardo Sandoval------------------------------------------------ 1027be2b983SLeonardo Sandoval 1037be2b983SLeonardo SandovalThere may be cases where you can not either install or upgrade required 1047be2b983SLeonardo Sandovaldependencies to generate the documents, so in this case, one way to 1057be2b983SLeonardo Sandovalcreate the documentation is through a docker container. The first step is 1067be2b983SLeonardo Sandovalto check if `docker`_ is installed in your host, otherwise check main docker 1077be2b983SLeonardo Sandovalpage for installation instructions. Once installed, run the following script 1087be2b983SLeonardo Sandovalfrom project root directory 1097be2b983SLeonardo Sandoval 1107be2b983SLeonardo Sandoval.. code:: shell 1117be2b983SLeonardo Sandoval 11295f4abedSHarrison Mutai docker run --rm -v $PWD:/tf-a sphinxdoc/sphinx \ 11395f4abedSHarrison Mutai bash -c 'cd /tf-a && 11495f4abedSHarrison Mutai apt-get update && apt-get install -y curl plantuml && 11595f4abedSHarrison Mutai curl -sSL https://install.python-poetry.org | python3 - && 1169db2b059STamas Ban ~/.local/bin/poetry run make doc' 1177be2b983SLeonardo Sandoval 1187be2b983SLeonardo SandovalThe above command fetches the ``sphinxdoc/sphinx`` container from `docker 1197be2b983SLeonardo Sandovalhub`_, launches the container, installs documentation requirements and finally 1207be2b983SLeonardo Sandovalcreates the documentation. Once done, exit the container and output from the 12195f4abedSHarrison Mutaibuild process will be placed in: ``docs/build/html``. 1227be2b983SLeonardo Sandoval 123862c764aSPaul Beesley-------------- 124862c764aSPaul Beesley 125*c61c9a31SHarrison Mutai*Copyright (c) 2019-2025, Arm Limited. All rights reserved.* 126862c764aSPaul Beesley 127862c764aSPaul Beesley.. _Sphinx: http://www.sphinx-doc.org/en/master/ 12895f4abedSHarrison Mutai.. _Poetry: https://python-poetry.org/docs/ 129862c764aSPaul Beesley.. _pip homepage: https://pip.pypa.io/en/stable/ 13043f35ef5SPaul Beesley.. _Dia: https://wiki.gnome.org/Apps/Dia 1317be2b983SLeonardo Sandoval.. _docker: https://www.docker.com/ 1327be2b983SLeonardo Sandoval.. _docker hub: https://hub.docker.com/repository/docker/sphinxdoc/sphinx 133