blob: 616fe4505dc66cfd790bb379aadcdb1c864f467b [file] [log] [blame]
Pali Rohár11f29d42022-02-13 01:09:46 +01001.TH MKIMAGE 1 "2022-02-07"
Sean Anderson7ec625f2022-06-25 13:12:09 -04002.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +09003.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
Sean Anderson7ec625f2022-06-25 13:12:09 -040010.
Sean Andersona5685542022-06-25 13:12:08 -040011.SY mkimage
12.RI [ option\~ .\|.\|.\&]
13.OP \-T type
14.I image-file-name
15.YS
Sean Anderson7ec625f2022-06-25 13:12:09 -040016.
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
Sean Anderson7ec625f2022-06-25 13:12:09 -040023.
Sean Andersona5685542022-06-25 13:12:08 -040024.SY mkimage
25.RI [ option\~ .\|.\|.\&]
26.BI \-F\~ image-file-name
27.YS
Sean Anderson7ec625f2022-06-25 13:12:09 -040028.
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.
Sean Anderson7ec625f2022-06-25 13:12:09 -040035.P
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090036.B mkimage
37supports two different formats:
Sean Anderson7ec625f2022-06-25 13:12:09 -040038.P
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.
Sean Anderson7ec625f2022-06-25 13:12:09 -040046.P
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.
Sean Anderson7ec625f2022-06-25 13:12:09 -040052.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090053.SH "OPTIONS"
Sean Anderson7ec625f2022-06-25 13:12:09 -040054.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090055.B List image information:
Sean Anderson7ec625f2022-06-25 13:12:09 -040056.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090057.TP
58.BI "\-l [" "uimage file name" "]"
59mkimage lists the information contained in the header of an existing U-Boot image.
Sean Anderson7ec625f2022-06-25 13:12:09 -040060.
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.
Sean Anderson7ec625f2022-06-25 13:12:09 -040066.
Sean Andersondeb26382022-04-08 16:08:39 -040067.TP
68.BI "\-q"
69Quiet. Don't print the image header on successful verification.
Sean Anderson7ec625f2022-06-25 13:12:09 -040070.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090071.P
72.B Create old legacy image:
Sean Anderson7ec625f2022-06-25 13:12:09 -040073.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090074.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.
Sean Anderson7ec625f2022-06-25 13:12:09 -040077.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090078.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.
Sean Anderson7ec625f2022-06-25 13:12:09 -040082.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090083.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.
Sean Anderson7ec625f2022-06-25 13:12:09 -040087.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090088.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.
Sean Anderson7ec625f2022-06-25 13:12:09 -040092.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090093.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.
Sean Anderson7ec625f2022-06-25 13:12:09 -040096.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090097.TP
98.BI "\-e [" "entry point" "]"
99Set entry point with a hex number.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400100.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900101.TP
Simon Glass80e4df82013-06-13 15:10:03 -0700102.BI "\-l"
103List the contents of an image.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400104.
Simon Glass80e4df82013-06-13 15:10:03 -0700105.TP
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900106.BI "\-n [" "image name" "]"
107Set image name to 'image name'.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400108.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900109.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 Anderson7ec625f2022-06-25 13:12:09 -0400137.
Sean Andersondeb26382022-04-08 16:08:39 -0400138.TP
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900139.BI "\-d [" "image data file" "]"
140Use image data from 'image data file'.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400141.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900142.TP
143.BI "\-x"
144Set XIP (execute in place) flag.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400145.
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 Anderson7ec625f2022-06-25 13:12:09 -0400150.
Sean Andersondeb26382022-04-08 16:08:39 -0400151.TP
152.BI "\-v"
153Verbose. Print file names as they are added to the image.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400154.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900155.P
156.B Create FIT image:
Sean Anderson7ec625f2022-06-25 13:12:09 -0400157.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900158.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.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400161.
Simon Glassfb4cce02016-02-22 22:55:52 -0700162.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.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400167.
Simon Glass4f610422013-06-13 15:10:06 -0700168.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.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400172.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900173.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.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400181.
Simon Glass722ebc82016-02-22 22:55:53 -0700182.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.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400186.
Sean Andersondeb26382022-04-08 16:08:39 -0400187.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.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400191.IP
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.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400196.
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.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400203.
Simon Glass95d77b42013-06-13 15:10:05 -0700204.TP
Tomeu Vizoso0f7c6cd2016-11-04 14:22:15 +0100205.BI "\-i [" "ramdisk_file" "]"
206Appends the ramdisk file to the FIT.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400207.
Tomeu Vizoso0f7c6cd2016-11-04 14:22:15 +0100208.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.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400213.
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.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400218.
Sean Anderson5920e5c2022-05-16 16:11:07 -0400219.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.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400226.
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.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400231.
Sean Andersondeb26382022-04-08 16:08:39 -0400232.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.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400238.
Sean Anderson87b0af92022-05-16 16:11:08 -0400239.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.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400243.
Jan Kiszka5902a392022-01-14 10:21:19 +0100244.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.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400249.
Teddy Reedf8f91072016-06-09 19:38:02 -0700250.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).
Sean Anderson7ec625f2022-06-25 13:12:09 -0400255.
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).
Sean Anderson7ec625f2022-06-25 13:12:09 -0400261.
Sean Andersondeb26382022-04-08 16:08:39 -0400262.TP
Simon Glass152b2462020-07-09 18:39:43 -0600263.BI "\-t
264Update the timestamp in the FIT.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400265.IP
Simon Glass152b2462020-07-09 18:39:43 -0600266Normally 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.
Sean Anderson7ec625f2022-06-25 13:12:09 -0400270.
Horst Kronstorfer7aecfdd2011-12-21 04:31:23 +0000271.SH EXAMPLES
Sean Anderson3dc1ff02022-06-25 13:12:10 -0400272.\" Reduce the width of the tab stops to something reasonable
273.ta T 1i
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900274List image information:
Sean Anderson3dc1ff02022-06-25 13:12:10 -0400275.RS
276.P
277.EX
278\fBmkimage \-l uImage
279.EE
280.RE
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900281.P
282Create legacy image with compressed PowerPC Linux kernel:
Sean Anderson3dc1ff02022-06-25 13:12:10 -0400283.RS
284.P
285.EX
286\fBmkimage \-A powerpc \-O linux \-T kernel \-C gzip \\
287 \-a 0 \-e 0 \-n Linux \-d vmlinux.gz uImage
288.EE
289.RE
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900290.P
291Create FIT image with compressed PowerPC Linux kernel:
Sean Anderson3dc1ff02022-06-25 13:12:10 -0400292.RS
293.P
294.EX
295\fBmkimage \-f kernel.its kernel.itb
296.EE
297.RE
Simon Glasse29495d2013-06-13 15:10:04 -0700298.P
299Create FIT image with compressed kernel and sign it with keys in the
Sean Anderson3dc1ff02022-06-25 13:12:10 -0400300/public/signing\-keys directory. Add corresponding public keys into u\-boot.dtb,
Simon Glasse29495d2013-06-13 15:10:04 -0700301skipping those for which keys cannot be found. Also add a comment.
Sean Anderson3dc1ff02022-06-25 13:12:10 -0400302.RS
Simon Glass95d77b42013-06-13 15:10:05 -0700303.P
Sean Anderson3dc1ff02022-06-25 13:12:10 -0400304.EX
305\fBmkimage \-f kernel.its \-k /public/signing\-keys \-K u\-boot.dtb \\
306 \-c \(dqKernel 3.8 image for production devices\(dq kernel.itb
307.EE
308.RE
309.P
310Add public keys to u\-boot.dtb without needing a FIT to sign. This will also
Sean Anderson87b0af92022-05-16 16:11:08 -0400311create a FIT containing an images node with no data named unused.itb.
Sean Anderson3dc1ff02022-06-25 13:12:10 -0400312.RS
313.P
314.EX
315\fBmkimage \-f auto \-d /dev/null \-k /public/signing\-keys \-g dev \\
316 \-o sha256,rsa2048 \-K u\-boot.dtb unused.itb
317.EE
318.RE
Sean Anderson87b0af92022-05-16 16:11:08 -0400319.P
Simon Glass95d77b42013-06-13 15:10:05 -0700320Update an existing FIT image, signing it with additional keys.
Sean Anderson3dc1ff02022-06-25 13:12:10 -0400321Add corresponding public keys into u\-boot.dtb. This will resign all images
Simon Glass95d77b42013-06-13 15:10:05 -0700322with keys that are available in the new directory. Images that request signing
323with unavailable keys are skipped.
Sean Anderson3dc1ff02022-06-25 13:12:10 -0400324.RS
325.P
326.EX
327\fBmkimage \-F \-k /secret/signing\-keys \-K u\-boot.dtb \\
328 \-c \(dqKernel 3.8 image for production devices\(dq kernel.itb
329.EE
330.RE
Simon Glass8e35bb02016-02-22 22:55:51 -0700331.P
332Create a FIT image containing a kernel, using automatic mode. No .its file
333is required.
Sean Anderson3dc1ff02022-06-25 13:12:10 -0400334.RS
335.P
336.EX
337\fBmkimage \-f auto \-A arm \-O linux \-T kernel \-C none \-a 43e00000 \-e 0 \\
338 \-c \(dqKernel 4.4 image for production devices\(dq \-d vmlinuz kernel.itb
339.EE
340.RE
Simon Glassfb4cce02016-02-22 22:55:52 -0700341.P
342Create a FIT image containing a kernel and some device tree files, using
343automatic mode. No .its file is required.
Sean Anderson3dc1ff02022-06-25 13:12:10 -0400344.RS
345.P
346.EX
347\fBmkimage \-f auto \-A arm \-O linux \-T kernel \-C none \-a 43e00000 \-e 0 \\
348 \-c \(dqKernel 4.4 image for production devices\(dq \-d vmlinuz \\
349 \-b /path/to/rk3288\-firefly.dtb \-b /path/to/rk3288\-jerry.dtb kernel.itb
350.EE
351.RE
Sean Anderson87b0af92022-05-16 16:11:08 -0400352.P
353Create a FIT image containing a signed kernel, using automatic mode. No .its
354file is required.
Sean Anderson3dc1ff02022-06-25 13:12:10 -0400355.RS
356.P
357.EX
358\fBmkimage \-f auto \-A arm \-O linux \-T kernel \-C none \-a 43e00000 \-e 0 \\
359 \-d vmlinuz \-k /secret/signing\-keys \-g dev \-o sha256,rsa2048 kernel.itb
360.EE
361.RE
Sean Anderson7ec625f2022-06-25 13:12:09 -0400362.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900363.SH HOMEPAGE
364http://www.denx.de/wiki/U-Boot/WebHome
365.PP
366.SH AUTHOR
367This manual page was written by Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Simon Glass80e4df82013-06-13 15:10:03 -0700368and Wolfgang Denk <wd@denx.de>. It was updated for image signing by
369Simon Glass <sjg@chromium.org>.