blob: 14e316f72c1eced4c033c8f59718b31fc3138577 [file] [log] [blame]
Marian Balakowicz3310c542008-03-12 12:13:13 +01001How to use images in the new image format
2=========================================
3
4Author: Bartlomiej Sieka <tur@semihalf.com>
5
6
7Overview
8--------
9
10The new uImage format allows more flexibility in handling images of various
11types (kernel, ramdisk, etc.), it also enhances integrity protection of images
12with sha1 and md5 checksums.
13
14Two auxiliary tools are needed on the development host system in order to
15create an uImage in the new format: mkimage and dtc, although only one
16(mkimage) is invoked directly. dtc is called from within mkimage and operates
17behind the scenes, but needs to be present in the $PATH nevertheless. It is
18important that the dtc used has support for binary includes -- refer to
Jon Loeliger5f658262014-05-27 09:12:48 -050019
20 git://git.kernel.org/pub/scm/utils/dtc/dtc.git
21
22for its latest version. mkimage (together with dtc) takes as input
Marian Balakowicz3310c542008-03-12 12:13:13 +010023an image source file, which describes the contents of the image and defines
24its various properties used during booting. By convention, image source file
25has the ".its" extension, also, the details of its format are given in
Masahiro Yamada09b72d62014-01-16 11:05:23 +090026doc/uImage.FIT/source_file_format.txt. The actual data that is to be included in
27the uImage (kernel, ramdisk, etc.) is specified in the image source file in the
Marian Balakowicz3310c542008-03-12 12:13:13 +010028form of paths to appropriate data files. The outcome of the image creation
29process is a binary file (by convention with the ".itb" extension) that
30contains all the referenced data (kernel, ramdisk, etc.) and other information
31needed by U-Boot to handle the uImage properly. The uImage file is then
32transferred to the target (e.g., via tftp) and booted using the bootm command.
33
34To summarize the prerequisites needed for new uImage creation:
35- mkimage
36- dtc (with support for binary includes)
37- image source file (*.its)
38- image data file(s)
39
40
41Here's a graphical overview of the image creation and booting process:
42
Wolfgang Denk438a4c12008-03-26 11:48:46 +010043image source file mkimage + dtc transfer to target
44 + ---------------> image file --------------------> bootm
Masahiro Yamada09b72d62014-01-16 11:05:23 +090045image data file(s)
Marian Balakowicz3310c542008-03-12 12:13:13 +010046
47
48Example 1 -- old-style (non-FDT) kernel booting
49-----------------------------------------------
50
51Consider a simple scenario, where a PPC Linux kernel built from sources on the
52development host is to be booted old-style (non-FDT) by U-Boot on an embedded
53target. Assume that the outcome of the build is vmlinux.bin.gz, a file which
54contains a gzip-compressed PPC Linux kernel (the only data file in this case).
Bartlomiej Sieka43142e82008-03-20 23:10:19 +010055The uImage can be produced using the image source file
56doc/uImage.FIT/kernel.its (note that kernel.its assumes that vmlinux.bin.gz is
57in the current working directory; if desired, an alternative path can be
58specified in the kernel.its file). Here's how to create the image and inspect
59its contents:
Marian Balakowicz3310c542008-03-12 12:13:13 +010060
61[on the host system]
62$ mkimage -f kernel.its kernel.itb
63DTC: dts->dtb on file "kernel.its"
64$
65$ mkimage -l kernel.itb
66FIT description: Simple image with single Linux kernel
Wolfgang Denk438a4c12008-03-26 11:48:46 +010067Created: Tue Mar 11 17:26:15 2008
Marian Balakowicz3310c542008-03-12 12:13:13 +010068 Image 0 (kernel@1)
Wolfgang Denk438a4c12008-03-26 11:48:46 +010069 Description: Vanilla Linux kernel
70 Type: Kernel Image
71 Compression: gzip compressed
72 Data Size: 943347 Bytes = 921.24 kB = 0.90 MB
Marian Balakowicz3310c542008-03-12 12:13:13 +010073 Architecture: PowerPC
Wolfgang Denk438a4c12008-03-26 11:48:46 +010074 OS: Linux
Marian Balakowicz3310c542008-03-12 12:13:13 +010075 Load Address: 0x00000000
Wolfgang Denk438a4c12008-03-26 11:48:46 +010076 Entry Point: 0x00000000
77 Hash algo: crc32
78 Hash value: 2ae2bb40
79 Hash algo: sha1
80 Hash value: 3c200f34e2c226ddc789240cca0c59fc54a67cf4
Marian Balakowicz3310c542008-03-12 12:13:13 +010081 Default Configuration: 'config@1'
82 Configuration 0 (config@1)
Wolfgang Denk438a4c12008-03-26 11:48:46 +010083 Description: Boot Linux kernel
84 Kernel: kernel@1
Marian Balakowicz3310c542008-03-12 12:13:13 +010085
86
87The resulting image file kernel.itb can be now transferred to the target,
88inspected and booted (note that first three U-Boot commands below are shown
89for completeness -- they are part of the standard booting procedure and not
90specific to the new image format).
91
92[on the target system]
93=> print nfsargs
94nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath}
95=> print addip
96addip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off panic=1
97=> run nfsargs addip
98=> tftp 900000 /path/to/tftp/location/kernel.itb
Heiko Schocher48690d82010-07-20 17:45:02 +020099Using FEC device
Marian Balakowicz3310c542008-03-12 12:13:13 +0100100TFTP from server 192.168.1.1; our IP address is 192.168.160.5
101Filename '/path/to/tftp/location/kernel.itb'.
102Load address: 0x900000
103Loading: #################################################################
104done
105Bytes transferred = 944464 (e6950 hex)
106=> iminfo
107
108## Checking Image at 00900000 ...
109 FIT image found
110 FIT description: Simple image with single Linux kernel
Wolfgang Denk438a4c12008-03-26 11:48:46 +0100111 Created: 2008-03-11 16:26:15 UTC
Marian Balakowicz3310c542008-03-12 12:13:13 +0100112 Image 0 (kernel@1)
113 Description: Vanilla Linux kernel
Wolfgang Denk438a4c12008-03-26 11:48:46 +0100114 Type: Kernel Image
Marian Balakowicz3310c542008-03-12 12:13:13 +0100115 Compression: gzip compressed
116 Data Start: 0x009000e0
117 Data Size: 943347 Bytes = 921.2 kB
118 Architecture: PowerPC
Wolfgang Denk438a4c12008-03-26 11:48:46 +0100119 OS: Linux
Marian Balakowicz3310c542008-03-12 12:13:13 +0100120 Load Address: 0x00000000
121 Entry Point: 0x00000000
122 Hash algo: crc32
123 Hash value: 2ae2bb40
124 Hash algo: sha1
125 Hash value: 3c200f34e2c226ddc789240cca0c59fc54a67cf4
126 Default Configuration: 'config@1'
127 Configuration 0 (config@1)
128 Description: Boot Linux kernel
Wolfgang Denk438a4c12008-03-26 11:48:46 +0100129 Kernel: kernel@1
Marian Balakowicz3310c542008-03-12 12:13:13 +0100130
131=> bootm
132## Booting kernel from FIT Image at 00900000 ...
133 Using 'config@1' configuration
134 Trying 'kernel@1' kernel subimage
135 Description: Vanilla Linux kernel
Wolfgang Denk438a4c12008-03-26 11:48:46 +0100136 Type: Kernel Image
Marian Balakowicz3310c542008-03-12 12:13:13 +0100137 Compression: gzip compressed
138 Data Start: 0x009000e0
139 Data Size: 943347 Bytes = 921.2 kB
140 Architecture: PowerPC
Wolfgang Denk438a4c12008-03-26 11:48:46 +0100141 OS: Linux
Marian Balakowicz3310c542008-03-12 12:13:13 +0100142 Load Address: 0x00000000
143 Entry Point: 0x00000000
144 Hash algo: crc32
145 Hash value: 2ae2bb40
146 Hash algo: sha1
147 Hash value: 3c200f34e2c226ddc789240cca0c59fc54a67cf4
148 Verifying Hash Integrity ... crc32+ sha1+ OK
149 Uncompressing Kernel Image ... OK
150Memory BAT mapping: BAT2=256Mb, BAT3=0Mb, residual: 0Mb
151Linux version 2.4.25 (m8@hekate) (gcc version 4.0.0 (DENX ELDK 4.0 4.0.0)) #2 czw lip 5 17:56:18 CEST 2007
152On node 0 totalpages: 65536
153zone(0): 65536 pages.
154zone(1): 0 pages.
155zone(2): 0 pages.
156Kernel command line: root=/dev/nfs rw nfsroot=192.168.1.1:/opt/eldk-4.1/ppc_6xx ip=192.168.160.5:192.168.1.1::255.255.0.0:lite5200b:eth0:off panic=1
157Calibrating delay loop... 307.20 BogoMIPS
158
159
160Example 2 -- new-style (FDT) kernel booting
161-------------------------------------------
162
163Consider another simple scenario, where a PPC Linux kernel is to be booted
164new-style, i.e., with a FDT blob. In this case there are two prerequisite data
165files: vmlinux.bin.gz (Linux kernel) and target.dtb (FDT blob). The uImage can
Bartlomiej Sieka43142e82008-03-20 23:10:19 +0100166be produced using image source file doc/uImage.FIT/kernel_fdt.its like this
167(note again, that both prerequisite data files are assumed to be present in
168the current working directory -- image source file kernel_fdt.its can be
169modified to take the files from some other location if needed):
Marian Balakowicz3310c542008-03-12 12:13:13 +0100170
171[on the host system]
172$ mkimage -f kernel_fdt.its kernel_fdt.itb
173DTC: dts->dtb on file "kernel_fdt.its"
174$
175$ mkimage -l kernel_fdt.itb
176FIT description: Simple image with single Linux kernel and FDT blob
Wolfgang Denk438a4c12008-03-26 11:48:46 +0100177Created: Tue Mar 11 16:29:22 2008
Marian Balakowicz3310c542008-03-12 12:13:13 +0100178 Image 0 (kernel@1)
Wolfgang Denk438a4c12008-03-26 11:48:46 +0100179 Description: Vanilla Linux kernel
180 Type: Kernel Image
181 Compression: gzip compressed
182 Data Size: 1092037 Bytes = 1066.44 kB = 1.04 MB
Marian Balakowicz3310c542008-03-12 12:13:13 +0100183 Architecture: PowerPC
Wolfgang Denk438a4c12008-03-26 11:48:46 +0100184 OS: Linux
Marian Balakowicz3310c542008-03-12 12:13:13 +0100185 Load Address: 0x00000000
Wolfgang Denk438a4c12008-03-26 11:48:46 +0100186 Entry Point: 0x00000000
187 Hash algo: crc32
188 Hash value: 2c0cc807
189 Hash algo: sha1
190 Hash value: 264b59935470e42c418744f83935d44cdf59a3bb
Marian Balakowicz3310c542008-03-12 12:13:13 +0100191 Image 1 (fdt@1)
Wolfgang Denk438a4c12008-03-26 11:48:46 +0100192 Description: Flattened Device Tree blob
193 Type: Flat Device Tree
194 Compression: uncompressed
195 Data Size: 16384 Bytes = 16.00 kB = 0.02 MB
Marian Balakowicz3310c542008-03-12 12:13:13 +0100196 Architecture: PowerPC
Wolfgang Denk438a4c12008-03-26 11:48:46 +0100197 Hash algo: crc32
198 Hash value: 0d655d71
199 Hash algo: sha1
200 Hash value: 25ab4e15cd4b8a5144610394560d9c318ce52def
Marian Balakowicz3310c542008-03-12 12:13:13 +0100201 Default Configuration: 'conf@1'
202 Configuration 0 (conf@1)
Wolfgang Denk438a4c12008-03-26 11:48:46 +0100203 Description: Boot Linux kernel with FDT blob
204 Kernel: kernel@1
205 FDT: fdt@1
Marian Balakowicz3310c542008-03-12 12:13:13 +0100206
207
208The resulting image file kernel_fdt.itb can be now transferred to the target,
209inspected and booted:
210
211[on the target system]
212=> tftp 900000 /path/to/tftp/location/kernel_fdt.itb
Heiko Schocher48690d82010-07-20 17:45:02 +0200213Using FEC device
Marian Balakowicz3310c542008-03-12 12:13:13 +0100214TFTP from server 192.168.1.1; our IP address is 192.168.160.5
215Filename '/path/to/tftp/location/kernel_fdt.itb'.
216Load address: 0x900000
217Loading: #################################################################
Wolfgang Denk438a4c12008-03-26 11:48:46 +0100218 ###########
Marian Balakowicz3310c542008-03-12 12:13:13 +0100219done
220Bytes transferred = 1109776 (10ef10 hex)
221=> iminfo
222
223## Checking Image at 00900000 ...
224 FIT image found
225 FIT description: Simple image with single Linux kernel and FDT blob
Wolfgang Denk438a4c12008-03-26 11:48:46 +0100226 Created: 2008-03-11 15:29:22 UTC
Marian Balakowicz3310c542008-03-12 12:13:13 +0100227 Image 0 (kernel@1)
228 Description: Vanilla Linux kernel
Wolfgang Denk438a4c12008-03-26 11:48:46 +0100229 Type: Kernel Image
Marian Balakowicz3310c542008-03-12 12:13:13 +0100230 Compression: gzip compressed
231 Data Start: 0x009000ec
232 Data Size: 1092037 Bytes = 1 MB
233 Architecture: PowerPC
Wolfgang Denk438a4c12008-03-26 11:48:46 +0100234 OS: Linux
Marian Balakowicz3310c542008-03-12 12:13:13 +0100235 Load Address: 0x00000000
236 Entry Point: 0x00000000
237 Hash algo: crc32
238 Hash value: 2c0cc807
239 Hash algo: sha1
240 Hash value: 264b59935470e42c418744f83935d44cdf59a3bb
241 Image 1 (fdt@1)
242 Description: Flattened Device Tree blob
Wolfgang Denk438a4c12008-03-26 11:48:46 +0100243 Type: Flat Device Tree
Marian Balakowicz3310c542008-03-12 12:13:13 +0100244 Compression: uncompressed
245 Data Start: 0x00a0abdc
246 Data Size: 16384 Bytes = 16 kB
247 Architecture: PowerPC
248 Hash algo: crc32
249 Hash value: 0d655d71
250 Hash algo: sha1
251 Hash value: 25ab4e15cd4b8a5144610394560d9c318ce52def
252 Default Configuration: 'conf@1'
253 Configuration 0 (conf@1)
254 Description: Boot Linux kernel with FDT blob
Wolfgang Denk438a4c12008-03-26 11:48:46 +0100255 Kernel: kernel@1
256 FDT: fdt@1
Marian Balakowicz3310c542008-03-12 12:13:13 +0100257=> bootm
258## Booting kernel from FIT Image at 00900000 ...
259 Using 'conf@1' configuration
260 Trying 'kernel@1' kernel subimage
261 Description: Vanilla Linux kernel
Wolfgang Denk438a4c12008-03-26 11:48:46 +0100262 Type: Kernel Image
Marian Balakowicz3310c542008-03-12 12:13:13 +0100263 Compression: gzip compressed
264 Data Start: 0x009000ec
265 Data Size: 1092037 Bytes = 1 MB
266 Architecture: PowerPC
Wolfgang Denk438a4c12008-03-26 11:48:46 +0100267 OS: Linux
Marian Balakowicz3310c542008-03-12 12:13:13 +0100268 Load Address: 0x00000000
269 Entry Point: 0x00000000
270 Hash algo: crc32
271 Hash value: 2c0cc807
272 Hash algo: sha1
273 Hash value: 264b59935470e42c418744f83935d44cdf59a3bb
274 Verifying Hash Integrity ... crc32+ sha1+ OK
275 Uncompressing Kernel Image ... OK
276## Flattened Device Tree from FIT Image at 00900000
277 Using 'conf@1' configuration
278 Trying 'fdt@1' FDT blob subimage
279 Description: Flattened Device Tree blob
Wolfgang Denk438a4c12008-03-26 11:48:46 +0100280 Type: Flat Device Tree
Marian Balakowicz3310c542008-03-12 12:13:13 +0100281 Compression: uncompressed
282 Data Start: 0x00a0abdc
283 Data Size: 16384 Bytes = 16 kB
284 Architecture: PowerPC
285 Hash algo: crc32
286 Hash value: 0d655d71
287 Hash algo: sha1
288 Hash value: 25ab4e15cd4b8a5144610394560d9c318ce52def
289 Verifying Hash Integrity ... crc32+ sha1+ OK
290 Booting using the fdt blob at 0xa0abdc
291 Loading Device Tree to 007fc000, end 007fffff ... OK
292[ 0.000000] Using lite5200 machine description
293[ 0.000000] Linux version 2.6.24-rc6-gaebecdfc (m8@hekate) (gcc version 4.0.0 (DENX ELDK 4.1 4.0.0)) #1 Sat Jan 12 15:38:48 CET 2008
294
295
296Example 3 -- advanced booting
297-----------------------------
298
Bartlomiej Sieka43142e82008-03-20 23:10:19 +0100299Refer to doc/uImage.FIT/multi.its for an image source file that allows more
Marian Balakowicz3310c542008-03-12 12:13:13 +0100300sophisticated booting scenarios (multiple kernels, ramdisks and fdt blobs).