Blame view

doc/uImage.FIT/source_file_format.txt 10.9 KB
a187559e3   Bin Meng   Use correct spell...
1
  U-Boot new uImage source file format (bindings definition)
3310c549a   Marian Balakowicz   [new uImage] Add ...
2
3
4
  ==========================================================
  
  Author: Marian Balakowicz <m8@semihalf.com>
722ebc8f8   Simon Glass   mkimage: Support ...
5
  External data additions, 25/1/16 Simon Glass <sjg@chromium.org>
3310c549a   Marian Balakowicz   [new uImage] Add ...
6
7
8
9
10
11
12
13
14
15
16
  
  1) Introduction
  ---------------
  
  Evolution of the 2.6 Linux kernel for embedded PowerPC systems introduced new
  booting method which requires that hardware description is available to the
  kernel in the form of Flattened Device Tree.
  
  Booting with a Flattened Device Tree is much more flexible and is intended to
  replace direct passing of 'struct bd_info' which was used to boot pre-FDT
  kernels.
a187559e3   Bin Meng   Use correct spell...
17
  However, U-Boot needs to support both techniques to provide backward
3310c549a   Marian Balakowicz   [new uImage] Add ...
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
  compatibility for platforms which are not FDT ready. Number of elements
  playing role in the booting process has increased and now includes the FDT
  blob. Kernel image, FDT blob and possibly ramdisk image - all must be placed
  in the system memory and passed to bootm as a arguments. Some of them may be
  missing: FDT is not present for legacy platforms, ramdisk is always optional.
  Additionally, old uImage format has been extended to support multi sub-images
  but the support is limited by simple format of the legacy uImage structure.
  Single binary header 'struct image_header' is not flexible enough to cover all
  possible scenarios.
  
  All those factors combined clearly show that there is a need for new, more
  flexible, multi component uImage format.
  
  
  2) New uImage format assumptions
  --------------------------------
  
  a) Implementation
  
  Libfdt has been selected for the new uImage format implementation as (1) it
  provides needed functionality, (2) is actively maintained and developed and
a187559e3   Bin Meng   Use correct spell...
39
  (3) increases code reuse as it is already part of the U-Boot source tree.
3310c549a   Marian Balakowicz   [new uImage] Add ...
40
41
42
43
  
  b) Terminology
  
  This document defines new uImage structure by providing FDT bindings for new
a187559e3   Bin Meng   Use correct spell...
44
45
  uImage internals. Bindings are defined from U-Boot perspective, i.e. describe
  final form of the uImage at the moment when it reaches U-Boot. User
3310c549a   Marian Balakowicz   [new uImage] Add ...
46
  perspective may be simpler, as some of the properties (like timestamps and
a187559e3   Bin Meng   Use correct spell...
47
  hashes) will need to be filled in automatically by the U-Boot mkimage tool.
3310c549a   Marian Balakowicz   [new uImage] Add ...
48
49
50
51
52
53
54
55
56
57
  
  To avoid confusion with the kernel FDT the following naming convention is
  proposed for the new uImage format related terms:
  
  FIT	- Flattened uImage Tree
  
  FIT is formally a flattened device tree (in the libfdt meaning), which
  conforms to bindings defined in this document.
  
  .its	- image tree source
486c39c2e   Andreas Dannenberg   doc: fix file ext...
58
  .itb	- flattened image tree blob
3310c549a   Marian Balakowicz   [new uImage] Add ...
59
60
61
62
63
  
  c) Image building procedure
  
  The following picture shows how the new uImage is prepared. Input consists of
  image source file (.its) and a set of data files. Image is created with the
a187559e3   Bin Meng   Use correct spell...
64
  help of standard U-Boot mkimage tool which in turn uses dtc (device tree
61ffc17ae   Masahiro Yamada   cosmetic: doc: uI...
65
  compiler) to produce image tree blob (.itb).  Resulting .itb file is the
3310c549a   Marian Balakowicz   [new uImage] Add ...
66
67
68
69
70
  actual binary of a new uImage.
  
  
  tqm5200.its
  +
438a4c112   Wolfgang Denk   Cleanup coding st...
71
  vmlinux.bin.gz	   mkimage + dtc	       xfer to target
3310c549a   Marian Balakowicz   [new uImage] Add ...
72
  eldk-4.2-ramdisk  --------------> tqm5200.itb --------------> bootm
438a4c112   Wolfgang Denk   Cleanup coding st...
73
74
75
  tqm5200.dtb			     /|\
  ...				      |
  				 'new uImage'
3310c549a   Marian Balakowicz   [new uImage] Add ...
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
  
  	- create .its file, automatically filled-in properties are omitted
  	- call mkimage tool on a .its file
  	- mkimage calls dtc to create .itb image and assures that
  	  missing properties are added
  	- .itb (new uImage) is uploaded onto the target and used therein
  
  
  d) Unique identifiers
  
  To identify FIT sub-nodes representing images, hashes, configurations (which
  are defined in the following sections), the "unit name" of the given sub-node
  is used as it's identifier as it assures uniqueness without additional
  checking required.
  
  
  3) Root node properties
  -----------------------
  
  Root node of the uImage Tree should have the following layout:
  
  / o image-tree
      |- description = "image description"
      |- timestamp = <12399321>
      |- #address-cells = <1>
      |
      o images
      | |
838404054   Andre Przywara   doc: FIT image: f...
104
105
      | o image-1 {...}
      | o image-2 {...}
3310c549a   Marian Balakowicz   [new uImage] Add ...
106
107
108
      | ...
      |
      o configurations
838404054   Andre Przywara   doc: FIT image: f...
109
        |- default = "conf-1"
3310c549a   Marian Balakowicz   [new uImage] Add ...
110
        |
838404054   Andre Przywara   doc: FIT image: f...
111
112
        o conf-1 {...}
        o conf-2 {...}
3310c549a   Marian Balakowicz   [new uImage] Add ...
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
        ...
  
  
    Optional property:
    - description : Textual description of the uImage
  
    Mandatory property:
    - timestamp : Last image modification time being counted in seconds since
      1970-01-01 00:00:00 - to be automatically calculated by mkimage tool.
  
    Conditionally mandatory property:
    - #address-cells : Number of 32bit cells required to represent entry and
      load addresses supplied within sub-image nodes. May be omitted when no
      entry or load addresses are used.
  
    Mandatory node:
    - images : This node contains a set of sub-nodes, each of them representing
      single component sub-image (like kernel, ramdisk, etc.). At least one
      sub-image is required.
  
    Optional node:
    - configurations : Contains a set of available configuration nodes and
      defines a default configuration.
  
  
  4) '/images' node
  -----------------
  
  This node is a container node for component sub-image nodes. Each sub-node of
  the '/images' node should have the following layout:
838404054   Andre Przywara   doc: FIT image: f...
143
   o image-1
3310c549a   Marian Balakowicz   [new uImage] Add ...
144
145
146
147
148
149
150
151
152
     |- description = "component sub-image description"
     |- data = /incbin/("path/to/data/file.bin")
     |- type = "sub-image type name"
     |- arch = "ARCH name"
     |- os = "OS name"
     |- compression = "compression name"
     |- load = <00000000>
     |- entry = <00000000>
     |
838404054   Andre Przywara   doc: FIT image: f...
153
154
     o hash-1 {...}
     o hash-2 {...}
3310c549a   Marian Balakowicz   [new uImage] Add ...
155
156
157
158
159
     ...
  
    Mandatory properties:
    - description : Textual description of the component sub-image
    - type : Name of component sub-image type, supported types are:
25fa0b930   Tom Rini   FIT: List kernel_...
160
161
      "standalone", "kernel", "kernel_noload", "ramdisk", "firmware", "script",
      "filesystem", "flat_dt" and others (see uimage_type in common/image.c).
3310c549a   Marian Balakowicz   [new uImage] Add ...
162
163
164
    - data : Path to the external file which contains this node's binary data.
    - compression : Compression used by included data. Supported compressions
      are "gzip" and "bzip2". If no compression is used compression property
fd15a9e25   Simon Goldschmidt   doc: FIT image: c...
165
166
167
      should be set to "none". If the data is compressed but it should not be
      uncompressed by U-Boot (e.g. compressed ramdisk), this should also be set
      to "none".
3310c549a   Marian Balakowicz   [new uImage] Add ...
168
169
  
    Conditionally mandatory property:
5cde9d8e9   Guilherme Maciel Ferreira   doc: "os" is also...
170
171
172
173
    - os : OS name, mandatory for types "kernel" and "ramdisk". Valid OS names
      are: "openbsd", "netbsd", "freebsd", "4_4bsd", "linux", "svr4", "esix",
      "solaris", "irix", "sco", "dell", "ncr", "lynxos", "vxworks", "psos", "qnx",
      "u_boot", "rtems", "unity", "integrity".
3310c549a   Marian Balakowicz   [new uImage] Add ...
174
175
176
    - arch : Architecture name, mandatory for types: "standalone", "kernel",
      "firmware", "ramdisk" and "fdt". Valid architecture names are: "alpha",
      "arm", "i386", "ia64", "mips", "mips64", "ppc", "s390", "sh", "sparc",
381197788   Simon Glass   doc: Tidy up and ...
177
178
      "sparc64", "m68k", "microblaze", "nios2", "blackfin", "avr32", "st200",
      "sandbox".
3310c549a   Marian Balakowicz   [new uImage] Add ...
179
180
181
182
183
184
185
    - entry : entry point address, address size is determined by
      '#address-cells' property of the root node. Mandatory for for types:
      "standalone" and "kernel".
    - load : load address, address size is determined by '#address-cells'
      property of the root node. Mandatory for types: "standalone" and "kernel".
  
    Optional nodes:
838404054   Andre Przywara   doc: FIT image: f...
186
    - hash-1 : Each hash sub-node represents separate hash or checksum
3310c549a   Marian Balakowicz   [new uImage] Add ...
187
188
189
190
191
      calculated for node's data according to specified algorithm.
  
  
  5) Hash nodes
  -------------
838404054   Andre Przywara   doc: FIT image: f...
192
  o hash-1
3310c549a   Marian Balakowicz   [new uImage] Add ...
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
    |- algo = "hash or checksum algorithm name"
    |- value = [hash or checksum value]
  
    Mandatory properties:
    - algo : Algorithm name, supported are "crc32", "md5" and "sha1".
    - value : Actual checksum or hash value, correspondingly 4, 16 or 20 bytes
      long.
  
  
  6) '/configurations' node
  -------------------------
  
  The 'configurations' node is optional. If present, it allows to create a
  convenient, labeled boot configurations, which combine together kernel images
  with their ramdisks and fdt blobs.
  
  The 'configurations' node has has the following structure:
  
  o configurations
    |- default = "default configuration sub-node unit name"
    |
838404054   Andre Przywara   doc: FIT image: f...
214
215
    o config-1 {...}
    o config-2 {...}
3310c549a   Marian Balakowicz   [new uImage] Add ...
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
    ...
  
  
    Optional property:
    - default : Selects one of the configuration sub-nodes as a default
      configuration.
  
    Mandatory nodes:
    - configuration-sub-node-unit-name : At least one of the configuration
      sub-nodes is required.
  
  
  7) Configuration nodes
  ----------------------
  
  Each configuration has the following structure:
838404054   Andre Przywara   doc: FIT image: f...
232
  o config-1
3310c549a   Marian Balakowicz   [new uImage] Add ...
233
234
235
    |- description = "configuration description"
    |- kernel = "kernel sub-node unit name"
    |- ramdisk = "ramdisk sub-node unit name"
6b54e50b5   Pantelis Antoniou   fit: fdt overlays...
236
    |- fdt = "fdt sub-node unit-name" [, "fdt overlay sub-node unit-name", ...]
ed0cea7c5   Michal Simek   mkimage: Report i...
237
    |- fpga = "fpga sub-node unit-name"
ecf8cd653   Karl Apsite   mkimage will now ...
238
    |- loadables = "loadables sub-node unit-name"
3310c549a   Marian Balakowicz   [new uImage] Add ...
239
240
241
242
243
244
245
246
247
248
249
  
  
    Mandatory properties:
    - description : Textual configuration description.
    - kernel : Unit name of the corresponding kernel image (image sub-node of a
      "kernel" type).
  
    Optional properties:
    - ramdisk : Unit name of the corresponding ramdisk image (component image
      node of a "ramdisk" type).
    - fdt : Unit name of the corresponding fdt blob (component image node of a
6b54e50b5   Pantelis Antoniou   fit: fdt overlays...
250
251
252
      "fdt type"). Additional fdt overlay nodes can be supplied which signify
      that the resulting device tree blob is generated by the first base fdt
      blob with all subsequent overlays applied.
90268b878   Simon Glass   x86: Support load...
253
254
    - setup : Unit name of the corresponding setup binary (used for booting
      an x86 kernel). This contains the setup.bin file built by the kernel.
ed0cea7c5   Michal Simek   mkimage: Report i...
255
256
    - fpga : Unit name of the corresponding fpga bitstream blob
      (component image node of a "fpga type").
ecf8cd653   Karl Apsite   mkimage will now ...
257
258
    - loadables : Unit name containing a list of additional binaries to be
      loaded at their given locations.  "loadables" is a comma-separated list
d7be50921   Andrew F. Davis   image: Add FIT im...
259
260
261
      of strings. U-Boot will load each binary at its given start-address and
      may optionaly invoke additional post-processing steps on this binary based
      on its component image node type.
3310c549a   Marian Balakowicz   [new uImage] Add ...
262
263
264
265
266
267
268
  
  The FDT blob is required to properly boot FDT based kernel, so the minimal
  configuration for 2.6 FDT kernel is (kernel, fdt) pair.
  
  Older, 2.4 kernel and 2.6 non-FDT kernel do not use FDT blob, in such cases
  'struct bd_info' must be passed instead of FDT blob, thus fdt property *must
  not* be specified in a configuration node.
722ebc8f8   Simon Glass   mkimage: Support ...
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
  8) External data
  ----------------
  
  The above format shows a 'data' property which holds the data for each image.
  It is also possible for this data to reside outside the FIT itself. This
  allows the FIT to be quite small, so that it can be loaded and scanned
  without loading a large amount of data. Then when an image is needed it can
  be loaded from an external source.
  
  In this case the 'data' property is omitted. Instead you can use:
  
    - data-offset : offset of the data in a separate image store. The image
      store is placed immediately after the last byte of the device tree binary,
      aligned to a 4-byte boundary.
    - data-size : size of the data in bytes
f8f9107d9   Teddy Reed   mkimage: fit: spl...
284
285
  The 'data-offset' property can be substituted with 'data-position', which
  defines an absolute position or address as the offset. This is helpful when
a1be94b65   Peng Fan   SPL: Add FIT data...
286
287
  booting U-Boot proper before performing relocation. Pass '-p [offset]' to
  mkimage to enable 'data-position'.
722ebc8f8   Simon Glass   mkimage: Support ...
288

5fd13d973   York Sun   spl: fit: Support...
289
290
291
  Normal kernel FIT image has data embedded within FIT structure. U-Boot image
  for SPL boot has external data. Existence of 'data-offset' can be used to
  identify which format is used.
722ebc8f8   Simon Glass   mkimage: Support ...
292
  9) Examples
3310c549a   Marian Balakowicz   [new uImage] Add ...
293
  -----------
43142e817   Bartlomiej Sieka   [new uImage] Fix ...
294
  Please see doc/uImage.FIT/*.its for actual image source files.