1 .\" SPDX-License-Identifier: GPL-2.0
2 .\" Copyright (C) 2022 Sean Anderson <seanga2@gmail.com>
3 .\" Copyright (C) 2013-20 Simon Glass <sjg@chromium.org>
4 .\" Copyright (C) 2010 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
5 .\" Copyright (C) 2010 Wolfgang Denk <wd@denx.de>
6 .TH MKIMAGE 1 2022-06-11 U-Boot
9 mkimage \- generate images for U-Boot
13 .BI \-l\~ image-file-name
17 .RI [ option\~ .\|.\|.\&]
23 .RI [ option\~ .\|.\|.\&]
24 .BI \-f\~ image-tree-source-file\c
31 .RI [ option\~ .\|.\|.\&]
32 .BI \-F\~ image-file-name
38 command is used to create images for use with the U-Boot boot loader. These
39 images can contain the Linux kernel, device tree blob, root file system image,
40 firmware images etc., either separate or combined.
43 supports many image formats. Some of these formats may be used by embedded boot
44 firmware to load U-Boot. Others may be used by U-Boot to load Linux (or some
47 The legacy image format concatenates the individual parts (for example, kernel
48 image, device tree blob and ramdisk image) and adds a 64 byte header containing
49 information about the target architecture, operating system, image type,
50 compression method, entry points, time stamp, checksums, etc.
54 (Flattened Image Tree) format allows for more flexibility in handling images of
55 various types and also enhances integrity protection of images with stronger
56 checksums. It also supports verified boot.
66 Print a help message and exit.
73 lists the information contained in the header of an existing U-Boot image.
79 Don't copy in the image data. Depending on the image type, this may create
80 just the header, everything but the image data, or nothing at all.
85 .BI \-\-type " image-type"
92 to see the list of supported image types. If this option is absent, then it
95 (legacy image). If this option is absent when
99 will attempt to automatically detect the image type. Not all image types support
100 automatic detection, so it may be necessary to pass
104 When creating a FIT image with
106 the image type is always set to
110 specifies the image node's \(oqtype\(cq property. If
112 is absent, then the \(oqtype\(cq property will default to
119 Quiet. Don't print the image header.
125 Verbose. Print file names as they are added to the image.
131 Print version information and exit.
133 .SS General image-creation options
136 .BI \-A " architecture"
138 .BI \-\-architecture " architecture"
139 Set the architecture. Pass
141 as the architecture to see the list of supported architectures. If
143 is absent, it defaults to
150 Set the operating system. The U-Boot
152 command changes boot method based on the OS type.
157 to see the list of supported OSs. If
159 is absent, it defaults to
163 .BI \-C " compression-type"
165 .BI \-\-compression " compression-type"
166 Set the compression type. The image data should have already been compressed
167 using this compression type.
169 will not automatically compress image data.
174 to see the list of supported compression types. If
176 is absent, it defaults to
180 .BI \-a " load-address"
182 .BI \-\-load\-address " load-address"
183 Set the absolute address to load the image data to.
185 will be interpreted as a hexadecimal number.
188 .BI \-e " entry-point"
190 .BI \-\-entry\-point " entry-point"
191 Set the absolute address of the image entry point. The U-Boot
193 command will jump to this address after loading the image.
195 will be interpreted as a hexadecimal number.
198 .BI \-n " primary-configuration"
200 .BI \-\-config " primary-configuration"
201 Images may require additional configuration not specified with other options,
202 often in a image-type-specific format. The image types which support this
203 option and the format of their configuration are listed in
207 .BI \-R " secondary-configuration"
209 .BI \-\-secondary\-config " secondary-configuration"
210 Some image types support a second set of configuration data. The image types
211 which support secondary configuration and the formap of their configuration are
216 .BI \-d " image-data-file"
218 .BI \-\-image " image-data-file"
220 .IR image-data-file .
225 then multiple images may be specified, separated by colons:
228 .IR image-data-file [\fB:\fP image-data-file .\|.\|.]
237 (execute in place) flag. The U-Boot
239 command will not load the image data, and instead will assume it is already
240 accessible at the load address (such as via memory-mapped flash).
242 .SS Options for creating FIT images
245 .BI \-b " device-tree-file"
247 .BI \-\-device\-tree " device-tree-file"
248 Appends the device tree binary file (.dtb) to the FIT.
253 .BI \-\-comment " comment"
254 Specifies a comment to be added when signing. This is typically a message which
255 describes how the image was signed or some other useful information.
258 .BI \-D " dtc-options"
260 .BI \-\-dtcopts " dtc-options"
261 Provide additional options to the device tree compiler when creating the image.
264 for documentation of possible options. If
266 is absent, it defaults to
267 .BR "\-I dts \-O dtb \-p 500" .
273 After processing, move the image data outside the FIT and store a data offset
274 in the FIT. Images will be placed one after the other immediately after the FIT,
275 with each one aligned to a 4-byte boundary. The existing \(oqdata\(cq property
276 in each image will be replaced with \(oqdata-offset\(cq and \(oqdata-size\(cq
277 properties. A \(oqdata-offset\(cq of 0 indicates that it starts in the first
278 (4-byte-aligned) byte after the FIT.
283 .BI \-\-alignment " alignment"
284 The alignment, in hexadecimal, that external data will be aligned to. This
285 option only has an effect when \-E is specified.
288 .BI \-p " external-position"
290 .BI \-\-position " external-position"
291 Place external data at a static external position. Instead of writing a
292 \(oqdata-offset\(cq property defining the offset from the end of the FIT,
294 will use \(oqdata-position\(cq as the absolute position from the base of the
297 for details on using external data.
300 \fB\-f \fIimage-tree-source-file\fR | \fBauto\fR | \fBauto-conf
302 \fB\-\-fit \fIimage-tree-source-file\fR | \fBauto\fR | \fBauto-conf
303 Image tree source file that describes the structure and contents of the
306 In some simple cases, the image tree source can be generated automatically. To
307 use this feature, pass
318 options may be used to specify the image to include in the FIT and its
320 .I image-tree-source-file
328 options may be used to get \(oqimages\(cq signed subnodes in the generated
329 auto FIT. Instead, to get \(oqconfigurations\(cq signed subnodes and
330 \(oqimages\(cq hashed subnodes, pass
339 are mandatory options.
345 Indicates that an existing FIT image should be modified. No dtc compilation will
348 should not be passed. This can be used to sign images with additional keys
349 after initial image creation.
352 .BI \-i " ramdisk-file"
354 .BI \-\-initramfs " ramdisk-file"
355 Append a ramdisk or initramfs file to the image.
358 .BI \-k " key-directory"
360 .BI \-\-key\-dir " key-directory"
361 Specifies the directory containing keys to use for signing. This directory
362 should contain a private key file
364 for use with signing, and a certificate
366 (containing the public key) for use with verification. The public key is only
367 necessary when embedding it into another device tree using
370 is the value of the signature node's \(oqkey-name-hint\(cq property.
375 .BI \-\-key\-file " key-file"
376 Specifies the private key file to use when signing. This option may be used
377 instead of \-k. Useful when the private key file basename does not match
378 \(oqkey-name-hint\(cq value. But note that it may lead to unexpected results
379 when used together with -K and/or -k options.
382 .BI \-K " key-destination"
384 .BI \-\-key\-dest " key-destination"
385 Specifies a compiled device tree binary file (typically .dtb) to write
386 public key information into. When a private key is used to sign an image,
387 the corresponding public key is written into this file for for run-time
388 verification. Typically the file here is the device tree binary used by
389 CONFIG_OF_CONTROL in U-Boot.
392 .BI \-g " key-name-hint"
394 .BI \-\-key\-name\-hint " key-name-hint"
395 Specifies the value of signature node \(oqkey-name-hint\(cq property for
396 an automatically generated FIT image. It makes sense only when used with
400 This option also indicates that the images or configurations included in
401 the FIT should be signed. If this option is specified, then
403 must be specified as well.
406 .BI \-o " checksum" , crypto
408 .BI \-\-algo " checksum" , crypto
409 Specifies the algorithm to be used for signing a FIT image, overriding value
410 taken from the signature node \(oqalgo\(cq property in the
411 .IR image-tree-source-file .
412 It is mandatory for automatically generated FIT.
446 Specifies that keys used to sign the FIT are required. This means that images
447 or configurations signatures must be verified before using them (i.e. to
448 boot). Without this option, the verification will be optional (useful for
449 testing but not for release). It makes sense only when used with
451 When both, images and configurations, are signed, \(oqrequired\(cq property
452 value will be "conf".
457 .BI \-\-engine " engine"
458 The openssl engine to use when signing and verifying the image. For a complete
459 list of available engines, refer to
466 Update the timestamp in the FIT.
468 Normally the FIT timestamp is created the first time mkimage runs,
469 when converting the source .its to the binary .fit file. This corresponds to
472 But if the original input to mkimage is a binary file (already compiled), then
473 the timestamp is assumed to have been set previously.
476 This section documents the formats of the primary and secondary configuration
477 options for each image type which supports them.
480 The primary configuration is a file containing a series of
482 (Application Image Script) commands, one per line. Each command has the form
485 .IR "command argument " .\|.\|.
489 .UR https://\:www\:.ti\:.com/\:lit/\:pdf/\:spraag0
490 TI application report SPRAAG0E
495 The primary configuration is a comma-separated list of NAND Flash parameters of
499 \fIparameter\fB=\fIvalue\fR[\fB,\fIparameter\fB=\fIvalue\fR.\|.\|.\&]
520 are decimal numbers. See section 11.4.4.1 of the SAMA5D3 Series Data Sheet for
521 valid values for each parameter.
524 The primary configuration is a file containing configuration commands, as
525 documented in doc/\:imx/\:mkimage/\:imximage.txt of the U-Boot source.
527 .SS imx8image and imx8mimage
528 The primary configuration is a file containing configuration commands, as
529 documented in doc/\:imx/\:mkimage/\:imx8image.txt of the U-Boot source.
532 The primary configuration is a file containing configuration commands, as
533 documented in doc/\:imx/\:mkimage/\:kwbimage.txt of the U-Boot source.
536 The primary configuration is a semicolon-separated list of header options of the
540 \fIkey\fB=\fIvalue\fR[\fB;\fIkey\fB=\fIvalue\fR.\|.\|.\&]
543 where the valid keys are:
552 If \fB1\fP, then an \fILK\fP (legacy) image header is used. Otherwise, a
553 \fIBootROM\fP image header is used.
556 The name of the LK image header. The maximum length is 32 ASCII characters. If
557 not specified, the default value is \fBU-Boot\fP.
559 media The boot device. See below for valid values.
560 nandinfo The desired NAND device type. See below for valid values.
561 arm64 If \fB1\fP, then this denotes an AArch64 image.
562 hdroffset Increase the reported size of the BRLYT header by this amount.
576 nand Parallel NAND flash
577 snand Serial NAND flash
579 emmc \fIeMMC\fP (Embedded Multi-Media Card)
580 sdmmc \fISD\fP (Secure Digital) card
592 Value NAND type Page size OOB size Total size
594 2k+64 Serial 2KiB 64B
595 2k+120 Serial 2KiB 120B
596 2k+128 Serial 2KiB 128B
597 4k+256 Serial 4KiB 256B
598 1g:2k+64 Parallel 2KiB 64B 1Gbit
599 2g:2k+64 Parallel 2KiB 64B 2Gbit
600 4g:2k+64 Parallel 2KiB 64B 4Gbit
601 2g:2k+128 Parallel 2KiB 128B 2Gbit
602 4g:2k+128 Parallel 2KiB 128B 4Gbit
607 The primary configuration is a file containing configuration commands, as
608 documented in doc/\:imx/\:mkimage/\:mxsimage.txt of the U-Boot source.
611 The primary configuration is the optional value
613 If present, each 32-bit word of the image will have its bytes swapped
614 (converting from little-endian to big-endian, or vice versa).
617 The primary configuration is a file containing the
619 (Pre-Boot Image) header. Each line of the configuration has the format
622 .IR value "[ " value .\|.\|.\&]
627 is a 32-bit hexadecimal integer. Each
629 will, after being converted to raw bytes, be literally prepended to the PBI.
631 The secondary configuration is a file with the same format as the primary
632 configuration file. It will be inserted into the image after the primary
633 configuration data and before the image data.
635 It is traditional to use the primary configuration file for the
637 (Reset Configuration Word), and the secondary configuration file for any
638 additional PBI commands. However, it is also possible to convert an existing PBI
639 to the above format and \(lqchain\(rq additional data onto the end of the
640 image. This may be especially useful for creating secure boot images.
643 The primary configuration is the name of the processor to generate the image
644 for. Valid values are:
666 The primary configuration file consists of lines containing key/value pairs
667 delimited by whitespace. An example follows.
671 # Comments and blank lines may be used
679 types are as follows.
683 .B NAND_ECC_BLOCK_SIZE
689 .B NAND_BYTES_PER_ECC_BLOCK
690 These all take a positive integer value as their argument.
691 The value will be copied directly into the respective field
692 of the SPKG header structure. For details on these values,
693 refer to Section 7.4 of the Renesas RZ/N1 User's Manual.
697 Takes a numeric argument, which is treated as a boolean. Any nonzero
698 value will cause a fake BLp security header to be included in the SPKG
703 Takes a positive integer value, with an optional
707 suffix, indicating KiB / MiB respectively.
708 The output SPKG file will be padded to a multiple of this value.
711 The primary configuration is the name to use for the device tree.
714 The primary configuration is a file containing configuration commands, as
715 documented in doc/\:README.ublimage of the U-Boot source.
717 .SS zynqimage and zynqmpimage
720 the primary configuration is a file containing the
722 (Power Management Unit Firmware).
724 does not use the primary configuration.
726 For both image types, the secondary configuration is a file containinig
727 initialization parameters, one per line. Each parameter has the form
737 are hexadecimal integers. The boot ROM will write each
741 when loading the image. At most 256 parameters may be specified in this
745 Please report bugs to the
746 .UR https://\:source\:.denx\:.de/\:u-boot/\:u-boot/\:issues
750 .\" Reduce the width of the tab stops to something reasonable
752 List image information:
756 \fBmkimage \-l uImage
760 Create legacy image with compressed PowerPC Linux kernel:
764 \fBmkimage \-A powerpc \-O linux \-T kernel \-C gzip \\
765 \-a 0 \-e 0 \-n Linux \-d vmlinux.gz uImage
769 Create FIT image with compressed PowerPC Linux kernel:
773 \fBmkimage \-f kernel.its kernel.itb
777 Create FIT image with compressed kernel and sign it with keys in the
778 /public/signing\-keys directory. Add corresponding public keys into u\-boot.dtb,
779 skipping those for which keys cannot be found. Also add a comment.
783 \fBmkimage \-f kernel.its \-k /public/signing\-keys \-K u\-boot.dtb \\
784 \-c \(dqKernel 3.8 image for production devices\(dq kernel.itb
788 Add public key to u\-boot.dtb without needing a FIT to sign. This will also
789 create a FIT containing an images node with no data named unused.itb.
793 \fBmkimage \-f auto \-d /dev/null \-k /public/signing\-keys \-g dev \\
794 \-o sha256,rsa2048 \-K u\-boot.dtb unused.itb
798 Add public key with required = "conf" property to u\-boot.dtb without needing
799 a FIT to sign. This will also create a useless FIT named unused.itb.
803 \fBmkimage \-f auto-conf \-d /dev/null \-k /public/signing\-keys \-g dev \\
804 \-o sha256,rsa2048 \-K u\-boot.dtb -r unused.itb
808 Update an existing FIT image, signing it with additional keys.
809 Add corresponding public keys into u\-boot.dtb. This will resign all images
810 with keys that are available in the new directory. Images that request signing
811 with unavailable keys are skipped.
815 \fBmkimage \-F \-k /secret/signing\-keys \-K u\-boot.dtb \\
816 \-c \(dqKernel 3.8 image for production devices\(dq kernel.itb
820 Create a FIT image containing a kernel, using automatic mode. No .its file
825 \fBmkimage \-f auto \-A arm \-O linux \-T kernel \-C none \-a 43e00000 \-e 0 \\
826 \-c \(dqKernel 4.4 image for production devices\(dq \-d vmlinuz kernel.itb
830 Create a FIT image containing a kernel and some device tree files, using
831 automatic mode. No .its file is required.
835 \fBmkimage \-f auto \-A arm \-O linux \-T kernel \-C none \-a 43e00000 \-e 0 \\
836 \-c \(dqKernel 4.4 image for production devices\(dq \-d vmlinuz \\
837 \-b /path/to/rk3288\-firefly.dtb \-b /path/to/rk3288\-jerry.dtb kernel.itb
841 Create a FIT image containing a signed kernel, using automatic mode. No .its
846 \fBmkimage \-f auto \-A arm \-O linux \-T kernel \-C none \-a 43e00000 \-e 0 \\
847 \-d vmlinuz \-k /secret/signing\-keys \-g dev \-o sha256,rsa2048 kernel.itb
851 Create a FIT image containing a kernel and some device tree files, signing
852 each configuration, using automatic mode. Moreover, the public key needed to
853 verify signatures is added to u\-boot.dtb with required = "conf" property.
857 \fBmkimage \-f auto-conf \-A arm \-O linux \-T kernel \-C none \-a 43e00000 \\
858 \-e 0 \-d vmlinuz \-b /path/to/file\-1.dtb \-b /path/to/file\-2.dtb \\
859 \-k /folder/with/signing\-keys \-g dev \-o sha256,rsa2048 \\
860 \-K u\-boot.dtb -r kernel.itb
869 .UR https://\:u-boot\:.readthedocs\:.io/\:en/\:latest/\:index.html