blob: 7e025d092c25a1b31c3813068adf2c5ebf41ee5a [file] [log] [blame]
Pali Rohár11f29d42022-02-13 01:09:46 +01001.TH MKIMAGE 1 "2022-02-07"
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +09002
3.SH NAME
4mkimage \- Generate image for U-Boot
5.SH SYNOPSIS
Sean Andersona5685542022-06-25 13:12:08 -04006.SY mkimage
7.OP \-T type
8.BI \-l\~ image-file-name
9.YS
Simon Glass80e4df82013-06-13 15:10:03 -070010
Sean Andersona5685542022-06-25 13:12:08 -040011.SY mkimage
12.RI [ option\~ .\|.\|.\&]
13.OP \-T type
14.I image-file-name
15.YS
Simon Glass80e4df82013-06-13 15:10:03 -070016
Sean Andersona5685542022-06-25 13:12:08 -040017.SY mkimage
18.RI [ option\~ .\|.\|.\&]
19.BI \-f\~ image-tree-source-file\c
20.RB | auto
21.I image-file-name
22.YS
Simon Glass95d77b42013-06-13 15:10:05 -070023
Sean Andersona5685542022-06-25 13:12:08 -040024.SY mkimage
25.RI [ option\~ .\|.\|.\&]
26.BI \-F\~ image-file-name
27.YS
Simon Glass80e4df82013-06-13 15:10:03 -070028
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090029.SH "DESCRIPTION"
30The
31.B mkimage
32command is used to create images for use with the U-Boot boot loader.
Horst Kronstorfer7aecfdd2011-12-21 04:31:23 +000033These images can contain the linux kernel, device tree blob, root file
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090034system image, firmware images etc., either separate or combined.
35
36.B mkimage
37supports two different formats:
38
Horst Kronstorfer7aecfdd2011-12-21 04:31:23 +000039The old
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090040.I legacy image
41format concatenates the individual parts (for example, kernel image,
42device tree blob and ramdisk image) and adds a 64 bytes header
43containing information about target architecture, operating system,
44image type, compression method, entry points, time stamp, checksums,
45etc.
46
Horst Kronstorfer7aecfdd2011-12-21 04:31:23 +000047The new
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090048.I FIT (Flattened Image Tree) format
Horst Kronstorfer7aecfdd2011-12-21 04:31:23 +000049allows for more flexibility in handling images of various types and also
Simon Glass80e4df82013-06-13 15:10:03 -070050enhances integrity protection of images with stronger checksums. It also
51supports verified boot.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090052
53.SH "OPTIONS"
54
55.B List image information:
56
57.TP
58.BI "\-l [" "uimage file name" "]"
59mkimage lists the information contained in the header of an existing U-Boot image.
60
Pali Rohár11f29d42022-02-13 01:09:46 +010061.TP
62.BI "\-T [" "image type" "]"
63Parse image file as type.
64Pass \-h as the image to see the list of supported image type.
65Without this option image type is autodetected.
66
Sean Andersondeb26382022-04-08 16:08:39 -040067.TP
68.BI "\-q"
69Quiet. Don't print the image header on successful verification.
70
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090071.P
72.B Create old legacy image:
73
74.TP
75.BI "\-A [" "architecture" "]"
Loïc Minier3f1266d2011-01-04 02:32:36 +010076Set architecture. Pass \-h as the architecture to see the list of supported architectures.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090077
78.TP
79.BI "\-O [" "os" "]"
80Set operating system. bootm command of u-boot changes boot method by os type.
Loïc Minier3f1266d2011-01-04 02:32:36 +010081Pass \-h as the OS to see the list of supported OS.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090082
83.TP
84.BI "\-T [" "image type" "]"
85Set image type.
Loïc Minier3f1266d2011-01-04 02:32:36 +010086Pass \-h as the image to see the list of supported image type.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090087
88.TP
89.BI "\-C [" "compression type" "]"
90Set compression type.
Loïc Minier3f1266d2011-01-04 02:32:36 +010091Pass \-h as the compression to see the list of supported compression type.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090092
93.TP
Jelle van der Waa4fd096f2016-09-14 21:54:53 +020094.BI "\-a [" "load address" "]"
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090095Set load address with a hex number.
96
97.TP
98.BI "\-e [" "entry point" "]"
99Set entry point with a hex number.
100
101.TP
Simon Glass80e4df82013-06-13 15:10:03 -0700102.BI "\-l"
103List the contents of an image.
104
105.TP
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900106.BI "\-n [" "image name" "]"
107Set image name to 'image name'.
108
109.TP
Sean Andersondeb26382022-04-08 16:08:39 -0400110.BI "\-R [" "secondary image name" "]"
111Some image types support a second image for additional data. For these types,
112use \-R to specify this second image.
Sean Anderson5920e5c2022-05-16 16:11:07 -0400113.TS
114allbox;
115lb lbx
116l l.
117Image Type Secondary Image Description
118pblimage Additional RCW-style header, typically used for PBI commands.
119zynqimage, zynqmpimage T{
120Initialization parameters, one per line. Each parameter has the form
121.sp
122.ti 4
123.I address data
124.sp
125where
126.I address
127and
128.I data
129are hexadecimal integers. The boot ROM will write each
130.I data
131to
132.I address
133when loading the image. At most 256 parameters may be specified in this
134manner.
135T}
136.TE
Sean Andersondeb26382022-04-08 16:08:39 -0400137
138.TP
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900139.BI "\-d [" "image data file" "]"
140Use image data from 'image data file'.
141
142.TP
143.BI "\-x"
144Set XIP (execute in place) flag.
145
Sean Andersondeb26382022-04-08 16:08:39 -0400146.TP
147.BI "\-s"
Sean Anderson5920e5c2022-05-16 16:11:07 -0400148Don't copy in the image data. Depending on the image type, this may create
149just the header, everything but the image data, or nothing at all.
Sean Andersondeb26382022-04-08 16:08:39 -0400150
151.TP
152.BI "\-v"
153Verbose. Print file names as they are added to the image.
154
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900155.P
156.B Create FIT image:
157
158.TP
Andreas Bießmann7a439ca2016-05-01 03:01:27 +0200159.BI "\-b [" "device tree file" "]
160Appends the device tree binary file (.dtb) to the FIT.
Simon Glassfb4cce02016-02-22 22:55:52 -0700161
162.TP
Simon Glass4f610422013-06-13 15:10:06 -0700163.BI "\-c [" "comment" "]"
164Specifies a comment to be added when signing. This is typically a useful
165message which describes how the image was signed or some other useful
166information.
167
168.TP
Horst Kronstorfer49fbf432011-12-23 05:40:20 +0000169.BI "\-D [" "dtc options" "]"
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900170Provide special options to the device tree compiler that is used to
171create the image.
172
173.TP
Simon Glass722ebc82016-02-22 22:55:53 -0700174.BI "\-E
175After processing, move the image data outside the FIT and store a data offset
176in the FIT. Images will be placed one after the other immediately after the
177FIT, with each one aligned to a 4-byte boundary. The existing 'data' property
178in each image will be replaced with 'data-offset' and 'data-size' properties.
179A 'data-offset' of 0 indicates that it starts in the first (4-byte aligned)
180byte after the FIT.
181
182.TP
Sean Andersondeb26382022-04-08 16:08:39 -0400183.BI "\-B [" "alignment" "]"
184The alignment, in hexadecimal, that external data will be aligned to. This
185option only has an effect when \-E is specified.
186
187.TP
Simon Glass8e35bb02016-02-22 22:55:51 -0700188.BI "\-f [" "image tree source file" " | " "auto" "]"
Horst Kronstorfer7aecfdd2011-12-21 04:31:23 +0000189Image tree source file that describes the structure and contents of the
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900190FIT image.
191
Simon Glass8e35bb02016-02-22 22:55:51 -0700192This can be automatically generated for some simple cases.
193Use "-f auto" for this. In that case the arguments -d, -A, -O, -T, -C, -a
194and -e are used to specify the image to include in the FIT and its attributes.
195No .its file is required.
196
Simon Glass80e4df82013-06-13 15:10:03 -0700197.TP
Simon Glass95d77b42013-06-13 15:10:05 -0700198.BI "\-F"
199Indicates that an existing FIT image should be modified. No dtc
Vagrant Cascadian758497c2014-11-01 18:09:01 -0700200compilation is performed and the \-f flag should not be given.
Simon Glass95d77b42013-06-13 15:10:05 -0700201This can be used to sign images with additional keys after initial image
202creation.
203
204.TP
Tomeu Vizoso0f7c6cd2016-11-04 14:22:15 +0100205.BI "\-i [" "ramdisk_file" "]"
206Appends the ramdisk file to the FIT.
207
208.TP
Simon Glass80e4df82013-06-13 15:10:03 -0700209.BI "\-k [" "key_directory" "]"
210Specifies the directory containing keys to use for signing. This directory
211should contain a private key file <name>.key for use with signing and a
212certificate <name>.crt (containing the public key) for use with verification.
213
Simon Glasse29495d2013-06-13 15:10:04 -0700214.TP
Sean Anderson5920e5c2022-05-16 16:11:07 -0400215.BI "\-G [" "key_file" "]"
216Specifies the private key file to use when signing. This option may be used
217instead of \-k.
218
219.TP
Simon Glasse29495d2013-06-13 15:10:04 -0700220.BI "\-K [" "key_destination" "]"
221Specifies a compiled device tree binary file (typically .dtb) to write
222public key information into. When a private key is used to sign an image,
223the corresponding public key is written into this file for for run-time
224verification. Typically the file here is the device tree binary used by
225CONFIG_OF_CONTROL in U-Boot.
226
Simon Glass399c7442013-06-13 15:10:07 -0700227.TP
Sean Andersondeb26382022-04-08 16:08:39 -0400228.BI "\-G [" "key_file" "]"
229Specifies the private key file to use when signing. This option may be used
230instead of \-k.
231
232.TP
Sean Anderson87b0af92022-05-16 16:11:08 -0400233.BI "\-g [" "key_name_hint" "]"
234Sets the key-name-hint property when used with \-f auto. This is the <name>
235part of the key. The directory part is set by \-k. This option also indicates
236that the images included in the FIT should be signed. If this option is
237specified, \-o must be specified as well.
238
239.TP
Jan Kiszka5902a392022-01-14 10:21:19 +0100240.BI "\-o [" "signing algorithm" "]"
241Specifies the algorithm to be used for signing a FIT image. The default is
Jan Kiszka32a711d2022-02-05 13:19:36 +0100242taken from the signature node's 'algo' property.
Jan Kiszka5902a392022-01-14 10:21:19 +0100243
244.TP
Teddy Reedf8f91072016-06-09 19:38:02 -0700245.BI "\-p [" "external position" "]"
246Place external data at a static external position. See \-E. Instead of writing
247a 'data-offset' property defining the offset from the end of the FIT, \-p will
248use 'data-position' as the absolute position from the base of the FIT.
249
250.TP
Sean Andersondeb26382022-04-08 16:08:39 -0400251.BI "\-r"
Simon Glass399c7442013-06-13 15:10:07 -0700252Specifies that keys used to sign the FIT are required. This means that they
253must be verified for the image to boot. Without this option, the verification
254will be optional (useful for testing but not for release).
255
Simon Glass152b2462020-07-09 18:39:43 -0600256.TP
Sean Andersondeb26382022-04-08 16:08:39 -0400257.BI "\-N [" "engine" "]"
258The openssl engine to use when signing and verifying the image. For a complete list of
259available engines, refer to
260.BR engine (1).
261
262.TP
Simon Glass152b2462020-07-09 18:39:43 -0600263.BI "\-t
264Update the timestamp in the FIT.
265
266Normally the FIT timestamp is created the first time mkimage is run on a FIT,
267when converting the source .its to the binary .fit file. This corresponds to
268using 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
Horst Kronstorfer7aecfdd2011-12-21 04:31:23 +0000271.SH EXAMPLES
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900272
273List image information:
274.nf
275.B mkimage -l uImage
276.fi
277.P
278Create 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
285Create FIT image with compressed PowerPC Linux kernel:
286.nf
287.B mkimage -f kernel.its kernel.itb
288.fi
Simon Glasse29495d2013-06-13 15:10:04 -0700289.P
290Create 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,
292skipping 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 \\\\
Vagrant Cascadian758497c2014-11-01 18:09:01 -0700295.br
Simon Glass3837ce62016-02-22 22:55:49 -0700296.B -c """Kernel 3.8 image for production devices""" kernel.itb
Simon Glasse29495d2013-06-13 15:10:04 -0700297.fi
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900298
Simon Glass95d77b42013-06-13 15:10:05 -0700299.P
Sean Anderson87b0af92022-05-16 16:11:08 -0400300Add public keys to u-boot.dtb without needing a FIT to sign. This will also
301create 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
Simon Glass95d77b42013-06-13 15:10:05 -0700309Update an existing FIT image, signing it with additional keys.
310Add corresponding public keys into u-boot.dtb. This will resign all images
311with keys that are available in the new directory. Images that request signing
312with unavailable keys are skipped.
313.nf
314.B mkimage -F -k /secret/signing-keys -K u-boot.dtb \\\\
Vagrant Cascadian758497c2014-11-01 18:09:01 -0700315.br
Simon Glass3837ce62016-02-22 22:55:49 -0700316.B -c """Kernel 3.8 image for production devices""" kernel.itb
Simon Glass95d77b42013-06-13 15:10:05 -0700317.fi
318
Simon Glass8e35bb02016-02-22 22:55:51 -0700319.P
320Create a FIT image containing a kernel, using automatic mode. No .its file
321is 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
Simon Glassfb4cce02016-02-22 22:55:52 -0700327.P
328Create a FIT image containing a kernel and some device tree files, using
329automatic 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 \\\\
Andreas Bießmann7a439ca2016-05-01 03:01:27 +0200334.B -b /path/to/rk3288-firefly.dtb -b /path/to/rk3288-jerry.dtb kernel.itb
Simon Glassfb4cce02016-02-22 22:55:52 -0700335.fi
Sean Anderson87b0af92022-05-16 16:11:08 -0400336.P
337Create a FIT image containing a signed kernel, using automatic mode. No .its
338file 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
Simon Glass8e35bb02016-02-22 22:55:51 -0700344
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900345.SH HOMEPAGE
346http://www.denx.de/wiki/U-Boot/WebHome
347.PP
348.SH AUTHOR
349This manual page was written by Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Simon Glass80e4df82013-06-13 15:10:03 -0700350and Wolfgang Denk <wd@denx.de>. It was updated for image signing by
351Simon Glass <sjg@chromium.org>.