Paul Beesley | d2fcc4e | 2019-05-29 13:59:40 +0100 | [diff] [blame] | 1 | Performing an Initial Build |
| 2 | =========================== |
| 3 | |
| 4 | - Before building TF-A, the environment variable ``CROSS_COMPILE`` must point |
| 5 | to the Linaro cross compiler. |
| 6 | |
| 7 | For AArch64: |
| 8 | |
| 9 | .. code:: shell |
| 10 | |
| 11 | export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-linux-gnu- |
| 12 | |
| 13 | For AArch32: |
| 14 | |
| 15 | .. code:: shell |
| 16 | |
| 17 | export CROSS_COMPILE=<path-to-aarch32-gcc>/bin/arm-eabi- |
| 18 | |
| 19 | It is possible to build TF-A using Clang or Arm Compiler 6. To do so |
| 20 | ``CC`` needs to point to the clang or armclang binary, which will |
| 21 | also select the clang or armclang assembler. Be aware that the |
| 22 | GNU linker is used by default. In case of being needed the linker |
| 23 | can be overridden using the ``LD`` variable. Clang linker version 6 is |
| 24 | known to work with TF-A. |
| 25 | |
| 26 | In both cases ``CROSS_COMPILE`` should be set as described above. |
| 27 | |
| 28 | Arm Compiler 6 will be selected when the base name of the path assigned |
| 29 | to ``CC`` matches the string 'armclang'. |
| 30 | |
| 31 | For AArch64 using Arm Compiler 6: |
| 32 | |
| 33 | .. code:: shell |
| 34 | |
| 35 | export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-linux-gnu- |
| 36 | make CC=<path-to-armclang>/bin/armclang PLAT=<platform> all |
| 37 | |
| 38 | Clang will be selected when the base name of the path assigned to ``CC`` |
| 39 | contains the string 'clang'. This is to allow both clang and clang-X.Y |
| 40 | to work. |
| 41 | |
| 42 | For AArch64 using clang: |
| 43 | |
| 44 | .. code:: shell |
| 45 | |
| 46 | export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-linux-gnu- |
| 47 | make CC=<path-to-clang>/bin/clang PLAT=<platform> all |
| 48 | |
| 49 | - Change to the root directory of the TF-A source tree and build. |
| 50 | |
| 51 | For AArch64: |
| 52 | |
| 53 | .. code:: shell |
| 54 | |
| 55 | make PLAT=<platform> all |
| 56 | |
| 57 | For AArch32: |
| 58 | |
| 59 | .. code:: shell |
| 60 | |
| 61 | make PLAT=<platform> ARCH=aarch32 AARCH32_SP=sp_min all |
| 62 | |
| 63 | Notes: |
| 64 | |
| 65 | - If ``PLAT`` is not specified, ``fvp`` is assumed by default. See the |
| 66 | :ref:`Build Options` document for more information on available build |
| 67 | options. |
| 68 | |
| 69 | - (AArch32 only) Currently only ``PLAT=fvp`` is supported. |
| 70 | |
| 71 | - (AArch32 only) ``AARCH32_SP`` is the AArch32 EL3 Runtime Software and it |
| 72 | corresponds to the BL32 image. A minimal ``AARCH32_SP``, sp_min, is |
| 73 | provided by TF-A to demonstrate how PSCI Library can be integrated with |
| 74 | an AArch32 EL3 Runtime Software. Some AArch32 EL3 Runtime Software may |
| 75 | include other runtime services, for example Trusted OS services. A guide |
| 76 | to integrate PSCI library with AArch32 EL3 Runtime Software can be found |
| 77 | at :ref:`PSCI Library Integration guide for Armv8-A AArch32 systems`. |
| 78 | |
| 79 | - (AArch64 only) The TSP (Test Secure Payload), corresponding to the BL32 |
| 80 | image, is not compiled in by default. Refer to the |
| 81 | :ref:`Test Secure Payload (TSP) and Dispatcher (TSPD)` document for |
| 82 | details on building the TSP. |
| 83 | |
| 84 | - By default this produces a release version of the build. To produce a |
| 85 | debug version instead, refer to the "Debugging options" section below. |
| 86 | |
| 87 | - The build process creates products in a ``build`` directory tree, building |
| 88 | the objects and binaries for each boot loader stage in separate |
| 89 | sub-directories. The following boot loader binary files are created |
| 90 | from the corresponding ELF files: |
| 91 | |
| 92 | - ``build/<platform>/<build-type>/bl1.bin`` |
| 93 | - ``build/<platform>/<build-type>/bl2.bin`` |
| 94 | - ``build/<platform>/<build-type>/bl31.bin`` (AArch64 only) |
| 95 | - ``build/<platform>/<build-type>/bl32.bin`` (mandatory for AArch32) |
| 96 | |
| 97 | where ``<platform>`` is the name of the chosen platform and ``<build-type>`` |
| 98 | is either ``debug`` or ``release``. The actual number of images might differ |
| 99 | depending on the platform. |
| 100 | |
| 101 | - Build products for a specific build variant can be removed using: |
| 102 | |
| 103 | .. code:: shell |
| 104 | |
| 105 | make DEBUG=<D> PLAT=<platform> clean |
| 106 | |
| 107 | ... where ``<D>`` is ``0`` or ``1``, as specified when building. |
| 108 | |
| 109 | The build tree can be removed completely using: |
| 110 | |
| 111 | .. code:: shell |
| 112 | |
| 113 | make realclean |
| 114 | |
| 115 | -------------- |
| 116 | |
| 117 | *Copyright (c) 2019, Arm Limited. All rights reserved.* |