blob: cd8e2cf3ade7f214d198ec3539f319d4d9e68e40 [file] [log] [blame]
Olivier Deprez5ed0bee2023-06-08 10:55:05 +02001Building Hafnium
2================
3
4Prerequisites
5-------------
6
7Build Host
8^^^^^^^^^^
9
10A relatively recent Linux distribution is recommended.
11CI runs are done using Ubuntu 22.04 LTS (64-bit).
12
13Toolchain
14^^^^^^^^^
15
16The following toolchain is recommended for building Hafnium and the test
17infrastructure:
18
19- For a x86_64 Ubuntu host,
20
21.. code:: shell
22
23 https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz
24
25- For a AArch64 Ubuntu host,
26
27.. code:: shell
28
29 https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-aarch64-linux-gnu.tar.xz
30
31.. note::
32
33 Use of a native toolchain installed on the host (e.g. /usr/bin/clang) is
34 not supported.
35
36.. note::
37
38 Using a toolchain version greater, or significantly lesser than the one
39 specified is not guaranteed to work.
40
41.. _prerequisites_software_and_libraries:
42
43Dependencies
44^^^^^^^^^^^^
45
46If you are using the recommended Ubuntu distribution then you can install the
47required packages with the following command:
48
49.. code:: shell
50
51 sudo apt install make libssl-dev flex bison python3 python3-serial
52 python3-pip device-tree-compiler
53
54 pip3 install fdt
55
56.. _prerequisites_get_source:
57
58Getting the sources
59^^^^^^^^^^^^^^^^^^^
60
61Hafnium source code is maintained in a Git repository hosted on
62trustedfirmware.org.
63To clone this repository from the server, run the following
64in your shell:
65
66.. code:: shell
67
68 git clone --recurse-submodules https://git.trustedfirmware.org/hafnium/hafnium.git
69
70In order to import gerrit hooks useful to add a Change-Id footer in commit messages,
71it is recommended to use:
72
73.. code:: shell
74
75 git clone --recurse-submodules https://git.trustedfirmware.org/hafnium/hafnium.git && { cd hafnium && f="$(git rev-parse --git-dir)"; curl -Lo "$f/hooks/commit-msg" https://review.trustedfirmware.org/tools/hooks/commit-msg && { chmod +x "$f/hooks/commit-msg"; git submodule --quiet foreach "cp \"\$toplevel/$f/hooks/commit-msg\" \"\$toplevel/$f/modules/\$path/hooks/commit-msg\""; }; }
76
77Building
78--------
79
80The PATH environment variable shall be adjusted to the LLVM/clang directory, prior to building e.g.:
81
82.. code:: shell
83
84 PATH=<toolchain_dir>/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04/bin:$PATH
85
86By default, the Hafnium SPMC is built with clang for a few target platforms along
87with tests. From Hafnium top level directory, simply type:
88
89.. code:: shell
90
91 make
92
93The resulting FVP image is located in
94`out/reference/secure_aem_v8a_fvp_vhe_clang/hafnium.bin`.
95
96The presence of assertions in the final build can be set using the `ENABLE_ASSERTIONS`
97make variable, by default this is set to `true`, meaning asserts are included in the build.
98
99.. code:: shell
100
101 make ENABLE_ASSERTIONS=<true|false>
102
103Each project in the `project` directory specifies a root configurations of the
104build. Adding a project is the preferred way to extend support to new platforms.
105The target project that is built is selected by the `PROJECT` make variable, the
106default project is 'reference'.
107
108.. code:: shell
109
110 make PROJECT=<project_name>
111
112If you wish to change the value of the make variables you may need to first use:
113
114.. code:: shell
115
116 make clobber
117
118So the `args.gn` file will be regenerated with the new values.
119
120--------------
121
122*Copyright (c) 2023, Arm Limited. All rights reserved.*