blob: f8e27ed34e81a85a14a8444ea983d41eceb573ec [file] [log] [blame]
Bin Menga1875592016-02-05 19:30:11 -08001U-Boot new uImage source file format (bindings definition)
Marian Balakowicz3310c542008-03-12 12:13:13 +01002==========================================================
3
4Author: Marian Balakowicz <m8@semihalf.com>
Simon Glass722ebc82016-02-22 22:55:53 -07005External data additions, 25/1/16 Simon Glass <sjg@chromium.org>
Marian Balakowicz3310c542008-03-12 12:13:13 +01006
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
Bin Menga1875592016-02-05 19:30:11 -080018However, U-Boot needs to support both techniques to provide backward
Marian Balakowicz3310c542008-03-12 12:13:13 +010019compatibility 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
Bin Menga1875592016-02-05 19:30:11 -080040(3) increases code reuse as it is already part of the U-Boot source tree.
Marian Balakowicz3310c542008-03-12 12:13:13 +010041
42b) Terminology
43
44This document defines new uImage structure by providing FDT bindings for new
Bin Menga1875592016-02-05 19:30:11 -080045uImage 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
Marian Balakowicz3310c542008-03-12 12:13:13 +010047perspective may be simpler, as some of the properties (like timestamps and
Bin Menga1875592016-02-05 19:30:11 -080048hashes) will need to be filled in automatically by the U-Boot mkimage tool.
Marian Balakowicz3310c542008-03-12 12:13:13 +010049
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
Andreas Dannenberg486c39c2016-03-23 17:44:17 -050059.itb - flattened image tree blob
Marian Balakowicz3310c542008-03-12 12:13:13 +010060
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
Bin Menga1875592016-02-05 19:30:11 -080065help of standard U-Boot mkimage tool which in turn uses dtc (device tree
Masahiro Yamada61ffc172013-09-13 20:28:21 +090066compiler) to produce image tree blob (.itb). Resulting .itb file is the
Marian Balakowicz3310c542008-03-12 12:13:13 +010067actual binary of a new uImage.
68
69
70tqm5200.its
71+
Wolfgang Denk438a4c12008-03-26 11:48:46 +010072vmlinux.bin.gz mkimage + dtc xfer to target
Marian Balakowicz3310c542008-03-12 12:13:13 +010073eldk-4.2-ramdisk --------------> tqm5200.itb --------------> bootm
Wolfgang Denk438a4c12008-03-26 11:48:46 +010074tqm5200.dtb /|\
75... |
76 'new uImage'
Marian Balakowicz3310c542008-03-12 12:13:13 +010077
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 | |
Andre Przywara83840402017-12-04 02:05:07 +0000105 | o image-1 {...}
106 | o image-2 {...}
Marian Balakowicz3310c542008-03-12 12:13:13 +0100107 | ...
108 |
109 o configurations
Andre Przywara83840402017-12-04 02:05:07 +0000110 |- default = "conf-1"
Marian Balakowicz3310c542008-03-12 12:13:13 +0100111 |
Andre Przywara83840402017-12-04 02:05:07 +0000112 o conf-1 {...}
113 o conf-2 {...}
Marian Balakowicz3310c542008-03-12 12:13:13 +0100114 ...
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
129 Mandatory node:
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.
133
134 Optional node:
135 - configurations : Contains a set of available configuration nodes and
136 defines a default configuration.
137
138
1394) '/images' node
140-----------------
141
142This node is a container node for component sub-image nodes. Each sub-node of
143the '/images' node should have the following layout:
144
Andre Przywara83840402017-12-04 02:05:07 +0000145 o image-1
Marian Balakowicz3310c542008-03-12 12:13:13 +0100146 |- description = "component sub-image description"
147 |- data = /incbin/("path/to/data/file.bin")
148 |- type = "sub-image type name"
149 |- arch = "ARCH name"
150 |- os = "OS name"
151 |- compression = "compression name"
152 |- load = <00000000>
153 |- entry = <00000000>
154 |
Andre Przywara83840402017-12-04 02:05:07 +0000155 o hash-1 {...}
156 o hash-2 {...}
Marian Balakowicz3310c542008-03-12 12:13:13 +0100157 ...
158
159 Mandatory properties:
160 - description : Textual description of the component sub-image
161 - type : Name of component sub-image type, supported types are:
Tom Rini25fa0b92017-07-18 14:14:19 -0400162 "standalone", "kernel", "kernel_noload", "ramdisk", "firmware", "script",
163 "filesystem", "flat_dt" and others (see uimage_type in common/image.c).
Marian Balakowicz3310c542008-03-12 12:13:13 +0100164 - data : Path to the external file which contains this node's binary data.
165 - compression : Compression used by included data. Supported compressions
166 are "gzip" and "bzip2". If no compression is used compression property
Simon Goldschmidtfd15a9e2018-07-30 12:53:18 +0200167 should be set to "none". If the data is compressed but it should not be
168 uncompressed by U-Boot (e.g. compressed ramdisk), this should also be set
169 to "none".
Marian Balakowicz3310c542008-03-12 12:13:13 +0100170
171 Conditionally mandatory property:
Guilherme Maciel Ferreira5cde9d82015-01-15 02:37:33 -0200172 - os : OS name, mandatory for types "kernel" and "ramdisk". Valid OS names
173 are: "openbsd", "netbsd", "freebsd", "4_4bsd", "linux", "svr4", "esix",
174 "solaris", "irix", "sco", "dell", "ncr", "lynxos", "vxworks", "psos", "qnx",
175 "u_boot", "rtems", "unity", "integrity".
Marian Balakowicz3310c542008-03-12 12:13:13 +0100176 - arch : Architecture name, mandatory for types: "standalone", "kernel",
177 "firmware", "ramdisk" and "fdt". Valid architecture names are: "alpha",
178 "arm", "i386", "ia64", "mips", "mips64", "ppc", "s390", "sh", "sparc",
Simon Glass38119772014-10-19 21:11:23 -0600179 "sparc64", "m68k", "microblaze", "nios2", "blackfin", "avr32", "st200",
180 "sandbox".
Marian Balakowicz3310c542008-03-12 12:13:13 +0100181 - entry : entry point address, address size is determined by
182 '#address-cells' property of the root node. Mandatory for for types:
183 "standalone" and "kernel".
184 - load : load address, address size is determined by '#address-cells'
185 property of the root node. Mandatory for types: "standalone" and "kernel".
186
187 Optional nodes:
Andre Przywara83840402017-12-04 02:05:07 +0000188 - hash-1 : Each hash sub-node represents separate hash or checksum
Marian Balakowicz3310c542008-03-12 12:13:13 +0100189 calculated for node's data according to specified algorithm.
190
191
1925) Hash nodes
193-------------
194
Andre Przywara83840402017-12-04 02:05:07 +0000195o hash-1
Marian Balakowicz3310c542008-03-12 12:13:13 +0100196 |- algo = "hash or checksum algorithm name"
197 |- value = [hash or checksum value]
198
199 Mandatory properties:
200 - algo : Algorithm name, supported are "crc32", "md5" and "sha1".
201 - value : Actual checksum or hash value, correspondingly 4, 16 or 20 bytes
202 long.
203
204
2056) '/configurations' node
206-------------------------
207
208The 'configurations' node is optional. If present, it allows to create a
209convenient, labeled boot configurations, which combine together kernel images
210with their ramdisks and fdt blobs.
211
212The 'configurations' node has has the following structure:
213
214o configurations
215 |- default = "default configuration sub-node unit name"
216 |
Andre Przywara83840402017-12-04 02:05:07 +0000217 o config-1 {...}
218 o config-2 {...}
Marian Balakowicz3310c542008-03-12 12:13:13 +0100219 ...
220
221
222 Optional property:
223 - default : Selects one of the configuration sub-nodes as a default
224 configuration.
225
226 Mandatory nodes:
227 - configuration-sub-node-unit-name : At least one of the configuration
228 sub-nodes is required.
229
230
2317) Configuration nodes
232----------------------
233
234Each configuration has the following structure:
235
Andre Przywara83840402017-12-04 02:05:07 +0000236o config-1
Marian Balakowicz3310c542008-03-12 12:13:13 +0100237 |- description = "configuration description"
238 |- kernel = "kernel sub-node unit name"
239 |- ramdisk = "ramdisk sub-node unit name"
Pantelis Antoniou6b54e502017-09-04 23:12:17 +0300240 |- fdt = "fdt sub-node unit-name" [, "fdt overlay sub-node unit-name", ...]
Michal Simeked0cea72016-05-17 13:58:44 +0200241 |- fpga = "fpga sub-node unit-name"
Karl Apsiteecf8cd62015-05-21 09:52:47 -0400242 |- loadables = "loadables sub-node unit-name"
Julius Werner18cfa612019-07-24 19:37:56 -0700243 |- compatible = "vendor,board-style device tree compatible string"
Marian Balakowicz3310c542008-03-12 12:13:13 +0100244
245
246 Mandatory properties:
247 - description : Textual configuration description.
248 - kernel : Unit name of the corresponding kernel image (image sub-node of a
249 "kernel" type).
250
251 Optional properties:
252 - ramdisk : Unit name of the corresponding ramdisk image (component image
253 node of a "ramdisk" type).
254 - fdt : Unit name of the corresponding fdt blob (component image node of a
Pantelis Antoniou6b54e502017-09-04 23:12:17 +0300255 "fdt type"). Additional fdt overlay nodes can be supplied which signify
256 that the resulting device tree blob is generated by the first base fdt
257 blob with all subsequent overlays applied.
Simon Glass90268b82014-10-19 21:11:24 -0600258 - setup : Unit name of the corresponding setup binary (used for booting
259 an x86 kernel). This contains the setup.bin file built by the kernel.
Michal Simeked0cea72016-05-17 13:58:44 +0200260 - fpga : Unit name of the corresponding fpga bitstream blob
261 (component image node of a "fpga type").
Karl Apsiteecf8cd62015-05-21 09:52:47 -0400262 - loadables : Unit name containing a list of additional binaries to be
263 loaded at their given locations. "loadables" is a comma-separated list
Andrew F. Davisd7be5092016-11-29 16:33:20 -0600264 of strings. U-Boot will load each binary at its given start-address and
265 may optionaly invoke additional post-processing steps on this binary based
266 on its component image node type.
Julius Werner18cfa612019-07-24 19:37:56 -0700267 - compatible : The root compatible string of the U-Boot device tree that
268 this configuration shall automatically match when CONFIG_FIT_BEST_MATCH is
269 enabled. If this property is not provided, the compatible string will be
270 extracted from the fdt blob instead. This is only possible if the fdt is
271 not compressed, so images with compressed fdts that want to use compatible
272 string matching must always provide this property.
Marian Balakowicz3310c542008-03-12 12:13:13 +0100273
274The FDT blob is required to properly boot FDT based kernel, so the minimal
275configuration for 2.6 FDT kernel is (kernel, fdt) pair.
276
277Older, 2.4 kernel and 2.6 non-FDT kernel do not use FDT blob, in such cases
278'struct bd_info' must be passed instead of FDT blob, thus fdt property *must
279not* be specified in a configuration node.
280
281
Simon Glass722ebc82016-02-22 22:55:53 -07002828) External data
283----------------
284
285The above format shows a 'data' property which holds the data for each image.
286It is also possible for this data to reside outside the FIT itself. This
287allows the FIT to be quite small, so that it can be loaded and scanned
288without loading a large amount of data. Then when an image is needed it can
289be loaded from an external source.
290
291In this case the 'data' property is omitted. Instead you can use:
292
293 - data-offset : offset of the data in a separate image store. The image
294 store is placed immediately after the last byte of the device tree binary,
295 aligned to a 4-byte boundary.
296 - data-size : size of the data in bytes
297
Teddy Reedf8f91072016-06-09 19:38:02 -0700298The 'data-offset' property can be substituted with 'data-position', which
299defines an absolute position or address as the offset. This is helpful when
Peng Fana1be94b2017-12-05 13:20:59 +0800300booting U-Boot proper before performing relocation. Pass '-p [offset]' to
301mkimage to enable 'data-position'.
Simon Glass722ebc82016-02-22 22:55:53 -0700302
York Sun5fd13d92017-08-15 11:14:44 -0700303Normal kernel FIT image has data embedded within FIT structure. U-Boot image
304for SPL boot has external data. Existence of 'data-offset' can be used to
305identify which format is used.
306
Simon Glass722ebc82016-02-22 22:55:53 -07003079) Examples
Marian Balakowicz3310c542008-03-12 12:13:13 +0100308-----------
309
Bartlomiej Sieka43142e82008-03-20 23:10:19 +0100310Please see doc/uImage.FIT/*.its for actual image source files.