J-Alves | 241c66c | 2023-10-19 13:59:29 +0100 | [diff] [blame] | 1 | Prerequisites |
| 2 | ============= |
| 3 | |
| 4 | Build Host |
| 5 | ---------- |
| 6 | |
| 7 | A relatively recent Linux distribution is recommended. |
| 8 | CI runs are done using Ubuntu 22.04 LTS (64-bit). |
| 9 | |
| 10 | Toolchain |
| 11 | --------- |
| 12 | |
J-Alves | 3678f20 | 2025-05-27 18:05:57 +0100 | [diff] [blame] | 13 | The clang-20 toolchain is recommended for building Hafnium and the test |
| 14 | infrastructure. On Ubuntu, the toolchain can be installed from the LLVM apt |
| 15 | repository (https://apt.llvm.org/). |
J-Alves | 241c66c | 2023-10-19 13:59:29 +0100 | [diff] [blame] | 16 | |
| 17 | .. note:: |
| 18 | |
J-Alves | 3678f20 | 2025-05-27 18:05:57 +0100 | [diff] [blame] | 19 | Using a toolchain version greater than, or significantly lesser than the one |
J-Alves | 241c66c | 2023-10-19 13:59:29 +0100 | [diff] [blame] | 20 | specified is not guaranteed to work. |
| 21 | |
J-Alves | 3678f20 | 2025-05-27 18:05:57 +0100 | [diff] [blame] | 22 | .. note:: |
J-Alves | 241c66c | 2023-10-19 13:59:29 +0100 | [diff] [blame] | 23 | |
J-Alves | 3678f20 | 2025-05-27 18:05:57 +0100 | [diff] [blame] | 24 | You may also use the Docker container if you are unable to install the |
| 25 | toolchain on your host machine, see the :ref:`Using_Docker` section. |
J-Alves | 241c66c | 2023-10-19 13:59:29 +0100 | [diff] [blame] | 26 | |
| 27 | Dependencies |
| 28 | ------------ |
| 29 | |
| 30 | Build |
| 31 | ^^^^^ |
| 32 | |
| 33 | The following command install the dependencies for the Hafnium build: |
| 34 | |
| 35 | .. code:: shell |
| 36 | |
| 37 | sudo apt install make libssl-dev flex bison python3 python3-serial python3-pip device-tree-compiler |
| 38 | |
Lucas Bruckbauer | 08f89d7 | 2025-07-02 11:49:34 +0100 | [diff] [blame] | 39 | In addition, install the following python libraries using `pip`_: |
J-Alves | 241c66c | 2023-10-19 13:59:29 +0100 | [diff] [blame] | 40 | |
| 41 | .. code:: shell |
| 42 | |
Lucas Bruckbauer | 08f89d7 | 2025-07-02 11:49:34 +0100 | [diff] [blame] | 43 | pip3 install fdt click |
J-Alves | 241c66c | 2023-10-19 13:59:29 +0100 | [diff] [blame] | 44 | |
J-Alves | 8018929 | 2024-10-23 14:39:13 +0100 | [diff] [blame] | 45 | The file kokoro/static_checks.sh runs a series of static code checks into Hafnium's codebase. |
| 46 | Hafnium follows the linux kernel coding guidelines. As such, the static code checks using the |
| 47 | 'checkpatch.pl' script from linux source tree. To setup and download 'checkpatch.pl': |
| 48 | |
| 49 | .. code:: shell |
Daniel Boulby | 0a69718 | 2024-11-15 11:46:26 +0000 | [diff] [blame] | 50 | |
J-Alves | 8018929 | 2024-10-23 14:39:13 +0100 | [diff] [blame] | 51 | ./build/setup_checkpatch.sh |
| 52 | |
| 53 | Then test it works with: |
| 54 | |
| 55 | .. code:: shell |
Daniel Boulby | 0a69718 | 2024-11-15 11:46:26 +0000 | [diff] [blame] | 56 | |
J-Alves | 8018929 | 2024-10-23 14:39:13 +0100 | [diff] [blame] | 57 | make checkpatch |
| 58 | |
Jayanth Dodderi Chidanand | fd2f846 | 2025-05-29 15:31:32 +0100 | [diff] [blame] | 59 | System and Python Packages for test infrastructure |
| 60 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 61 | |
| 62 | The `Shrinkwrap`_ tool is a core component of the hftest scripts and is included |
| 63 | as a submodule. It relies on the following system packages to function correctly: |
| 64 | |
| 65 | .. code:: shell |
| 66 | |
| 67 | sudo apt-get install -y git netcat-openbsd python3 python3-pip telnet |
| 68 | |
| 69 | Further, install the required Python packages: |
| 70 | |
| 71 | .. code:: shell |
| 72 | |
| 73 | pip3 install --user fdt pyyaml termcolor tuxmake |
| 74 | |
| 75 | .. note:: |
| 76 | |
| 77 | These manual installation steps are not required if you're using the Docker |
| 78 | based test environment. All necessary dependencies—system packages, |
| 79 | Python modules, and Shrinkwrap environment configuration—are already |
| 80 | pre-installed and automated inside the Docker image provided by the |
| 81 | Hafnium repository (see :ref:`Using_Docker`). |
| 82 | |
J-Alves | 241c66c | 2023-10-19 13:59:29 +0100 | [diff] [blame] | 83 | Documentation |
| 84 | ^^^^^^^^^^^^^ |
| 85 | |
| 86 | To create a rendered copy of this documentation locally you can use the |
| 87 | `Sphinx`_ tool to build and package the plain-text documents into HTML-formatted |
| 88 | pages. |
| 89 | |
| 90 | For building a local copy of the documentation you will need: |
| 91 | |
| 92 | - Python 3 (3.8 or later) |
| 93 | - PlantUML (1.2017.15 or later) |
| 94 | - `Poetry`_ (Python dependency manager) |
| 95 | |
| 96 | Below is an example set of instructions to get a working environment (tested on |
| 97 | Ubuntu): |
| 98 | |
| 99 | .. code:: shell |
| 100 | |
| 101 | sudo apt install python3 python3-pip plantuml |
| 102 | curl -sSL https://install.python-poetry.org | python3 - |
| 103 | |
Harrison Mutai | 94f9a73 | 2024-08-05 16:33:15 +0100 | [diff] [blame] | 104 | Run the command below to install using Poetry, Python dependencies to build the documentation: |
J-Alves | 241c66c | 2023-10-19 13:59:29 +0100 | [diff] [blame] | 105 | |
| 106 | .. code:: shell |
| 107 | |
Harrison Mutai | 94f9a73 | 2024-08-05 16:33:15 +0100 | [diff] [blame] | 108 | poetry install --with docs |
J-Alves | 241c66c | 2023-10-19 13:59:29 +0100 | [diff] [blame] | 109 | |
| 110 | Poetry will create a new virtual environment and install all dependencies listed |
| 111 | in ``pyproject.toml``. You can get information about this environment, such as |
| 112 | its location and the Python version, with the command: |
| 113 | |
| 114 | .. code:: shell |
| 115 | |
| 116 | poetry env info |
| 117 | |
| 118 | -------------- |
| 119 | |
Jayanth Dodderi Chidanand | fd2f846 | 2025-05-29 15:31:32 +0100 | [diff] [blame] | 120 | *Copyright (c) 2023-2025, Arm Limited. All rights reserved.* |
J-Alves | 241c66c | 2023-10-19 13:59:29 +0100 | [diff] [blame] | 121 | |
Jayanth Dodderi Chidanand | fd2f846 | 2025-05-29 15:31:32 +0100 | [diff] [blame] | 122 | .. _Shrinkwrap: https://shrinkwrap.docs.arm.com |
J-Alves | 241c66c | 2023-10-19 13:59:29 +0100 | [diff] [blame] | 123 | .. _Sphinx: http://www.sphinx-doc.org/en/master/ |
| 124 | .. _Poetry: https://python-poetry.org/docs/ |
| 125 | .. _pip: https://pip.pypa.io/en/stable/ |