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