1Prerequisites
2=============
3
4This document describes the software requirements for building |TF-A| for
5AArch32 and AArch64 target platforms.
6
7It may possible to build |TF-A| with combinations of software packages that are
8different from those listed below, however only the software described in this
9document can be officially supported.
10
11Build Host
12----------
13
14|TF-A| can be built using either a Linux or a Windows machine as the build host.
15
16A relatively recent Linux distribution is recommended for building |TF-A|. We
17have performed tests using Ubuntu 22.04 LTS (64-bit) but other distributions
18should also work fine as a base, provided that the necessary tools and libraries
19can be installed.
20
21.. _prerequisites_toolchain:
22
23Toolchain
24---------
25
26|TF-A| can be built with any of the following *cross-compiler* toolchains that
27target the Armv7-A or Armv8-A architectures:
28
29- TF-A has been tested with version 12.3.Rel1 (gcc 12.3) from the `Arm Developer website`_
30
31   You will need the targets ``arm-none-eabi`` and ``aarch64-none-elf`` for
32   AArch32 and AArch64 builds respectively.
33
34- Clang == 14.0.0
35- Arm Compiler == 6.18
36
37In addition, a native compiler is required to build the supporting tools.
38
39.. note::
40   Versions greater than the ones specified are likely but not guaranteed to
41   work. This is predominantly because TF-A carries its own copy of compiler-rt,
42   which may be older than the version expected by the compiler. Fixes and bug
43   reports are always welcome.
44
45.. note::
46   The software has also been built on Windows 7 Enterprise SP1, using CMD.EXE,
47   Cygwin, and Msys (MinGW) shells, using version 5.3.1 of the GNU toolchain.
48
49.. note::
50   For instructions on how to select the cross compiler refer to
51   :ref:`Performing an Initial Build`.
52
53.. _prerequisites_software_and_libraries:
54
55Software and Libraries
56----------------------
57
58The following tools are required to obtain and build |TF-A|:
59
60- An appropriate toolchain (see :ref:`prerequisites_toolchain`)
61- GNU Make
62- Git
63
64The following libraries must be available to build one or more components or
65supporting tools:
66
67- OpenSSL >= 1.0.0 (1.0.x, v3.0.0 to v3.0.6 highly discouraged due to security issues)
68
69   Required to build the cert_create, encrypt_fw, and fiptool tools.
70
71   .. note::
72
73    If using OpenSSL 3, older Linux versions may require it to be built from
74    source code, as it may not be available in the default package repositories.
75    Please refer to the OpenSSL project documentation for more information.
76
77The following libraries are required for Trusted Board Boot and Measured Boot
78support:
79
80- mbed TLS == 3.4.1 (tag: ``mbedtls-3.4.1``)
81
82These tools are optional:
83
84- Device Tree Compiler (DTC) >= 1.4.7
85
86   Needed if you want to rebuild the provided Flattened Device Tree (FDT)
87   source files (``.dts`` files). DTC is available for Linux through the package
88   repositories of most distributions.
89
90- Arm `Development Studio (Arm-DS)`_
91
92   The standard software package used for debugging software on Arm development
93   platforms and |FVP| models.
94
95- Node.js >= 16
96
97   Highly recommended, and necessary in order to install and use the packaged
98   Git hooks and helper tools. Without these tools you will need to rely on the
99   CI for feedback on commit message conformance.
100
101- Poetry >= 1.3.2
102
103   Required for managing Python dependencies, this will allow you to reliably
104   reproduce a Python environment to build documentation and run analysis tools.
105   Most importantly, it ensures your system environment will not be affected by
106   dependencies in the Python scripts.
107
108Package Installation (Linux)
109^^^^^^^^^^^^^^^^^^^^^^^^^^^^
110
111If you are using the recommended Ubuntu distribution then you can install the
112required packages with the following command:
113
114.. code:: shell
115
116    sudo apt install build-essential git
117
118The optional packages can be installed using:
119
120.. code:: shell
121
122    sudo apt install device-tree-compiler
123
124Additionally, to install a version of Node.js compatible with TF-A's repository
125scripts, you can use the `Node Version Manager`_. To install both NVM and an
126appropriate version of Node.js, run the following **from the root directory of
127the repository**:
128
129.. code:: shell
130
131    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
132    exec "$SHELL" -ic "nvm install; exec $SHELL"
133
134.. _Node Version Manager: https://github.com/nvm-sh/nvm#install--update-script
135
136Supporting Files
137----------------
138
139TF-A has been tested with pre-built binaries and file systems from `Linaro
140Release 20.01`_. Alternatively, you can build the binaries from source using
141instructions in :ref:`Performing an Initial Build`.
142
143.. _prerequisites_get_source:
144
145Getting the TF-A Source
146-----------------------
147
148Source code for |TF-A| is maintained in a Git repository hosted on
149TrustedFirmware.org. To clone this repository from the server, run the following
150in your shell:
151
152.. code:: shell
153
154    git clone "https://review.trustedfirmware.org/TF-A/trusted-firmware-a"
155
156Additional Steps for Contributors
157^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
158
159If you are planning on contributing back to TF-A, there are some things you'll
160want to know.
161
162TF-A is hosted by a `Gerrit Code Review`_ server. Gerrit requires that all
163commits include a ``Change-Id`` footer, and this footer is typically
164automatically generated by a Git hook installed by you, the developer.
165
166If you have Node.js installed already, you can automatically install this hook,
167along with any additional hooks and Javascript-based tooling that we use, by
168running from within your newly-cloned repository:
169
170.. code:: shell
171
172    npm install --no-save
173
174If you have opted **not** to install Node.js, you can install the Gerrit hook
175manually by running:
176
177.. code:: shell
178
179    curl -Lo $(git rev-parse --git-dir)/hooks/commit-msg https://review.trustedfirmware.org/tools/hooks/commit-msg
180    chmod +x $(git rev-parse --git-dir)/hooks/commit-msg
181
182You can read more about Git hooks in the *githooks* page of the Git
183documentation, available `here <https://git-scm.com/docs/githooks>`_.
184
185--------------
186
187*Copyright (c) 2021-2023, Arm Limited. All rights reserved.*
188
189.. _Arm Developer website: https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/downloads
190.. _Gerrit Code Review: https://www.gerritcodereview.com/
191.. _Linaro Release Notes: https://community.arm.com/dev-platforms/w/docs/226/old-release-notes
192.. _Linaro instructions: https://community.arm.com/dev-platforms/w/docs/304/arm-reference-platforms-deliverables
193.. _Development Studio (Arm-DS): https://developer.arm.com/Tools%20and%20Software/Arm%20Development%20Studio
194.. _Linaro Release 20.01: http://releases.linaro.org/members/arm/platforms/20.01
195