]> Git Repo - J-u-boot.git/blame - doc/uImage.FIT/source_file_format.txt
fpga: zynqmp: support loading encrypted bitfiles
[J-u-boot.git] / doc / uImage.FIT / source_file_format.txt
CommitLineData
a187559e 1U-Boot new uImage source file format (bindings definition)
3310c549
MB
2==========================================================
3
4Author: Marian Balakowicz <[email protected]>
722ebc8f 5External data additions, 25/1/16 Simon Glass <[email protected]>
3310c549
MB
6
71) Introduction
8---------------
9
10Evolution of the 2.6 Linux kernel for embedded PowerPC systems introduced new
11booting method which requires that hardware description is available to the
12kernel in the form of Flattened Device Tree.
13
14Booting with a Flattened Device Tree is much more flexible and is intended to
15replace direct passing of 'struct bd_info' which was used to boot pre-FDT
16kernels.
17
a187559e 18However, U-Boot needs to support both techniques to provide backward
3310c549
MB
19compatibility for platforms which are not FDT ready. Number of elements
20playing role in the booting process has increased and now includes the FDT
21blob. Kernel image, FDT blob and possibly ramdisk image - all must be placed
22in the system memory and passed to bootm as a arguments. Some of them may be
23missing: FDT is not present for legacy platforms, ramdisk is always optional.
24Additionally, old uImage format has been extended to support multi sub-images
25but the support is limited by simple format of the legacy uImage structure.
26Single binary header 'struct image_header' is not flexible enough to cover all
27possible scenarios.
28
29All those factors combined clearly show that there is a need for new, more
30flexible, multi component uImage format.
31
32
332) New uImage format assumptions
34--------------------------------
35
36a) Implementation
37
38Libfdt has been selected for the new uImage format implementation as (1) it
39provides needed functionality, (2) is actively maintained and developed and
a187559e 40(3) increases code reuse as it is already part of the U-Boot source tree.
3310c549
MB
41
42b) Terminology
43
44This document defines new uImage structure by providing FDT bindings for new
a187559e
BM
45uImage internals. Bindings are defined from U-Boot perspective, i.e. describe
46final form of the uImage at the moment when it reaches U-Boot. User
3310c549 47perspective may be simpler, as some of the properties (like timestamps and
a187559e 48hashes) will need to be filled in automatically by the U-Boot mkimage tool.
3310c549
MB
49
50To avoid confusion with the kernel FDT the following naming convention is
51proposed for the new uImage format related terms:
52
53FIT - Flattened uImage Tree
54
55FIT is formally a flattened device tree (in the libfdt meaning), which
56conforms to bindings defined in this document.
57
58.its - image tree source
486c39c2 59.itb - flattened image tree blob
3310c549
MB
60
61c) Image building procedure
62
63The following picture shows how the new uImage is prepared. Input consists of
64image source file (.its) and a set of data files. Image is created with the
a187559e 65help of standard U-Boot mkimage tool which in turn uses dtc (device tree
61ffc17a 66compiler) to produce image tree blob (.itb). Resulting .itb file is the
3310c549
MB
67actual binary of a new uImage.
68
69
70tqm5200.its
71+
438a4c11 72vmlinux.bin.gz mkimage + dtc xfer to target
3310c549 73eldk-4.2-ramdisk --------------> tqm5200.itb --------------> bootm
438a4c11
WD
74tqm5200.dtb /|\
75... |
76 'new uImage'
3310c549
MB
77
78 - create .its file, automatically filled-in properties are omitted
79 - call mkimage tool on a .its file
80 - mkimage calls dtc to create .itb image and assures that
81 missing properties are added
82 - .itb (new uImage) is uploaded onto the target and used therein
83
84
85d) Unique identifiers
86
87To identify FIT sub-nodes representing images, hashes, configurations (which
88are defined in the following sections), the "unit name" of the given sub-node
89is used as it's identifier as it assures uniqueness without additional
90checking required.
91
92
933) Root node properties
94-----------------------
95
96Root node of the uImage Tree should have the following layout:
97
98/ o image-tree
99 |- description = "image description"
100 |- timestamp = <12399321>
101 |- #address-cells = <1>
102 |
103 o images
104 | |
83840405
AP
105 | o image-1 {...}
106 | o image-2 {...}
3310c549
MB
107 | ...
108 |
109 o configurations
83840405 110 |- default = "conf-1"
3310c549 111 |
83840405
AP
112 o conf-1 {...}
113 o conf-2 {...}
3310c549
MB
114 ...
115
116
117 Optional property:
118 - description : Textual description of the uImage
119
120 Mandatory property:
121 - timestamp : Last image modification time being counted in seconds since
122 1970-01-01 00:00:00 - to be automatically calculated by mkimage tool.
123
124 Conditionally mandatory property:
125 - #address-cells : Number of 32bit cells required to represent entry and
126 load addresses supplied within sub-image nodes. May be omitted when no
127 entry or load addresses are used.
128
4afc4f37 129 Mandatory nodes:
3310c549
MB
130 - images : This node contains a set of sub-nodes, each of them representing
131 single component sub-image (like kernel, ramdisk, etc.). At least one
132 sub-image is required.
3310c549
MB
133 - configurations : Contains a set of available configuration nodes and
134 defines a default configuration.
135
136
1374) '/images' node
138-----------------
139
140This node is a container node for component sub-image nodes. Each sub-node of
141the '/images' node should have the following layout:
142
83840405 143 o image-1
3310c549
MB
144 |- description = "component sub-image description"
145 |- data = /incbin/("path/to/data/file.bin")
146 |- type = "sub-image type name"
147 |- arch = "ARCH name"
148 |- os = "OS name"
149 |- compression = "compression name"
150 |- load = <00000000>
151 |- entry = <00000000>
152 |
83840405
AP
153 o hash-1 {...}
154 o hash-2 {...}
3310c549
MB
155 ...
156
157 Mandatory properties:
158 - description : Textual description of the component sub-image
159 - type : Name of component sub-image type, supported types are:
25fa0b93
TR
160 "standalone", "kernel", "kernel_noload", "ramdisk", "firmware", "script",
161 "filesystem", "flat_dt" and others (see uimage_type in common/image.c).
3310c549
MB
162 - data : Path to the external file which contains this node's binary data.
163 - compression : Compression used by included data. Supported compressions
164 are "gzip" and "bzip2". If no compression is used compression property
fd15a9e2
SG
165 should be set to "none". If the data is compressed but it should not be
166 uncompressed by U-Boot (e.g. compressed ramdisk), this should also be set
167 to "none".
3310c549
MB
168
169 Conditionally mandatory property:
4afc4f37
AG
170 - os : OS name, mandatory for types "kernel". Valid OS names are:
171 "openbsd", "netbsd", "freebsd", "4_4bsd", "linux", "svr4", "esix",
5cde9d8e 172 "solaris", "irix", "sco", "dell", "ncr", "lynxos", "vxworks", "psos", "qnx",
55a2bec7 173 "u-boot", "rtems", "unity", "integrity".
3310c549
MB
174 - arch : Architecture name, mandatory for types: "standalone", "kernel",
175 "firmware", "ramdisk" and "fdt". Valid architecture names are: "alpha",
176 "arm", "i386", "ia64", "mips", "mips64", "ppc", "s390", "sh", "sparc",
38119778
SG
177 "sparc64", "m68k", "microblaze", "nios2", "blackfin", "avr32", "st200",
178 "sandbox".
3310c549 179 - entry : entry point address, address size is determined by
4afc4f37
AG
180 '#address-cells' property of the root node.
181 Mandatory for types: "firmware", and "kernel".
3310c549 182 - load : load address, address size is determined by '#address-cells'
4afc4f37
AG
183 property of the root node.
184 Mandatory for types: "firmware", and "kernel".
185 - compatible : compatible method for loading image.
186 Mandatory for types: "fpga", and images that do not specify a load address.
a3a1afb7
OS
187 Supported compatible methods:
188 "u-boot,fpga-legacy" - the generic fpga loading routine.
189 "u-boot,zynqmp-fpga-ddrauth" - signed non-encrypted FPGA bitstream for
190 Xilinx Zynq UltraScale+ (ZymqMP) device.
b524f8fb
AF
191 "u-boot,zynqmp-fpga-enc" - encrypted FPGA bitstream for Xilinx Zynq
192 UltraScale+ (ZynqMP) device.
3310c549
MB
193
194 Optional nodes:
83840405 195 - hash-1 : Each hash sub-node represents separate hash or checksum
3310c549
MB
196 calculated for node's data according to specified algorithm.
197
198
1995) Hash nodes
200-------------
201
83840405 202o hash-1
3310c549
MB
203 |- algo = "hash or checksum algorithm name"
204 |- value = [hash or checksum value]
205
206 Mandatory properties:
207 - algo : Algorithm name, supported are "crc32", "md5" and "sha1".
208 - value : Actual checksum or hash value, correspondingly 4, 16 or 20 bytes
209 long.
210
211
2126) '/configurations' node
213-------------------------
214
4afc4f37
AG
215The 'configurations' node creates convenient, labeled boot configurations,
216which combine together kernel images with their ramdisks and fdt blobs.
3310c549
MB
217
218The 'configurations' node has has the following structure:
219
220o configurations
221 |- default = "default configuration sub-node unit name"
222 |
83840405
AP
223 o config-1 {...}
224 o config-2 {...}
3310c549
MB
225 ...
226
227
228 Optional property:
229 - default : Selects one of the configuration sub-nodes as a default
230 configuration.
231
232 Mandatory nodes:
233 - configuration-sub-node-unit-name : At least one of the configuration
234 sub-nodes is required.
235
236
2377) Configuration nodes
238----------------------
239
240Each configuration has the following structure:
241
83840405 242o config-1
3310c549
MB
243 |- description = "configuration description"
244 |- kernel = "kernel sub-node unit name"
6b54e50b 245 |- fdt = "fdt sub-node unit-name" [, "fdt overlay sub-node unit-name", ...]
ecf8cd65 246 |- loadables = "loadables sub-node unit-name"
18cfa612 247 |- compatible = "vendor,board-style device tree compatible string"
3310c549
MB
248
249
250 Mandatory properties:
251 - description : Textual configuration description.
4afc4f37
AG
252 - kernel or firmware: Unit name of the corresponding kernel or firmware
253 (u-boot, op-tee, etc) image. If both "kernel" and "firmware" are specified,
254 control is passed to the firmware image.
3310c549
MB
255
256 Optional properties:
3310c549 257 - fdt : Unit name of the corresponding fdt blob (component image node of a
6b54e50b
PA
258 "fdt type"). Additional fdt overlay nodes can be supplied which signify
259 that the resulting device tree blob is generated by the first base fdt
260 blob with all subsequent overlays applied.
ed0cea7c
MS
261 - fpga : Unit name of the corresponding fpga bitstream blob
262 (component image node of a "fpga type").
ecf8cd65
KA
263 - loadables : Unit name containing a list of additional binaries to be
264 loaded at their given locations. "loadables" is a comma-separated list
d7be5092 265 of strings. U-Boot will load each binary at its given start-address and
32f2ca2a 266 may optionally invoke additional post-processing steps on this binary based
d7be5092 267 on its component image node type.
18cfa612
JW
268 - compatible : The root compatible string of the U-Boot device tree that
269 this configuration shall automatically match when CONFIG_FIT_BEST_MATCH is
270 enabled. If this property is not provided, the compatible string will be
271 extracted from the fdt blob instead. This is only possible if the fdt is
272 not compressed, so images with compressed fdts that want to use compatible
273 string matching must always provide this property.
3310c549
MB
274
275The FDT blob is required to properly boot FDT based kernel, so the minimal
276configuration for 2.6 FDT kernel is (kernel, fdt) pair.
277
278Older, 2.4 kernel and 2.6 non-FDT kernel do not use FDT blob, in such cases
279'struct bd_info' must be passed instead of FDT blob, thus fdt property *must
280not* be specified in a configuration node.
281
282
722ebc8f
SG
2838) External data
284----------------
285
286The above format shows a 'data' property which holds the data for each image.
287It is also possible for this data to reside outside the FIT itself. This
288allows the FIT to be quite small, so that it can be loaded and scanned
289without loading a large amount of data. Then when an image is needed it can
290be loaded from an external source.
291
292In this case the 'data' property is omitted. Instead you can use:
293
294 - data-offset : offset of the data in a separate image store. The image
295 store is placed immediately after the last byte of the device tree binary,
296 aligned to a 4-byte boundary.
297 - data-size : size of the data in bytes
298
f8f9107d
TR
299The 'data-offset' property can be substituted with 'data-position', which
300defines an absolute position or address as the offset. This is helpful when
a1be94b6
PF
301booting U-Boot proper before performing relocation. Pass '-p [offset]' to
302mkimage to enable 'data-position'.
722ebc8f 303
5fd13d97
YS
304Normal kernel FIT image has data embedded within FIT structure. U-Boot image
305for SPL boot has external data. Existence of 'data-offset' can be used to
306identify which format is used.
307
ebfe611b
KY
308For FIT image with external data, it would be better to align each blob of data
309to block(512 byte) for block device, so that we don't need to do the copy when
310read the image data in SPL. Pass '-B 0x200' to mkimage to align the FIT
311structure and data to 512 byte, other values available for other align size.
312
722ebc8f 3139) Examples
3310c549
MB
314-----------
315
43142e81 316Please see doc/uImage.FIT/*.its for actual image source files.
This page took 0.54482 seconds and 4 git commands to generate.