forked from nrfconnect/sdk-mcuboot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Kconfig
496 lines (420 loc) · 14.5 KB
/
Kconfig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
# Copyright (c) 2017-2020 Linaro Limited
# Copyright (c) 2020 Arm Limited
#
# SPDX-License-Identifier: Apache-2.0
#
mainmenu "MCUboot configuration"
comment "MCUboot-specific configuration options"
# Hidden option to mark a project as MCUboot
config MCUBOOT
default y
bool
select MPU_ALLOW_FLASH_WRITE if ARM_MPU
select USE_DT_CODE_PARTITION if HAS_FLASH_LOAD_OFFSET
partition=MCUBOOT
partition-size=0xc000
source "${ZEPHYR_BASE}/../nrf/subsys/partition_manager/Kconfig.template.partition_size"
partition=MCUBOOT_SCRATCH
partition-size=0x1e000
source "${ZEPHYR_BASE}/../nrf/subsys/partition_manager/Kconfig.template.partition_size"
partition=MCUBOOT_PAD
partition-size=0x200
source "${ZEPHYR_BASE}/../nrf/subsys/partition_manager/Kconfig.template.partition_size"
config BOOT_USE_MBEDTLS
bool
# Hidden option
default n
help
Use mbedTLS for crypto primitives.
config BOOT_USE_TINYCRYPT
bool
# Hidden option
default n
# When building for ECDSA, we use our own copy of mbedTLS, so the
# Zephyr one must not be enabled or the MBEDTLS_CONFIG_FILE macros
# will collide.
depends on ! MBEDTLS
help
Use TinyCrypt for crypto primitives.
config BOOT_USE_CC310
bool
# Hidden option
default n
# When building for ECDSA, we use our own copy of mbedTLS, so the
# Zephyr one must not be enabled or the MBEDTLS_CONFIG_FILE macros
# will collide.
depends on ! MBEDTLS
help
Use cc310 for crypto primitives.
config BOOT_USE_NRF_CC310_BL
bool
default n
config BOOT_USE_NRF_EXTERNAL_CRYPTO
bool
# Hidden option
default n
# When building for ECDSA, we use our own copy of mbedTLS, so the
# Zephyr one must not be enabled or the MBEDTLS_CONFIG_FILE macros
# will collide.
depends on ! MBEDTLS
help
Use Shared crypto for crypto primitives.
menu "MCUBoot settings"
config SINGLE_IMAGE_DFU
bool "Single image application"
default n
help
Single image area is used for application which means that
uploading a new application overwrites the one that previously
occupied the area.
choice
prompt "Signature type"
default BOOT_SIGNATURE_TYPE_RSA
config BOOT_SIGNATURE_TYPE_NONE
bool "No signature; use only hash check"
select BOOT_USE_TINYCRYPT
config BOOT_SIGNATURE_TYPE_RSA
bool "RSA signatures"
select BOOT_USE_MBEDTLS
select MBEDTLS
if BOOT_SIGNATURE_TYPE_RSA
config BOOT_SIGNATURE_TYPE_RSA_LEN
int "RSA signature length"
range 2048 3072
default 2048
endif
config BOOT_SIGNATURE_TYPE_ECDSA_P256
bool "Elliptic curve digital signatures with curve P-256"
if BOOT_SIGNATURE_TYPE_ECDSA_P256
choice
prompt "Ecdsa implementation"
default BOOT_NRF_EXTERNAL_CRYPTO if SECURE_BOOT
default BOOT_CC310 if HAS_HW_NRF_CC310
default BOOT_TINYCRYPT
config BOOT_TINYCRYPT
bool "Use tinycrypt"
select BOOT_USE_TINYCRYPT
config BOOT_CC310
bool "Use CC310"
select BOOT_USE_NRF_CC310_BL if HAS_HW_NRF_CC310
select NRFXLIB_CRYPTO if SOC_FAMILY_NRF
select BOOT_USE_CC310
config BOOT_NRF_EXTERNAL_CRYPTO
bool "Use Shared Crypto from bootloader"
select BOOT_USE_NRF_EXTERNAL_CRYPTO
depends on SECURE_BOOT_CRYPTO_CLIENT
endchoice
endif #BOOT_SIGNATURE_TYPE_ECDSA_P256
config BOOT_SIGNATURE_TYPE_ED25519
bool "Edwards curve digital signatures using ed25519"
if BOOT_SIGNATURE_TYPE_ED25519
choice
prompt "Ecdsa implementation"
default BOOT_ED25519_TINYCRYPT
config BOOT_ED25519_TINYCRYPT
bool "Use tinycrypt"
select BOOT_USE_TINYCRYPT
config BOOT_ED25519_MBEDTLS
bool "Use mbedTLS"
select BOOT_USE_MBEDTLS
select MBEDTLS
endchoice
endif
endchoice
config MCUBOOT_CLEANUP_ARM_CORE
bool "Perform core cleanup before chain-load the application"
depends on CPU_CORTEX_M
default y
config MCUBOOT_NRF_CLEANUP_PERIPHERAL
bool "Perform peripheral cleanup before chain-load the application"
depends on SOC_FAMILY_NRF
default y
config MBEDTLS_CFG_FILE
default "mcuboot-mbedtls-cfg.h"
config BOOT_HW_KEY
bool "Use HW key for image verification"
default n
help
Use HW key for image verification, otherwise the public key is embedded
in MCUBoot. If enabled the public key is appended to the signed image
and requires the hash of the public key to be provisioned to the device
beforehand.
config BOOT_VALIDATE_SLOT0
bool "Validate image in the primary slot on every boot"
default y
help
If y, the bootloader attempts to validate the signature of the
primary slot every boot. This adds the signature check time to
every boot, but can mitigate against some changes that are
able to modify the flash image itself.
if !SINGLE_IMAGE_DFU
config BOOT_UPGRADE_ONLY
bool "Overwrite image updates instead of swapping"
default n
help
If y, overwrite the primary slot with the upgrade image instead
of swapping them. This prevents the fallback recovery, but
uses a much simpler code path.
config BOOT_SWAP_USING_MOVE
bool "Swap mode that can run without a scratch partition"
default y if SOC_FAMILY_NRF
default n
help
If y, the swap upgrade is done in two steps, where first every
sector of the primary slot is moved up one sector, then for
each sector X in the secondary slot, it is moved to index X in
the primary slot, then the sector at X+1 in the primary is
moved to index X in the secondary.
This allows a swap upgrade without using a scratch partition,
but is currently limited to all sectors in both slots being of
the same size.
endif
if !SINGLE_IMAGE_DFU
config BOOT_BOOTSTRAP
bool "Bootstrap erased the primary slot from the secondary slot"
default n
help
If y, enables bootstraping support. Bootstrapping allows an erased
primary slot to be initialized from a valid image in the secondary slot.
If unsure, leave at the default value.
config BOOT_SWAP_SAVE_ENCTLV
bool "Save encrypted key TLVs instead of plaintext keys in swap metadata"
default n
help
If y, instead of saving the encrypted image keys in plaintext in the
swap resume metadata, save the encrypted image TLVs. This should be used
when there is no security mechanism protecting the data in the primary
slot from being dumped. If n is selected (default), the keys are written
after being decrypted from the image TLVs and could be read by an
attacker who has access to the flash contents of the primary slot (eg
JTAG/SWD or primary slot in external flash).
If unsure, leave at the default value.
config BOOT_ENCRYPT_RSA
bool "Support for encrypted upgrade images using RSA"
default n
help
If y, images in the secondary slot can be encrypted and are decrypted
on the fly when upgrading to the primary slot, as well as encrypted
back when swapping from the primary slot to the secondary slot. The
encryption mechanism used in this case is RSA-OAEP (2048 bits).
config BOOT_ENCRYPT_EC256
bool "Support for encrypted upgrade images using ECIES-P256"
default n
help
If y, images in the secondary slot can be encrypted and are decrypted
on the fly when upgrading to the primary slot, as well as encrypted
back when swapping from the primary slot to the secondary slot. The
encryption mechanism used in this case is ECIES using primitives
described under "ECIES-P256 encryption" in docs/encrypted_images.md.
config BOOT_ENCRYPT_X25519
bool "Support for encrypted upgrade images using ECIES-X25519"
default n
help
If y, images in the secondary slot can be encrypted and are decrypted
on the fly when upgrading to the primary slot, as well as encrypted
back when swapping from the primary slot to the secondary slot. The
encryption mechanism used in this case is ECIES using primitives
described under "ECIES-X25519 encryption" in docs/encrypted_images.md.
endif
config BOOT_MAX_IMG_SECTORS
int "Maximum number of sectors per image slot"
default 128
help
This option controls the maximum number of sectors that each of
the two image areas can contain. Smaller values reduce MCUboot's
memory usage; larger values allow it to support larger images.
If unsure, leave at the default value.
config BOOT_ERASE_PROGRESSIVELY
bool "Erase flash progressively when receiving new firmware"
default y if SOC_FAMILY_NRF
help
If enabled, flash is erased as necessary when receiving new firmware,
instead of erasing the whole image slot at once. This is necessary
on some hardware that has long erase times, to prevent long wait
times at the beginning of the DFU process.
config MEASURED_BOOT
bool "Store the boot state/measurements in shared memory"
default n
help
If enabled, the bootloader will store certain boot measurements such as
the hash of the firmware image in a shared memory area. This data can
be used later by runtime services (e.g. by a device attestation service).
config BOOT_SHARE_DATA
bool "Save application specific data in shared memory area"
default n
config BOOT_WAIT_FOR_USB_DFU
bool "Wait for a prescribed duration to see if USB DFU is invoked"
default n
select USB
select USB_DFU_CLASS
select IMG_MANAGER
help
If y, MCUboot waits for a prescribed duration of time to allow
for USB DFU to be invoked. Please note DFU always updates the
slot1 image.
config ZEPHYR_TRY_MASS_ERASE
bool "Try to mass erase flash when flashing MCUboot image"
default y
help
If y, attempt to configure the Zephyr build system's "flash"
target to mass-erase the flash device before flashing the
MCUboot image. This ensures the scratch and other partitions
are in a consistent state.
This is not available for all targets.
config BOOT_USE_BENCH
bool "Enable benchmark code"
default n
help
If y, adds support for simple benchmarking that can record
time intervals between two calls. The time printed depends
on the particular Zephyr target, and is generally ticks of a
specific board-specific timer.
module = MCUBOOT
module-str = MCUBoot bootloader
source "subsys/logging/Kconfig.template.log_config"
config MCUBOOT_LOG_THREAD_STACK_SIZE
int "Stack size for the MCUBoot log processing thread"
depends on LOG && !LOG_IMMEDIATE
default 2048 if COVERAGE_GCOV
default 1024 if NO_OPTIMIZATIONS
default 1024 if XTENSA
default 4096 if (X86 && X86_64)
default 4096 if ARM64
default 768
help
Set the internal stack size for MCUBoot log processing thread.
menuconfig MCUBOOT_SERIAL
bool "MCUboot serial recovery"
default n
select REBOOT
select GPIO
select SERIAL
select UART_INTERRUPT_DRIVEN
select BASE64
select TINYCBOR
help
If y, enables a serial-port based update mode. This allows
MCUboot itself to load update images into flash over a UART.
If unsure, leave at the default value.
if MCUBOOT_SERIAL
choice
prompt "Serial device"
default BOOT_SERIAL_UART if !BOARD_NRF52840DONGLE_NRF52840
default BOOT_SERIAL_CDC_ACM if BOARD_NRF52840DONGLE_NRF52840
config BOOT_SERIAL_UART
bool "UART"
# SERIAL and UART_INTERRUPT_DRIVEN already selected
config BOOT_SERIAL_CDC_ACM
bool "CDC ACM"
select USB
select USB_DEVICE_STACK
select USB_CDC_ACM
endchoice
config BOOT_MAX_LINE_INPUT_LEN
int "Maximum command line length"
default 512
help
Maximum length of commands transported over the serial port.
config BOOT_SERIAL_DETECT_PORT
string "GPIO device to trigger serial recovery mode"
default GPIO_0 if SOC_FAMILY_NRF
help
Zephyr GPIO device which contains the pin used to trigger
serial recovery mode.
config BOOT_SERIAL_DETECT_PIN
int "Pin to trigger serial recovery mode"
default 6 if BOARD_NRF9160DK_NRF9160
default 11 if BOARD_NRF52840DK_NRF52840
default 13 if BOARD_NRF52DK_NRF52832
default 23 if BOARD_NRF5340PDK_NRF5340_CPUAPP || BOARD_NRF5340PDK_NRF5340_CPUAPPNS
help
Pin on the serial detect port which triggers serial recovery mode.
config BOOT_SERIAL_DETECT_PIN_VAL
int "Serial detect pin trigger value"
default 0
range 0 1
help
Logic value of the detect pin which triggers serial recovery
mode.
# Workaround for not being able to have commas in macro arguments
DT_CHOSEN_Z_CONSOLE := zephyr,console
config RECOVERY_UART_DEV_NAME
string "UART Device Name for Recovery UART"
default "$(dt_chosen_label,$(DT_CHOSEN_Z_CONSOLE))" if HAS_DTS
default "UART_0"
depends on BOOT_SERIAL_UART
help
This option specifies the name of UART device to be used for
serial recovery.
endif # MCUBOOT_SERIAL
config BOOT_INTR_VEC_RELOC
bool "Relocate the interrupt vector to the application"
default n
depends on SW_VECTOR_RELAY || CPU_CORTEX_M_HAS_VTOR
help
Relocate the interrupt vector to the application before it is started.
Select this option if application requires vector relocation,
but it doesn't relocate vector in its reset handler.
config UPDATEABLE_IMAGE_NUMBER
int "Number of updateable images"
default 1
range 1 1 if SINGLE_IMAGE_DFU
help
Enables support of multi image update.
choice
prompt "Downgrade prevention"
optional
config MCUBOOT_DOWNGRADE_PREVENTION
bool "SW based downgrade prevention"
depends on BOOT_UPGRADE_ONLY
help
Prevent downgrades by enforcing incrementing version numbers.
When this option is set, any upgrade must have greater major version
or greater minor version with equal major version. This mechanism
only protects against some attacks against version downgrades (for
example, a JTAG could be used to write an older version).
config MCUBOOT_HW_DOWNGRADE_PREVENTION
bool "HW based downgrade prevention"
help
Prevent undesirable/malicious software downgrades. When this option is
set, any upgrade must have greater or equal security counter value.
Because of the acceptance of equal values it allows for software
downgrade to some extent.
endchoice
endmenu
config MCUBOOT_DEVICE_SETTINGS
# Hidden selector for device-specific settings
bool
default y
# CPU options
select MCUBOOT_DEVICE_CPU_CORTEX_M0 if CPU_CORTEX_M0
# Enable flash page layout if available
select FLASH_PAGE_LAYOUT if FLASH_HAS_PAGE_LAYOUT
# Enable flash_map module as flash I/O back-end
select FLASH_MAP
config MCUBOOT_DEVICE_CPU_CORTEX_M0
# Hidden selector for Cortex-M0 settings
bool
default n
select SW_VECTOR_RELAY if !CPU_CORTEX_M0_HAS_VECTOR_TABLE_REMAP
comment "Zephyr configuration options"
# Disabling MULTITHREADING provides a code size advantage, but
# it requires peripheral drivers (particularly a flash driver)
# that works properly with the option enabled.
#
# If you know for sure that your hardware will work, you can default
# it to n here. Otherwise, having it on by default makes the most
# hardware work.
config MULTITHREADING
default y if BOOT_SERIAL_CDC_ACM #usb driver requires MULTITHREADING
default n if SOC_FAMILY_NRF
default y
config LOG_IMMEDIATE
default n if MULTITHREADING
default y
config LOG_PROCESS_THREAD
default n # mcuboot has its own log processing thread
# override USB device name
config USB_DEVICE_PRODUCT
default "MCUBOOT"
source "Kconfig.zephyr"