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