blob: 287006279f710cef7a2f783e6465d4cedb99fa2f [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
6.B mkimage
Pali Rohár11f29d42022-02-13 01:09:46 +01007.RB [ \-T " \fItype\fP] " \-l " [\fIuimage file name\fP]"
Simon Glass80e4df82013-06-13 15:10:03 -07008
9.B mkimage
10.RB [\fIoptions\fP] " \-f [" "image tree source file" "]" " [" "uimage file name" "]"
11
12.B mkimage
Simon Glass95d77b42013-06-13 15:10:05 -070013.RB [\fIoptions\fP] " \-F [" "uimage file name" "]"
14
15.B mkimage
Simon Glass80e4df82013-06-13 15:10:03 -070016.RB [\fIoptions\fP] " (legacy mode)"
17
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090018.SH "DESCRIPTION"
19The
20.B mkimage
21command is used to create images for use with the U-Boot boot loader.
Horst Kronstorfer7aecfdd2011-12-21 04:31:23 +000022These images can contain the linux kernel, device tree blob, root file
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090023system image, firmware images etc., either separate or combined.
24
25.B mkimage
26supports two different formats:
27
Horst Kronstorfer7aecfdd2011-12-21 04:31:23 +000028The old
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090029.I legacy image
30format concatenates the individual parts (for example, kernel image,
31device tree blob and ramdisk image) and adds a 64 bytes header
32containing information about target architecture, operating system,
33image type, compression method, entry points, time stamp, checksums,
34etc.
35
Horst Kronstorfer7aecfdd2011-12-21 04:31:23 +000036The new
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090037.I FIT (Flattened Image Tree) format
Horst Kronstorfer7aecfdd2011-12-21 04:31:23 +000038allows for more flexibility in handling images of various types and also
Simon Glass80e4df82013-06-13 15:10:03 -070039enhances integrity protection of images with stronger checksums. It also
40supports verified boot.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090041
42.SH "OPTIONS"
43
44.B List image information:
45
46.TP
47.BI "\-l [" "uimage file name" "]"
48mkimage lists the information contained in the header of an existing U-Boot image.
49
Pali Rohár11f29d42022-02-13 01:09:46 +010050.TP
51.BI "\-T [" "image type" "]"
52Parse image file as type.
53Pass \-h as the image to see the list of supported image type.
54Without this option image type is autodetected.
55
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090056.P
57.B Create old legacy image:
58
59.TP
60.BI "\-A [" "architecture" "]"
Loïc Minier3f1266d2011-01-04 02:32:36 +010061Set architecture. Pass \-h as the architecture to see the list of supported architectures.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090062
63.TP
64.BI "\-O [" "os" "]"
65Set operating system. bootm command of u-boot changes boot method by os type.
Loïc Minier3f1266d2011-01-04 02:32:36 +010066Pass \-h as the OS to see the list of supported OS.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090067
68.TP
69.BI "\-T [" "image type" "]"
70Set image type.
Loïc Minier3f1266d2011-01-04 02:32:36 +010071Pass \-h as the image to see the list of supported image type.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090072
73.TP
74.BI "\-C [" "compression type" "]"
75Set compression type.
Loïc Minier3f1266d2011-01-04 02:32:36 +010076Pass \-h as the compression to see the list of supported compression type.
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090077
78.TP
Jelle van der Waa4fd096f2016-09-14 21:54:53 +020079.BI "\-a [" "load address" "]"
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090080Set load address with a hex number.
81
82.TP
83.BI "\-e [" "entry point" "]"
84Set entry point with a hex number.
85
86.TP
Simon Glass80e4df82013-06-13 15:10:03 -070087.BI "\-l"
88List the contents of an image.
89
90.TP
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +090091.BI "\-n [" "image name" "]"
92Set image name to 'image name'.
93
94.TP
95.BI "\-d [" "image data file" "]"
96Use image data from 'image data file'.
97
98.TP
99.BI "\-x"
100Set XIP (execute in place) flag.
101
102.P
103.B Create FIT image:
104
105.TP
Andreas Bießmann7a439ca2016-05-01 03:01:27 +0200106.BI "\-b [" "device tree file" "]
107Appends the device tree binary file (.dtb) to the FIT.
Simon Glassfb4cce02016-02-22 22:55:52 -0700108
109.TP
Simon Glass4f610422013-06-13 15:10:06 -0700110.BI "\-c [" "comment" "]"
111Specifies a comment to be added when signing. This is typically a useful
112message which describes how the image was signed or some other useful
113information.
114
115.TP
Horst Kronstorfer49fbf432011-12-23 05:40:20 +0000116.BI "\-D [" "dtc options" "]"
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900117Provide special options to the device tree compiler that is used to
118create the image.
119
120.TP
Simon Glass722ebc82016-02-22 22:55:53 -0700121.BI "\-E
122After processing, move the image data outside the FIT and store a data offset
123in the FIT. Images will be placed one after the other immediately after the
124FIT, with each one aligned to a 4-byte boundary. The existing 'data' property
125in each image will be replaced with 'data-offset' and 'data-size' properties.
126A 'data-offset' of 0 indicates that it starts in the first (4-byte aligned)
127byte after the FIT.
128
129.TP
Simon Glass8e35bb02016-02-22 22:55:51 -0700130.BI "\-f [" "image tree source file" " | " "auto" "]"
Horst Kronstorfer7aecfdd2011-12-21 04:31:23 +0000131Image tree source file that describes the structure and contents of the
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900132FIT image.
133
Simon Glass8e35bb02016-02-22 22:55:51 -0700134This can be automatically generated for some simple cases.
135Use "-f auto" for this. In that case the arguments -d, -A, -O, -T, -C, -a
136and -e are used to specify the image to include in the FIT and its attributes.
137No .its file is required.
138
Simon Glass80e4df82013-06-13 15:10:03 -0700139.TP
Simon Glass95d77b42013-06-13 15:10:05 -0700140.BI "\-F"
141Indicates that an existing FIT image should be modified. No dtc
Vagrant Cascadian758497c2014-11-01 18:09:01 -0700142compilation is performed and the \-f flag should not be given.
Simon Glass95d77b42013-06-13 15:10:05 -0700143This can be used to sign images with additional keys after initial image
144creation.
145
146.TP
Tomeu Vizoso0f7c6cd2016-11-04 14:22:15 +0100147.BI "\-i [" "ramdisk_file" "]"
148Appends the ramdisk file to the FIT.
149
150.TP
Simon Glass80e4df82013-06-13 15:10:03 -0700151.BI "\-k [" "key_directory" "]"
152Specifies the directory containing keys to use for signing. This directory
153should contain a private key file <name>.key for use with signing and a
154certificate <name>.crt (containing the public key) for use with verification.
155
Simon Glasse29495d2013-06-13 15:10:04 -0700156.TP
157.BI "\-K [" "key_destination" "]"
158Specifies a compiled device tree binary file (typically .dtb) to write
159public key information into. When a private key is used to sign an image,
160the corresponding public key is written into this file for for run-time
161verification. Typically the file here is the device tree binary used by
162CONFIG_OF_CONTROL in U-Boot.
163
Simon Glass399c7442013-06-13 15:10:07 -0700164.TP
Jan Kiszka5902a392022-01-14 10:21:19 +0100165.BI "\-o [" "signing algorithm" "]"
166Specifies the algorithm to be used for signing a FIT image. The default is
Jan Kiszka32a711d2022-02-05 13:19:36 +0100167taken from the signature node's 'algo' property.
Jan Kiszka5902a392022-01-14 10:21:19 +0100168
169.TP
Teddy Reedf8f91072016-06-09 19:38:02 -0700170.BI "\-p [" "external position" "]"
171Place external data at a static external position. See \-E. Instead of writing
172a 'data-offset' property defining the offset from the end of the FIT, \-p will
173use 'data-position' as the absolute position from the base of the FIT.
174
175.TP
Simon Glass399c7442013-06-13 15:10:07 -0700176.BI "\-r
177Specifies that keys used to sign the FIT are required. This means that they
178must be verified for the image to boot. Without this option, the verification
179will be optional (useful for testing but not for release).
180
Simon Glass152b2462020-07-09 18:39:43 -0600181.TP
182.BI "\-t
183Update the timestamp in the FIT.
184
185Normally the FIT timestamp is created the first time mkimage is run on a FIT,
186when converting the source .its to the binary .fit file. This corresponds to
187using the -f flag. But if the original input to mkimage is a binary file
188(already compiled) then the timestamp is assumed to have been set previously.
189
Horst Kronstorfer7aecfdd2011-12-21 04:31:23 +0000190.SH EXAMPLES
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900191
192List image information:
193.nf
194.B mkimage -l uImage
195.fi
196.P
197Create legacy image with compressed PowerPC Linux kernel:
198.nf
199.B mkimage -A powerpc -O linux -T kernel -C gzip \\\\
200.br
201.B -a 0 -e 0 -n Linux -d vmlinux.gz uImage
202.fi
203.P
204Create FIT image with compressed PowerPC Linux kernel:
205.nf
206.B mkimage -f kernel.its kernel.itb
207.fi
Simon Glasse29495d2013-06-13 15:10:04 -0700208.P
209Create FIT image with compressed kernel and sign it with keys in the
210/public/signing-keys directory. Add corresponding public keys into u-boot.dtb,
211skipping those for which keys cannot be found. Also add a comment.
212.nf
213.B mkimage -f kernel.its -k /public/signing-keys -K u-boot.dtb \\\\
Vagrant Cascadian758497c2014-11-01 18:09:01 -0700214.br
Simon Glass3837ce62016-02-22 22:55:49 -0700215.B -c """Kernel 3.8 image for production devices""" kernel.itb
Simon Glasse29495d2013-06-13 15:10:04 -0700216.fi
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900217
Simon Glass95d77b42013-06-13 15:10:05 -0700218.P
219Update an existing FIT image, signing it with additional keys.
220Add corresponding public keys into u-boot.dtb. This will resign all images
221with keys that are available in the new directory. Images that request signing
222with unavailable keys are skipped.
223.nf
224.B mkimage -F -k /secret/signing-keys -K u-boot.dtb \\\\
Vagrant Cascadian758497c2014-11-01 18:09:01 -0700225.br
Simon Glass3837ce62016-02-22 22:55:49 -0700226.B -c """Kernel 3.8 image for production devices""" kernel.itb
Simon Glass95d77b42013-06-13 15:10:05 -0700227.fi
228
Simon Glass8e35bb02016-02-22 22:55:51 -0700229.P
230Create a FIT image containing a kernel, using automatic mode. No .its file
231is required.
232.nf
233.B mkimage -f auto -A arm -O linux -T kernel -C none -a 43e00000 -e 0 \\\\
234.br
235.B -c """Kernel 4.4 image for production devices""" -d vmlinuz kernel.itb
236.fi
Simon Glassfb4cce02016-02-22 22:55:52 -0700237.P
238Create a FIT image containing a kernel and some device tree files, using
239automatic mode. No .its file is required.
240.nf
241.B mkimage -f auto -A arm -O linux -T kernel -C none -a 43e00000 -e 0 \\\\
242.br
243.B -c """Kernel 4.4 image for production devices""" -d vmlinuz \\\\
Andreas Bießmann7a439ca2016-05-01 03:01:27 +0200244.B -b /path/to/rk3288-firefly.dtb -b /path/to/rk3288-jerry.dtb kernel.itb
Simon Glassfb4cce02016-02-22 22:55:52 -0700245.fi
Simon Glass8e35bb02016-02-22 22:55:51 -0700246
Nobuhiro Iwamatsucd153552010-06-16 10:38:24 +0900247.SH HOMEPAGE
248http://www.denx.de/wiki/U-Boot/WebHome
249.PP
250.SH AUTHOR
251This manual page was written by Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Simon Glass80e4df82013-06-13 15:10:03 -0700252and Wolfgang Denk <wd@denx.de>. It was updated for image signing by
253Simon Glass <sjg@chromium.org>.