mkimage: Document more misc options
PATCH v3 1/2 mkimage: Document more misc options
Document -G and the secondary image types which can be used with -R. Also reword the documentation of -s for clarity.
---
Changes in v3:
- Rebased onto u-boot/master, as v1 was applied instead of v2
- Reworded commit message to reflect this
Changes in v2:
- Document secondary image types
- Move -G directly after -k
- Reword documentation for -s
doc/mkimage.1 | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-)
doc/mkimage.1 +31 -2
@@ -99,6 +99,30 @@ Set image name to 'image name'. .BI "\-R [" "secondary image name" "]" Some image types support a second image for additional data. For these types, use \-R to specify this second image. +.TS +allbox; +lb lbx +l l. +Image Type Secondary Image Description +pblimage Additional RCW-style header, typically used for PBI commands. +zynqimage, zynqmpimage T{ +Initialization parameters, one per line. Each parameter has the form +.sp +.ti 4 +.I address data +.sp +where +.I address +and +.I data +are hexadecimal integers. The boot ROM will write each +.I data +to +.I address +when loading the image. At most 256 parameters may be specified in this +manner. +T} +.TE .TP .BI "\-d [" "image data file" "]"
@@ -110,8 +134,8 @@ Set XIP (execute in place) flag. .TP .BI "\-s" -Create an image with no data. The header will be created, but the image itself -will not contain data (such as U-Boot or any specified kernel). +Don't copy in the image data. Depending on the image type, this may create +just the header, everything but the image data, or nothing at all. .TP .BI "\-v"
@@ -176,6 +200,11 @@ Specifies the directory containing keys to use for signing. This directory should contain a private key file <name>.key for use with signing and a certificate <name>.crt (containing the public key) for use with verification. +.TP +.BI "\-G [" "key_file" "]" +Specifies the private key file to use when signing. This option may be used +instead of \-k. + .TP .BI "\-K [" "key_destination" "]" Specifies a compiled device tree binary file (typically .dtb) to write
Signature · 1 line
2.35.1.1320.gc452695387.dirty
PATCH v3 2/2 mkimage: Support signing 'auto' FITs
This adds support for signing images in auto-generated FITs. To do this, we need to add a signature node. The algorithm name property already has its own option, but we need one for the key name hint. We could have gone the -G route and added an explicit name for the public key (like what is done for the private key). However, many places assume the public key can be constructed from the key dir and hint, and I don't want to do the refactoring necessary.
As a consequence of this, it is now easier to add public keys to an existing image without signing something. This could be done all along, but now you don't have to create an its just to do it. Ideally, we wouldn't create a FIT at the end. This could be done by calling fit_image_setup_sig/info.crypto->add_verify_data directly.
---
(no changes since v1)
doc/mkimage.1 | 24 ++++++++++++++++++++++++ tools/fit_image.c | 41 ++++++++++++++++++++++++++++++++++------- tools/imagetool.h | 1 + tools/mkimage.c | 5 ++++- 4 files changed, 63 insertions(+), 8 deletions(-)
doc/mkimage.1 +24 -0
@@ -218,6 +218,13 @@ CONFIG_OF_CONTROL in U-Boot. Specifies the private key file to use when signing. This option may be used instead of \-k. +.TP +.BI "\-g [" "key_name_hint" "]" +Sets the key-name-hint property when used with \-f auto. This is the <name> +part of the key. The directory part is set by \-k. This option also indicates +that the images included in the FIT should be signed. If this option is +specified, \-o must be specified as well. + .TP .BI "\-o [" "signing algorithm" "]" Specifies the algorithm to be used for signing a FIT image. The default is
@@ -278,6 +285,15 @@ skipping those for which keys cannot be found. Also add a comment. .B -c """Kernel 3.8 image for production devices""" kernel.itb .fi +.P +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. +.nf +.B mkimage -f auto -d /dev/null -k /public/signing-keys -g dev \\\\ +.br +.B -o sha256,rsa2048 -K u-boot.dtb unused.itb +.fi + .P Update an existing FIT image, signing it with additional keys. Add corresponding public keys into u-boot.dtb. This will resign all images
@@ -306,6 +322,14 @@ automatic mode. No .its file is required. .B -c """Kernel 4.4 image for production devices""" -d vmlinuz \\\\ .B -b /path/to/rk3288-firefly.dtb -b /path/to/rk3288-jerry.dtb kernel.itb .fi +.P +Create a FIT image containing a signed kernel, using automatic mode. No .its +file is required. +.nf +.B mkimage -f auto -A arm -O linux -T kernel -C none -a 43e00000 -e 0 \\\\ +.br +.B -d vmlinuz -k /secret/signing-keys -g dev -o sha256,rsa2048 kernel.itb +.fi .SH HOMEPAGE http://www.denx.de/wiki/U-Boot/WebHome
tools/fit_image.c +34 -7
70 lines not on this page · raw message
tools/imagetool.h +1 -0
@@ -71,6 +71,7 @@ struct image_tool_params {const char *keydir;/* Directory holding private keys */ const char *keydest;/* Destination .dtb for public key */ const char *keyfile;/* Filename of private or public key */ +const char *keyname;/* Key name "hint" */ const char *comment;/* Comment to add to signature node */ /* Algorithm name to use for hashing/signing or NULL to use the one * specified in the its */
tools/mkimage.c +4 -1
@@ -119,6 +119,7 @@ static void usage(const char *msg)"Signing / verified boot options: [-k keydir] [-K dtb] [ -c <comment>] [-p addr] [-r] [-N engine]\n" " -k => set directory containing private keys\n" " -K => write public keys to this .dtb file\n" +" -g => set key name hint\n" " -G => use this signing key (in lieu of -k)\n" " -c => add comment in signature node\n" " -F => re-sign existing FIT image\n"
@@ -163,7 +164,7 @@ static void process_args(int argc, char **argv)int opt;while ((opt =getopt (argc, argv, -"a:A:b:B:c:C:d:D:e:Ef:FG:k:i:K:ln:N:p:o:O:rR:qstT:vVx" )) !=-1 ) { +"a:A:b:B:c:C:d:D:e:Ef:Fg:G:k:i:K:ln:N:p:o:O:rR:qstT:vVx" )) !=-1 ) {switch (opt) {case 'a' : params.addr =strtoull (optarg, &ptr,16 );
@@ -239,6 +240,8 @@ static void process_args(int argc, char **argv) params.type =IH_TYPE_FLATDT ; params.fflag =1 ;break ; +case 'g' : + params.keyname = optarg;case 'G' : params.keyfile = optarg;break ;
Signature · 1 line
2.35.1.1320.gc452695387.dirty
Re: [PATCH v3 2/2] mkimage: Support signing 'auto' FITs
Quoted 8 lines · Sean Anderson
This adds support for signing images in auto-generated FITs. To do this, we need to add a signature node. The algorithm name property already has its own option, but we need one for the key name hint. We could have gone the -G route and added an explicit name for the public key (like what is done for the private key). However, many places assume the public key can be constructed from the key dir and hint, and I don't want to do the refactoring necessary.
Quoted 7 lines
As a consequence of this, it is now easier to add public keys to an existing image without signing something. This could be done all along, but now you don't have to create an its just to do it. Ideally, we wouldn't create a FIT at the end. This could be done by calling fit_image_setup_sig/info.crypto->add_verify_data directly.
Signed-off-by Sean Anderson <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
Quoted 4 lines · Sean Anderson
Document -G and the secondary image types which can be used with -R. Also reword the documentation of -s for clarity.
Signed-off-by Sean Anderson <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom