xref: /rk3399_ARM-atf/docs/getting_started/tools-build.rst (revision 43f35ef516b899c82e11bad760c704c44ced5440)
1*43f35ef5SPaul BeesleyBuilding Supporting Tools
2*43f35ef5SPaul Beesley=========================
3*43f35ef5SPaul Beesley
4*43f35ef5SPaul BeesleyBuilding and using the FIP tool
5*43f35ef5SPaul Beesley-------------------------------
6*43f35ef5SPaul Beesley
7*43f35ef5SPaul BeesleyFirmware Image Package (FIP) is a packaging format used by TF-A to package
8*43f35ef5SPaul Beesleyfirmware images in a single binary. The number and type of images that should
9*43f35ef5SPaul Beesleybe packed in a FIP is platform specific and may include TF-A images and other
10*43f35ef5SPaul Beesleyfirmware images required by the platform. For example, most platforms require
11*43f35ef5SPaul Beesleya BL33 image which corresponds to the normal world bootloader (e.g. UEFI or
12*43f35ef5SPaul BeesleyU-Boot).
13*43f35ef5SPaul Beesley
14*43f35ef5SPaul BeesleyThe TF-A build system provides the make target ``fip`` to create a FIP file
15*43f35ef5SPaul Beesleyfor the specified platform using the FIP creation tool included in the TF-A
16*43f35ef5SPaul Beesleyproject. Examples below show how to build a FIP file for FVP, packaging TF-A
17*43f35ef5SPaul Beesleyand BL33 images.
18*43f35ef5SPaul Beesley
19*43f35ef5SPaul BeesleyFor AArch64:
20*43f35ef5SPaul Beesley
21*43f35ef5SPaul Beesley.. code:: shell
22*43f35ef5SPaul Beesley
23*43f35ef5SPaul Beesley    make PLAT=fvp BL33=<path-to>/bl33.bin fip
24*43f35ef5SPaul Beesley
25*43f35ef5SPaul BeesleyFor AArch32:
26*43f35ef5SPaul Beesley
27*43f35ef5SPaul Beesley.. code:: shell
28*43f35ef5SPaul Beesley
29*43f35ef5SPaul Beesley    make PLAT=fvp ARCH=aarch32 AARCH32_SP=sp_min BL33=<path-to>/bl33.bin fip
30*43f35ef5SPaul Beesley
31*43f35ef5SPaul BeesleyThe resulting FIP may be found in:
32*43f35ef5SPaul Beesley
33*43f35ef5SPaul Beesley::
34*43f35ef5SPaul Beesley
35*43f35ef5SPaul Beesley    build/fvp/<build-type>/fip.bin
36*43f35ef5SPaul Beesley
37*43f35ef5SPaul BeesleyFor advanced operations on FIP files, it is also possible to independently build
38*43f35ef5SPaul Beesleythe tool and create or modify FIPs using this tool. To do this, follow these
39*43f35ef5SPaul Beesleysteps:
40*43f35ef5SPaul Beesley
41*43f35ef5SPaul BeesleyIt is recommended to remove old artifacts before building the tool:
42*43f35ef5SPaul Beesley
43*43f35ef5SPaul Beesley.. code:: shell
44*43f35ef5SPaul Beesley
45*43f35ef5SPaul Beesley    make -C tools/fiptool clean
46*43f35ef5SPaul Beesley
47*43f35ef5SPaul BeesleyBuild the tool:
48*43f35ef5SPaul Beesley
49*43f35ef5SPaul Beesley.. code:: shell
50*43f35ef5SPaul Beesley
51*43f35ef5SPaul Beesley    make [DEBUG=1] [V=1] fiptool
52*43f35ef5SPaul Beesley
53*43f35ef5SPaul BeesleyThe tool binary can be located in:
54*43f35ef5SPaul Beesley
55*43f35ef5SPaul Beesley::
56*43f35ef5SPaul Beesley
57*43f35ef5SPaul Beesley    ./tools/fiptool/fiptool
58*43f35ef5SPaul Beesley
59*43f35ef5SPaul BeesleyInvoking the tool with ``help`` will print a help message with all available
60*43f35ef5SPaul Beesleyoptions.
61*43f35ef5SPaul Beesley
62*43f35ef5SPaul BeesleyExample 1: create a new Firmware package ``fip.bin`` that contains BL2 and BL31:
63*43f35ef5SPaul Beesley
64*43f35ef5SPaul Beesley.. code:: shell
65*43f35ef5SPaul Beesley
66*43f35ef5SPaul Beesley    ./tools/fiptool/fiptool create \
67*43f35ef5SPaul Beesley        --tb-fw build/<platform>/<build-type>/bl2.bin \
68*43f35ef5SPaul Beesley        --soc-fw build/<platform>/<build-type>/bl31.bin \
69*43f35ef5SPaul Beesley        fip.bin
70*43f35ef5SPaul Beesley
71*43f35ef5SPaul BeesleyExample 2: view the contents of an existing Firmware package:
72*43f35ef5SPaul Beesley
73*43f35ef5SPaul Beesley.. code:: shell
74*43f35ef5SPaul Beesley
75*43f35ef5SPaul Beesley    ./tools/fiptool/fiptool info <path-to>/fip.bin
76*43f35ef5SPaul Beesley
77*43f35ef5SPaul BeesleyExample 3: update the entries of an existing Firmware package:
78*43f35ef5SPaul Beesley
79*43f35ef5SPaul Beesley.. code:: shell
80*43f35ef5SPaul Beesley
81*43f35ef5SPaul Beesley    # Change the BL2 from Debug to Release version
82*43f35ef5SPaul Beesley    ./tools/fiptool/fiptool update \
83*43f35ef5SPaul Beesley        --tb-fw build/<platform>/release/bl2.bin \
84*43f35ef5SPaul Beesley        build/<platform>/debug/fip.bin
85*43f35ef5SPaul Beesley
86*43f35ef5SPaul BeesleyExample 4: unpack all entries from an existing Firmware package:
87*43f35ef5SPaul Beesley
88*43f35ef5SPaul Beesley.. code:: shell
89*43f35ef5SPaul Beesley
90*43f35ef5SPaul Beesley    # Images will be unpacked to the working directory
91*43f35ef5SPaul Beesley    ./tools/fiptool/fiptool unpack <path-to>/fip.bin
92*43f35ef5SPaul Beesley
93*43f35ef5SPaul BeesleyExample 5: remove an entry from an existing Firmware package:
94*43f35ef5SPaul Beesley
95*43f35ef5SPaul Beesley.. code:: shell
96*43f35ef5SPaul Beesley
97*43f35ef5SPaul Beesley    ./tools/fiptool/fiptool remove \
98*43f35ef5SPaul Beesley        --tb-fw build/<platform>/debug/fip.bin
99*43f35ef5SPaul Beesley
100*43f35ef5SPaul BeesleyNote that if the destination FIP file exists, the create, update and
101*43f35ef5SPaul Beesleyremove operations will automatically overwrite it.
102*43f35ef5SPaul Beesley
103*43f35ef5SPaul BeesleyThe unpack operation will fail if the images already exist at the
104*43f35ef5SPaul Beesleydestination. In that case, use -f or --force to continue.
105*43f35ef5SPaul Beesley
106*43f35ef5SPaul BeesleyMore information about FIP can be found in the :ref:`Firmware Design` document.
107*43f35ef5SPaul Beesley
108*43f35ef5SPaul Beesley.. _tools_build_cert_create:
109*43f35ef5SPaul Beesley
110*43f35ef5SPaul BeesleyBuilding the Certificate Generation Tool
111*43f35ef5SPaul Beesley----------------------------------------
112*43f35ef5SPaul Beesley
113*43f35ef5SPaul BeesleyThe ``cert_create`` tool is built as part of the TF-A build process when the
114*43f35ef5SPaul Beesley``fip`` make target is specified and TBB is enabled (as described in the
115*43f35ef5SPaul Beesleyprevious section), but it can also be built separately with the following
116*43f35ef5SPaul Beesleycommand:
117*43f35ef5SPaul Beesley
118*43f35ef5SPaul Beesley.. code:: shell
119*43f35ef5SPaul Beesley
120*43f35ef5SPaul Beesley    make PLAT=<platform> [DEBUG=1] [V=1] certtool
121*43f35ef5SPaul Beesley
122*43f35ef5SPaul BeesleyFor platforms that require their own IDs in certificate files, the generic
123*43f35ef5SPaul Beesley'cert_create' tool can be built with the following command. Note that the target
124*43f35ef5SPaul Beesleyplatform must define its IDs within a ``platform_oid.h`` header file for the
125*43f35ef5SPaul Beesleybuild to succeed.
126*43f35ef5SPaul Beesley
127*43f35ef5SPaul Beesley.. code:: shell
128*43f35ef5SPaul Beesley
129*43f35ef5SPaul Beesley    make PLAT=<platform> USE_TBBR_DEFS=0 [DEBUG=1] [V=1] certtool
130*43f35ef5SPaul Beesley
131*43f35ef5SPaul Beesley``DEBUG=1`` builds the tool in debug mode. ``V=1`` makes the build process more
132*43f35ef5SPaul Beesleyverbose. The following command should be used to obtain help about the tool:
133*43f35ef5SPaul Beesley
134*43f35ef5SPaul Beesley.. code:: shell
135*43f35ef5SPaul Beesley
136*43f35ef5SPaul Beesley    ./tools/cert_create/cert_create -h
137*43f35ef5SPaul Beesley
138*43f35ef5SPaul Beesley--------------
139*43f35ef5SPaul Beesley
140*43f35ef5SPaul Beesley*Copyright (c) 2019, Arm Limited. All rights reserved.*
141