@@ -51,50 +51,100 @@ enabled, this last step is unnecessary and can be skipped.
51
51
Image signing takes an image in binary or Intel Hex format intended for the
52
52
primary slot and adds a header and trailer that the bootloader is expecting:
53
53
54
- Usage: imgtool.py sign [OPTIONS] INFILE OUTFILE
54
+ Usage: imgtool sign [OPTIONS] INFILE OUTFILE
55
55
56
56
Create a signed or unsigned image
57
57
58
58
INFILE and OUTFILE are parsed as Intel HEX if the params have .hex
59
59
extension, otherwise binary format is used
60
60
61
61
Options:
62
+ --vector-to-sign [payload|digest]
63
+ send to OUTFILE the payload or payloads
64
+ digest instead of complied image. These data
65
+ can be used for external image signing
66
+ --sha [auto|256|384|512] selected sha algorithm to use; defaults to
67
+ "auto" which is 256 if no cryptographic
68
+ signature is used, or default for signature
69
+ type
70
+ --sig-out filename Path to the file to which signature will be
71
+ written. The image signature will be encoded
72
+ as base64 formatted string
73
+ --pure Expected Pure variant of signature; the Pure
74
+ variant is expected to be signature done
75
+ over an image rather than hash of that
76
+ image.
77
+ --fix-sig-pubkey filename public key relevant to fixed signature
78
+ --fix-sig filename fixed signature for the image. It will be
79
+ used instead of the signature calculated
80
+ using the public key
62
81
-k, --key filename
63
82
--public-key-format [hash|full]
64
- --align [1|2|4|8|16|32] Alignment used by swap update modes.
65
- -v, --version TEXT [required]
66
- -s, --security-counter TEXT Specify the value of security counter. Use
67
- the `auto` keyword to automatically generate
68
- it from the image version.
69
- -d, --dependencies TEXT
70
- --pad-sig Add 0-2 bytes of padding to ECDSA signature
71
- (for MCUboot <1.5)
72
- -H, --header-size INTEGER [required]
73
- --pad-header Add --header-size zeroed bytes at the
74
- beginning of the image
75
- -S, --slot-size INTEGER Size of the slot where the image will be
76
- written [required]
77
- --pad Pad image to --slot-size bytes, adding
78
- trailer magic
79
- --confirm When padding the image, mark it as confirmed
80
- -M, --max-sectors INTEGER When padding allow for this amount of
81
- sectors (defaults to 128)
82
- --boot-record sw_type Create CBOR encoded boot record TLV. The
83
- sw_type represents the role of the software
84
- component (e.g. CoFM for coprocessor
85
- firmware). [max. 12 characters]
86
- --overwrite-only Use overwrite-only instead of swap upgrades
87
- -e, --endian [little|big] Select little or big endian
88
- -E, --encrypt filename Encrypt image using the provided public key
89
- --save-enctlv When upgrading, save encrypted key TLVs
90
- instead of plain keys. Enable when
91
- BOOT_SWAP_SAVE_ENCTLV config option was set.
92
- -L, --load-addr INTEGER Load address for image when it should run
93
- from RAM.
94
- -x, --hex-addr INTEGER Adjust address in hex output file.
95
- -R, --erased-val [0|0xff] The value that is read back from erased
96
- flash.
97
- -h, --help Show this message and exit.
83
+ In what format to add the public key to the
84
+ image manifest: full key or hash of the key.
85
+ --max-align [8|16|32] Maximum flash alignment. Set if flash
86
+ alignment of the primary and secondary slot
87
+ differ and any of them is larger than 8.
88
+ --align [1|2|4|8|16|32] Alignment used by swap update modes.
89
+ -v, --version TEXT [required]
90
+ -s, --security-counter TEXT Specify the value of security counter. Use
91
+ the `auto` keyword to automatically generate
92
+ it from the image version.
93
+ -d, --dependencies TEXT Add dependence on another image, format:
94
+ "(<image_ID>,<image_version>), ... "
95
+ --pad-sig Add 0-2 bytes of padding to ECDSA signature
96
+ (for mcuboot <1.5)
97
+ -H, --header-size INTEGER [required]
98
+ --pad-header Add --header-size zeroed bytes at the
99
+ beginning of the image
100
+ -S, --slot-size INTEGER Size of the slot. If the slots have
101
+ different sizes, use the size of the
102
+ secondary slot. [required]
103
+ --pad Pad image to --slot-size bytes, adding
104
+ trailer magic
105
+ --confirm When padding the image, mark it as confirmed
106
+ (implies --pad)
107
+ -M, --max-sectors INTEGER When padding allow for this amount of
108
+ sectors (defaults to 128)
109
+ --boot-record sw_type Create CBOR encoded boot record TLV. The
110
+ sw_type represents the role of the software
111
+ component (e.g. CoFM for coprocessor
112
+ firmware). [max. 12 characters]
113
+ --overwrite-only Use overwrite-only instead of swap upgrades
114
+ -e, --endian [little|big] Select little or big endian
115
+ -c, --clear Output a non-encrypted image with encryption
116
+ capabilities,so it can be installed in the
117
+ primary slot, and encrypted when swapped to
118
+ the secondary.
119
+ --skip-encryption Set encryption flags and TLV's without
120
+ applying encryption.
121
+ --compression [disabled|lzma2|lzma2armthumb]
122
+ Enable image compression using specified
123
+ type. Will fall back without image
124
+ compression automatically if the compression
125
+ increases the image size.
126
+ --encrypt-keylen [128|256] When encrypting the image using AES, select
127
+ a 128 bit or 256 bit key len.
128
+ -E, --encrypt filename Encrypt image using the provided public key.
129
+ (Not supported in direct-xip or ram-load
130
+ mode.)
131
+ --save-enctlv When upgrading, save encrypted key TLVs
132
+ instead of plain keys. Enable when
133
+ BOOT_SWAP_SAVE_ENCTLV config option was set.
134
+ -F, --rom-fixed INTEGER Set flash address the image is built for.
135
+ -L, --load-addr INTEGER Load address for image when it should run
136
+ from RAM.
137
+ -x, --hex-addr INTEGER Adjust address in hex output file.
138
+ -R, --erased-val [0|0xff] The value that is read back from erased
139
+ flash.
140
+ --custom-tlv [tag] [value] Custom TLV that will be placed into
141
+ protected area. Add "0x" prefix if the value
142
+ should be interpreted as an integer,
143
+ otherwise it will be interpreted as a
144
+ string. Specify the option multiple times to
145
+ add multiple TLVs.
146
+ --non-bootable Mark the image as non-bootable.
147
+ -h, --help Show this message and exit.
98
148
99
149
The main arguments given are the key file generated above, a version
100
150
field to place in the header (1.2.3 for example), the alignment of the
@@ -111,6 +161,12 @@ the load address (in Intel Hex terms, the Extended Linear Address record) to
111
161
adjust for the new bytes prepended to the file. The load address of all data
112
162
existing in the file should not change.
113
163
164
+ The ` --compression ` option enables LZMA compression over payload. Details
165
+ about internals of image generated with this option can be found here
166
+ [ here] ( ./compression_format.md )
167
+ This isn't fully supported on the embedded side but can be utilised when
168
+ project is built on top of the mcuboot.
169
+
114
170
The ` --slot-size ` argument is required and used to check that the firmware
115
171
does not overflow into the swap status area (metadata). If swap upgrades are
116
172
not being used, ` --overwrite-only ` can be passed to avoid adding the swap
0 commit comments