MKIMAGE(1) | General Commands Manual | MKIMAGE(1) |
mkimage - generate images for U-Boot
mkimage |
[-T type] -l image-file-name |
mkimage |
[option ...] [-T type] image-file-name |
mkimage |
[option ...] -f image-tree-source-file|auto image-file-name |
mkimage |
[option ...] -F image-file-name |
The mkimage command is used to create images for use with the U-Boot boot loader. These images can contain the Linux kernel, device tree blob, root file system image, firmware images etc., either separate or combined.
mkimage supports many image formats. Some of these formats may be used by embedded boot firmware to load U-Boot. Others may be used by U-Boot to load Linux (or some other kernel):
The legacy image format concatenates the individual parts (for example, kernel image, device tree blob and ramdisk image) and adds a 64 byte header containing information about the target architecture, operating system, image type, compression method, entry points, time stamp, checksums, etc.
The new FIT (Flattened Image Tree) format allows for more flexibility in handling images of various types and also enhances integrity protection of images with stronger checksums. It also supports verified boot.
rsa2048 |
rsa3072 |
rsa4096 |
ecdsa256 |
sha1 |
sha256 |
sha384 |
sha512 |
This section documents the formats of the primary and secondary configuration options for each image type which supports them.
The primary configuration is a file containing a series of AIS (Application Image Script) commands, one per line. Each command has the form
command argument ...
See TI application report SPRAAG0E for details.
The primary configuration is a comma-separated list of NAND Flash parameters of the form
parameter=value[,parameter=value...]
Valid parameters are
usePmecc |
nbSectorPerPage |
spareSize |
eccBitReq |
sectorSize |
eccOffset |
and valid values are decimal numbers. See section 11.4.4.1 of the SAMA5D3 Series Data Sheet for valid values for each parameter.
The primary configuration is a file containing configuration commands, as documented in doc/imx/mkimage/imximage.txt of the U-Boot source.
The primary configuration is a file containing configuration commands, as documented in doc/imx/mkimage/imx8image.txt of the U-Boot source.
The primary configuration is a file containing configuration commands, as documented in doc/imx/mkimage/kwbimage.txt of the U-Boot source.
The primary configuration is a semicolon-separated list of header options of the form
key=value[;key=value...]
where the valid keys are:
Key | Description |
lk | If 1, then an LK (legacy) image header is used. Otherwise, a BootROM image header is used. |
lkname | The name of the LK image header. The maximum length is 32 ASCII characters. If not specified, the default value is U-Boot. |
media | The boot device. See below for valid values. |
nandinfo | The desired NAND device type. See below for valid values. |
arm64 | If 1, then this denotes an AArch64 image. |
hdroffset | Increase the reported size of the BRLYT header by this amount. |
Valid values for media are:
Value | Description |
nand | Parallel NAND flash |
snand | Serial NAND flash |
nor | Serial NOR flash |
emmc | eMMC (Embedded Multi-Media Card) |
sdmmc | SD (Secure Digital) card |
Valid values for nandinfo are:
Value | NAND type | Page size | OOB size | Total size |
2k+64 | Serial | 2KiB | 64B | |
2k+120 | Serial | 2KiB | 120B | |
2k+128 | Serial | 2KiB | 128B | |
4k+256 | Serial | 4KiB | 256B | |
1g:2k+64 | Parallel | 2KiB | 64B | 1Gbit |
2g:2k+64 | Parallel | 2KiB | 64B | 2Gbit |
4g:2k+64 | Parallel | 2KiB | 64B | 4Gbit |
2g:2k+128 | Parallel | 2KiB | 128B | 2Gbit |
4g:2k+128 | Parallel | 2KiB | 128B | 4Gbit |
The primary configuration is a file containing configuration commands, as documented in doc/imx/mkimage/mxsimage.txt of the U-Boot source.
The primary configuration is the optional value byteswap. If present, each 32-bit word of the image will have its bytes swapped (converting from little-endian to big-endian, or vice versa).
The primary configuration is a file containing the PBI (Pre-Boot Image) header. Each line of the configuration has the format
value[ value...]
Where value is a 32-bit hexadecimal integer. Each value will, after being converted to raw bytes, be literally prepended to the PBI.
The secondary configuration is a file with the same format as the primary configuration file. It will be inserted into the image after the primary configuration data and before the image data.
It is traditional to use the primary configuration file for the RCW (Reset Configuration Word), and the secondary configuration file for any additional PBI commands. However, it is also possible to convert an existing PBI to the above format and “chain” additional data onto the end of the image. This may be especially useful for creating secure boot images.
The primary configuration is the name of the processor to generate the image for. Valid values are:
px30 |
rk3036 |
rk3066 |
rk3128 |
rk3188 |
rk322x |
rk3288 |
rk3308 |
rk3328 |
rk3368 |
rk3399 |
rv1108 |
rk3568 |
The primary configuration is the name to use for the device tree.
The primary configuration is a file containing configuration commands, as documented in doc/README.ublimage of the U-Boot source.
For zynqmpimage, the primary configuration is a file containing the PMUFW (Power Management Unit Firmware). zynqimage does not use the primary configuration.
For both image types, the secondary configuration is a file containinig initialization parameters, one per line. Each parameter has the form
address data
where address and data are hexadecimal integers. The boot ROM will write each data to address when loading the image. At most 256 parameters may be specified in this manner.
Please report bugs to the U-Boot bug tracker.
List image information:
mkimage -l uImage
Create legacy image with compressed PowerPC Linux kernel:
mkimage -A powerpc -O linux -T kernel -C gzip \ -a 0 -e 0 -n Linux -d vmlinux.gz uImage
Create FIT image with compressed PowerPC Linux kernel:
mkimage -f kernel.its kernel.itb
Create FIT image with compressed kernel and sign it with keys in the /public/signing-keys directory. Add corresponding public keys into u-boot.dtb, skipping those for which keys cannot be found. Also add a comment.
mkimage -f kernel.its -k /public/signing-keys -K u-boot.dtb \ -c "Kernel 3.8 image for production devices" kernel.itb
Add public keys to u-boot.dtb without needing a FIT to sign. This will also create a FIT containing an images node with no data named unused.itb.
mkimage -f auto -d /dev/null -k /public/signing-keys -g dev \ -o sha256,rsa2048 -K u-boot.dtb unused.itb
Update an existing FIT image, signing it with additional keys. Add corresponding public keys into u-boot.dtb. This will resign all images with keys that are available in the new directory. Images that request signing with unavailable keys are skipped.
mkimage -F -k /secret/signing-keys -K u-boot.dtb \ -c "Kernel 3.8 image for production devices" kernel.itb
Create a FIT image containing a kernel, using automatic mode. No .its file is required.
mkimage -f auto -A arm -O linux -T kernel -C none -a 43e00000 -e 0 \ -c "Kernel 4.4 image for production devices" -d vmlinuz kernel.itb
Create a FIT image containing a kernel and some device tree files, using automatic mode. No .its file is required.
mkimage -f auto -A arm -O linux -T kernel -C none -a 43e00000 -e 0 \ -c "Kernel 4.4 image for production devices" -d vmlinuz \ -b /path/to/rk3288-firefly.dtb -b /path/to/rk3288-jerry.dtb kernel.itb
Create a FIT image containing a signed kernel, using automatic mode. No .its file is required.
mkimage -f auto -A arm -O linux -T kernel -C none -a 43e00000 -e 0 \ -d vmlinuz -k /secret/signing-keys -g dev -o sha256,rsa2048 kernel.itb
2022-06-11 | U-Boot |