doc: mkimage: Use empty request instead of blank lines
[platform/kernel/u-boot.git] / doc / mkimage.1
1 .TH MKIMAGE 1 "2022-02-07"
2 .
3 .SH NAME
4 mkimage \- Generate image for U-Boot
5 .SH SYNOPSIS
6 .SY mkimage
7 .OP \-T type
8 .BI \-l\~ image-file-name
9 .YS
10 .
11 .SY mkimage
12 .RI [ option\~ .\|.\|.\&]
13 .OP \-T type
14 .I image-file-name
15 .YS
16 .
17 .SY mkimage
18 .RI [ option\~ .\|.\|.\&]
19 .BI \-f\~ image-tree-source-file\c
20 .RB | auto
21 .I image-file-name
22 .YS
23 .
24 .SY mkimage
25 .RI [ option\~ .\|.\|.\&]
26 .BI \-F\~ image-file-name
27 .YS
28 .
29 .SH "DESCRIPTION"
30 The
31 .B mkimage
32 command is used to create images for use with the U-Boot boot loader.
33 These images can contain the linux kernel, device tree blob, root file
34 system image, firmware images etc., either separate or combined.
35 .P
36 .B mkimage
37 supports two different formats:
38 .P
39 The old
40 .I legacy image
41 format concatenates the individual parts (for example, kernel image,
42 device tree blob and ramdisk image) and adds a 64 bytes header
43 containing information about target architecture, operating system,
44 image type, compression method, entry points, time stamp, checksums,
45 etc.
46 .P
47 The new
48 .I FIT (Flattened Image Tree) format
49 allows for more flexibility in handling images of various types and also
50 enhances integrity protection of images with stronger checksums. It also
51 supports verified boot.
52 .
53 .SH "OPTIONS"
54 .
55 .B List image information:
56 .
57 .TP
58 .BI "\-l [" "uimage file name" "]"
59 mkimage lists the information contained in the header of an existing U-Boot image.
60 .
61 .TP
62 .BI "\-T [" "image type" "]"
63 Parse image file as type.
64 Pass \-h as the image to see the list of supported image type.
65 Without this option image type is autodetected.
66 .
67 .TP
68 .BI "\-q"
69 Quiet. Don't print the image header on successful verification.
70 .
71 .P
72 .B Create old legacy image:
73 .
74 .TP
75 .BI "\-A [" "architecture" "]"
76 Set architecture. Pass \-h as the architecture to see the list of supported architectures.
77 .
78 .TP
79 .BI "\-O [" "os" "]"
80 Set operating system. bootm command of u-boot changes boot method by os type.
81 Pass \-h as the OS to see the list of supported OS.
82 .
83 .TP
84 .BI "\-T [" "image type" "]"
85 Set image type.
86 Pass \-h as the image to see the list of supported image type.
87 .
88 .TP
89 .BI "\-C [" "compression type" "]"
90 Set compression type.
91 Pass \-h as the compression to see the list of supported compression type.
92 .
93 .TP
94 .BI "\-a [" "load address" "]"
95 Set load address with a hex number.
96 .
97 .TP
98 .BI "\-e [" "entry point" "]"
99 Set entry point with a hex number.
100 .
101 .TP
102 .BI "\-l"
103 List the contents of an image.
104 .
105 .TP
106 .BI "\-n [" "image name" "]"
107 Set image name to 'image name'.
108 .
109 .TP
110 .BI "\-R [" "secondary image name" "]"
111 Some image types support a second image for additional data. For these types,
112 use \-R to specify this second image.
113 .TS
114 allbox;
115 lb lbx
116 l l.
117 Image Type      Secondary Image Description
118 pblimage        Additional RCW-style header, typically used for PBI commands.
119 zynqimage, zynqmpimage  T{
120 Initialization parameters, one per line. Each parameter has the form
121 .sp
122 .ti 4
123 .I address data
124 .sp
125 where
126 .I address
127 and
128 .I data
129 are hexadecimal integers. The boot ROM will write each
130 .I data
131 to
132 .I address
133 when loading the image. At most 256 parameters may be specified in this
134 manner.
135 T}
136 .TE
137 .
138 .TP
139 .BI "\-d [" "image data file" "]"
140 Use image data from 'image data file'.
141 .
142 .TP
143 .BI "\-x"
144 Set XIP (execute in place) flag.
145 .
146 .TP
147 .BI "\-s"
148 Don't copy in the image data. Depending on the image type, this may create
149 just the header, everything but the image data, or nothing at all.
150 .
151 .TP
152 .BI "\-v"
153 Verbose. Print file names as they are added to the image.
154 .
155 .P
156 .B Create FIT image:
157 .
158 .TP
159 .BI "\-b [" "device tree file" "]
160 Appends the device tree binary file (.dtb) to the FIT.
161 .
162 .TP
163 .BI "\-c [" "comment" "]"
164 Specifies a comment to be added when signing. This is typically a useful
165 message which describes how the image was signed or some other useful
166 information.
167 .
168 .TP
169 .BI "\-D [" "dtc options" "]"
170 Provide special options to the device tree compiler that is used to
171 create the image.
172 .
173 .TP
174 .BI "\-E
175 After processing, move the image data outside the FIT and store a data offset
176 in the FIT. Images will be placed one after the other immediately after the
177 FIT, with each one aligned to a 4-byte boundary. The existing 'data' property
178 in each image will be replaced with 'data-offset' and 'data-size' properties.
179 A 'data-offset' of 0 indicates that it starts in the first (4-byte aligned)
180 byte after the FIT.
181 .
182 .TP
183 .BI "\-B [" "alignment" "]"
184 The alignment, in hexadecimal, that external data will be aligned to. This
185 option only has an effect when \-E is specified.
186 .
187 .TP
188 .BI "\-f [" "image tree source file" " | " "auto" "]"
189 Image tree source file that describes the structure and contents of the
190 FIT image.
191 .IP
192 This can be automatically generated for some simple cases.
193 Use "-f auto" for this. In that case the arguments -d, -A, -O, -T, -C, -a
194 and -e are used to specify the image to include in the FIT and its attributes.
195 No .its file is required.
196 .
197 .TP
198 .BI "\-F"
199 Indicates that an existing FIT image should be modified. No dtc
200 compilation is performed and the \-f flag should not be given.
201 This can be used to sign images with additional keys after initial image
202 creation.
203 .
204 .TP
205 .BI "\-i [" "ramdisk_file" "]"
206 Appends the ramdisk file to the FIT.
207 .
208 .TP
209 .BI "\-k [" "key_directory" "]"
210 Specifies the directory containing keys to use for signing. This directory
211 should contain a private key file <name>.key for use with signing and a
212 certificate <name>.crt (containing the public key) for use with verification.
213 .
214 .TP
215 .BI "\-G [" "key_file" "]"
216 Specifies the private key file to use when signing. This option may be used
217 instead of \-k.
218 .
219 .TP
220 .BI "\-K [" "key_destination" "]"
221 Specifies a compiled device tree binary file (typically .dtb) to write
222 public key information into. When a private key is used to sign an image,
223 the corresponding public key is written into this file for for run-time
224 verification. Typically the file here is the device tree binary used by
225 CONFIG_OF_CONTROL in U-Boot.
226 .
227 .TP
228 .BI "\-G [" "key_file" "]"
229 Specifies the private key file to use when signing. This option may be used
230 instead of \-k.
231 .
232 .TP
233 .BI "\-g [" "key_name_hint" "]"
234 Sets the key-name-hint property when used with \-f auto. This is the <name>
235 part of the key. The directory part is set by \-k. This option also indicates
236 that the images included in the FIT should be signed. If this option is
237 specified, \-o must be specified as well.
238 .
239 .TP
240 .BI "\-o [" "signing algorithm" "]"
241 Specifies the algorithm to be used for signing a FIT image. The default is
242 taken from the signature node's 'algo' property.
243 .
244 .TP
245 .BI "\-p [" "external position" "]"
246 Place external data at a static external position. See \-E. Instead of writing
247 a 'data-offset' property defining the offset from the end of the FIT, \-p will
248 use 'data-position' as the absolute position from the base of the FIT.
249 .
250 .TP
251 .BI "\-r"
252 Specifies that keys used to sign the FIT are required. This means that they
253 must be verified for the image to boot. Without this option, the verification
254 will be optional (useful for testing but not for release).
255 .
256 .TP
257 .BI "\-N [" "engine" "]"
258 The openssl engine to use when signing and verifying the image. For a complete list of
259 available engines, refer to
260 .BR engine (1).
261 .
262 .TP
263 .BI "\-t
264 Update the timestamp in the FIT.
265 .IP
266 Normally the FIT timestamp is created the first time mkimage is run on a FIT,
267 when converting the source .its to the binary .fit file. This corresponds to
268 using the -f flag. But if the original input to mkimage is a binary file
269 (already compiled) then the timestamp is assumed to have been set previously.
270 .
271 .SH EXAMPLES
272 .
273 List image information:
274 .nf
275 .B mkimage -l uImage
276 .fi
277 .P
278 Create legacy image with compressed PowerPC Linux kernel:
279 .nf
280 .B mkimage -A powerpc -O linux -T kernel -C gzip \\\\
281 .br
282 .B -a 0 -e 0 -n Linux -d vmlinux.gz uImage
283 .fi
284 .P
285 Create FIT image with compressed PowerPC Linux kernel:
286 .nf
287 .B mkimage -f kernel.its kernel.itb
288 .fi
289 .P
290 Create FIT image with compressed kernel and sign it with keys in the
291 /public/signing-keys directory. Add corresponding public keys into u-boot.dtb,
292 skipping those for which keys cannot be found. Also add a comment.
293 .nf
294 .B mkimage -f kernel.its -k /public/signing-keys -K u-boot.dtb \\\\
295 .br
296 .B -c """Kernel 3.8 image for production devices""" kernel.itb
297 .fi
298 .
299 .P
300 Add public keys to u-boot.dtb without needing a FIT to sign. This will also
301 create a FIT containing an images node with no data named unused.itb.
302 .nf
303 .B mkimage -f auto -d /dev/null -k /public/signing-keys -g dev \\\\
304 .br
305 .B -o sha256,rsa2048 -K u-boot.dtb unused.itb
306 .fi
307 .
308 .P
309 Update an existing FIT image, signing it with additional keys.
310 Add corresponding public keys into u-boot.dtb. This will resign all images
311 with keys that are available in the new directory. Images that request signing
312 with unavailable keys are skipped.
313 .nf
314 .B mkimage -F -k /secret/signing-keys -K u-boot.dtb \\\\
315 .br
316 .B -c """Kernel 3.8 image for production devices""" kernel.itb
317 .fi
318 .
319 .P
320 Create a FIT image containing a kernel, using automatic mode. No .its file
321 is required.
322 .nf
323 .B mkimage -f auto -A arm -O linux -T kernel -C none -a 43e00000 -e 0 \\\\
324 .br
325 .B -c """Kernel 4.4 image for production devices""" -d vmlinuz kernel.itb
326 .fi
327 .P
328 Create a FIT image containing a kernel and some device tree files, using
329 automatic mode. No .its file is required.
330 .nf
331 .B mkimage -f auto -A arm -O linux -T kernel -C none -a 43e00000 -e 0 \\\\
332 .br
333 .B -c """Kernel 4.4 image for production devices""" -d vmlinuz \\\\
334 .B -b /path/to/rk3288-firefly.dtb -b /path/to/rk3288-jerry.dtb kernel.itb
335 .fi
336 .P
337 Create a FIT image containing a signed kernel, using automatic mode. No .its
338 file is required.
339 .nf
340 .B mkimage -f auto -A arm -O linux -T kernel -C none -a 43e00000 -e 0 \\\\
341 .br
342 .B -d vmlinuz -k /secret/signing-keys -g dev -o sha256,rsa2048 kernel.itb
343 .fi
344 .
345 .SH HOMEPAGE
346 http://www.denx.de/wiki/U-Boot/WebHome
347 .PP
348 .SH AUTHOR
349 This manual page was written by Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
350 and Wolfgang Denk <wd@denx.de>. It was updated for image signing by
351 Simon Glass <sjg@chromium.org>.