blob: 7b7e56fdeef66ad73e2a23209fa17967771c3342 [file] [log] [blame]
Xialin Liufeee26f2024-07-29 17:10:16 -05001TF-A CoT dt2c Tool
2==================
3
4This tool is used to automatically generate the corresponding c file for a
5CoT DT file. Since currently TF-A support two type of CoT file: static c file
6and CoT DT binding. This is error prone and hard to maintain, therefore this
7tool can generate the c file for the platform that does not support CoT DT
8binding, given the CoT DT file so the c file can be deprecated.
9
10Prerequisites
11~~~~~~~~~~~~~
12
13#. Python (3.8 or later)
14#. `Poetry`_ Python package manager
15
16
17Getting Started
18~~~~~~~~~~~~~~~
19
20#. Install the tool
21
22 .. code::
23
24 make install
25
26
27#. Verify that the tool runs correctly
28
29 .. code::
30
31 make test
32
33
34#. Usage of the tool
35
36 .. code::
37
38 cot-dt2c
39
40 This command will output the following as usage for this command
41
42 .. code-block:: text
43
44 Usage: cot-dt2c [OPTIONS] COMMAND [ARGS]...
45
46 Options:
47 --version Show the version and exit.
48 --help Show this message and exit.
49
50 Commands:
51 convert-to-c
52 validate-cot
53 visualize-cot
54 validate-dt
55
56#. Uninstall the tool
57 .. code::
58
59 make uninstall
60
61 This command will uninstall the tool
62
63
64#. Uninstall the tool and clean all the build file
65 .. code::
66
67 make clean
68
69 This command will clean all the build file and implicitly uninstall the tool
70
71
72#. Call the make file from TF-A root directory
73 .. code::
74
75 make -C tools/cot-dt2c install
76 make -C tools/cot-dt2c uninstall
77 make -C tools/cot-dt2c clean
78
79Convert CoT descriptors to C file
80~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
81
82To convert the CoT descriptors
83
84This command is for the platform that does not use CoT DT parser,
85which can generate the C file given the CoT descriptors. Before
86the conversion to C file, the tool will do an implicit checks on
87the validity of the CoT DT file.
88
89.. code::
90
91 cot-dt2c convert-to-c [INPUT DTB PATH] [OUTPUT C PATH]
92 cot-dt2c convert-to-c fdts/tbbr_cot_descriptors.dtsi test.c
93
94
95Validate CoT descriptors
96~~~~~~~~~~~~~~~~~~~~~~~~~
97
98To validate the certificate
99
100The tests folder in the tool folder provides some bad-example of the
101DT file, and the tool will print out "not a valid CoT DT file" on console.
102
103The command will check the format of the CoT file
104
105#. The open bracket
106#. The open ifdef macro
107#. The missing mandatory attribute
108#. Malformed DT file (cert missing parent, missing root certs. etc.)
109
110Currently the validation is specifically for checking the CoT DT file
111
112.. code::
113
114 cot-dt2c validate-cot [INPUT DTB PATH]
115 cot-dt2c validate-cot fdts/tbbr_cot_descriptors.dtsi
116
117
118Visualize CoT descriptors
119~~~~~~~~~~~~~~~~~~~~~~~~~
120
121This command create a HTML to visualize the relationship between
122the certificates and the image of a CoT DT file.
123
124.. code::
125
126 cot-dt2c visualize-cot [INPUT DTB PATH]
127 cot-dt2c visualize-cot fdts/tbbr_cot_descriptors.dtsi
128
129
130Validate Other DT files
131~~~~~~~~~~~~~~~~~~~~~~~
132
133The command will transform the dtsi/dts file into a more standard
134dtsi/dts file inside /tmp folder that can be used as input to dt-schema
135for further validation. Currently the tool will perform some basic validation
136for the file (syntax) and dt-schema can be used for advance checks. dt-schema
137is not installed along with the tool.
138
139.. code::
140
141 cot-dt2c validate-dt [INPUT DTS PATH or INPUT DTS folder]
142 cot-dt2c validate-dt fdts/
143 cot-dt2c validate-dt fdts/fvp-bsae-gicv3.dtsi
144
145--------------
146
147*Copyright (c) 2024, Arm Limited. All rights reserved.*
148
149.. _Poetry: https://python-poetry.org/docs/