|  | 
| 3 | 3 | 
 | 
| 4 | 4 | choice BOOTLOADER | 
| 5 | 5 | 	default BOOTLOADER_MCUBOOT | 
|  | 6 | + | 
|  | 7 | +# Extension for the BOOTLOADER Kconfig choice to allow | 
|  | 8 | +# MCUboot Espressif Port to be built | 
|  | 9 | +config BOOTLOADER_MCUBOOT_ESPRESSIF | 
|  | 10 | +	bool "MCUboot Espressif Port" | 
|  | 11 | +	depends on SOC_FAMILY_ESPRESSIF_ESP32 | 
|  | 12 | +	help | 
|  | 13 | +	  Use MCUboot Espressif Port as the bootloader | 
|  | 14 | + | 
| 6 | 15 | endchoice | 
| 7 | 16 | 
 | 
| 8 | 17 | choice MCUBOOT_MODE | 
| 9 | 18 | 	default MCUBOOT_MODE_OVERWRITE_ONLY if SOC_FAMILY_ESPRESSIF_ESP32 | 
| 10 | 19 | endchoice | 
|  | 20 | + | 
|  | 21 | +if BOOTLOADER_MCUBOOT_ESPRESSIF | 
|  | 22 | + | 
|  | 23 | +config ESP_MCUBOOT_IMGTOOL_OVERWRITE_ONLY | 
|  | 24 | +	bool | 
|  | 25 | +	help | 
|  | 26 | +	  If enabled, --overwrite-only option is passed to imgtool to avoid | 
|  | 27 | +	  adding the swap status area size when calculating overflow. | 
|  | 28 | + | 
|  | 29 | +choice ESP_MCUBOOT_MODE | 
|  | 30 | +	prompt "Mode of operation" | 
|  | 31 | +	default ESP_MCUBOOT_MODE_SWAP_SCRATCH | 
|  | 32 | +	help | 
|  | 33 | +	  The operating mode of MCUboot (which will also be propagated to the application). | 
|  | 34 | + | 
|  | 35 | +config ESP_MCUBOOT_MODE_SINGLE_APP | 
|  | 36 | +	bool "Single slot" | 
|  | 37 | +	select ESP_MCUBOOT_IMGTOOL_OVERWRITE_ONLY | 
|  | 38 | +	help | 
|  | 39 | +	  MCUboot will only boot slot0_partition placed application and does not care about other | 
|  | 40 | +	  slots. In this mode application is not able to DFU its own update to secondary slot and | 
|  | 41 | +	  all updates need to be performed using MCUboot serial recovery. | 
|  | 42 | + | 
|  | 43 | +config ESP_MCUBOOT_MODE_SWAP_USING_OFFSET | 
|  | 44 | +	bool "Swap using offset" | 
|  | 45 | +	select EXPERIMENTAL | 
|  | 46 | +	select ESP_MCUBOOT_BOOTLOADER_MODE_HAS_NO_DOWNGRADE | 
|  | 47 | +	help | 
|  | 48 | +	  MCUboot expects slot0_partition and slot1_partition to be present in DT and application | 
|  | 49 | +	  will boot from slot0_partition. MCUBOOT_BOOTLOADER_NO_DOWNGRADE should also be selected | 
|  | 50 | +	  in main application if MCUboot has been built with MCUBOOT_DOWNGRADE_PREVENTION. | 
|  | 51 | + | 
|  | 52 | +config ESP_MCUBOOT_MODE_SWAP_USING_MOVE | 
|  | 53 | +	bool "Swap using move" | 
|  | 54 | +	select ESP_MCUBOOT_BOOTLOADER_MODE_HAS_NO_DOWNGRADE | 
|  | 55 | +	help | 
|  | 56 | +	  MCUboot expects slot0_partition and slot1_partition to be present in DT and application | 
|  | 57 | +	  will boot from slot0_partition. MCUBOOT_BOOTLOADER_NO_DOWNGRADE should also be selected | 
|  | 58 | +	  in main application if MCUboot has been built with MCUBOOT_DOWNGRADE_PREVENTION. | 
|  | 59 | + | 
|  | 60 | +config ESP_MCUBOOT_MODE_SWAP_SCRATCH | 
|  | 61 | +	bool "Swap using scratch" | 
|  | 62 | +	select ESP_MCUBOOT_BOOTLOADER_MODE_HAS_NO_DOWNGRADE | 
|  | 63 | +	help | 
|  | 64 | +	  MCUboot expects slot0_partition, slot1_partition and scratch_partition to be present in | 
|  | 65 | +	  DT, and application will boot from slot0_partition. In this mode scratch_partition is | 
|  | 66 | +	  used as temporary storage when MCUboot swaps application from the secondary slot to the | 
|  | 67 | +	  primary slot. | 
|  | 68 | +	  MCUBOOT_BOOTLOADER_NO_DOWNGRADE should also be selected in main application if MCUboot | 
|  | 69 | +	  has been built with MCUBOOT_DOWNGRADE_PREVENTION. | 
|  | 70 | + | 
|  | 71 | +config ESP_MCUBOOT_MODE_OVERWRITE_ONLY | 
|  | 72 | +	bool "Overwrite" | 
|  | 73 | +	select ESP_MCUBOOT_IMGTOOL_OVERWRITE_ONLY | 
|  | 74 | +	select ESP_MCUBOOT_BOOTLOADER_MODE_HAS_NO_DOWNGRADE | 
|  | 75 | +	help | 
|  | 76 | +	  MCUboot will take the content of secondary slot of an image and will overwrite primary | 
|  | 77 | +	  slot with it. In this mode it is not possible to revert back to previous version as it | 
|  | 78 | +	  is not stored in the secondary slot. | 
|  | 79 | +	  This mode supports MCUBOOT_BOOTLOADER_NO_DOWNGRADE which means that the overwrite will | 
|  | 80 | +	  not happen unless the version of secondary slot is higher than the version in primary | 
|  | 81 | +	  slot. | 
|  | 82 | + | 
|  | 83 | +endchoice # ESP_MCUBOOT_MODE | 
|  | 84 | + | 
|  | 85 | +config ESP_MCUBOOT_BOOTLOADER_MODE_HAS_NO_DOWNGRADE | 
|  | 86 | +	bool | 
|  | 87 | +	help | 
|  | 88 | +	  Selected mode supports downgrade prevention, where you cannot switch to | 
|  | 89 | +	  an application with lower version than the currently running application. | 
|  | 90 | + | 
|  | 91 | +if ESP_MCUBOOT_BOOTLOADER_MODE_HAS_NO_DOWNGRADE | 
|  | 92 | + | 
|  | 93 | +config ESP_MCUBOOT_BOOTLOADER_NO_DOWNGRADE | 
|  | 94 | +	bool "MCUboot downgrade prevention" | 
|  | 95 | +	help | 
|  | 96 | +	  Selected MCUboot mode has downgrade prevention, where it's not | 
|  | 97 | +	  possible to revert back to image with lower version number. | 
|  | 98 | +	  This options should be selected when MCUboot has been built with | 
|  | 99 | +	  MCUBOOT_DOWNGRADE_PREVENTION option enabled. | 
|  | 100 | + | 
|  | 101 | +endif # ESP_MCUBOOT_BOOTLOADER_MODE_HAS_NO_DOWNGRADE | 
|  | 102 | + | 
|  | 103 | +choice ESP_BOOT_SIGNATURE_TYPE | 
|  | 104 | +	prompt "Signature type" | 
|  | 105 | +	default ESP_BOOT_SIGNATURE_TYPE_NONE | 
|  | 106 | + | 
|  | 107 | +config ESP_BOOT_SIGNATURE_TYPE_NONE | 
|  | 108 | +	bool "No signature; use only hash check" | 
|  | 109 | + | 
|  | 110 | +config ESP_BOOT_SIGNATURE_TYPE_RSA | 
|  | 111 | +	bool "RSA signatures" | 
|  | 112 | + | 
|  | 113 | +if ESP_BOOT_SIGNATURE_TYPE_RSA | 
|  | 114 | + | 
|  | 115 | +config ESP_BOOT_SIGNATURE_RSA_LEN | 
|  | 116 | +	int "RSA signature length" | 
|  | 117 | +	range 2048 3072 | 
|  | 118 | +	default 2048 | 
|  | 119 | + | 
|  | 120 | +endif | 
|  | 121 | + | 
|  | 122 | +config ESP_BOOT_SIGNATURE_TYPE_ECDSA_P256 | 
|  | 123 | +	bool "Elliptic curve digital signatures with curve P-256" | 
|  | 124 | + | 
|  | 125 | +config ESP_BOOT_SIGNATURE_TYPE_ED25519 | 
|  | 126 | +	bool "Edwards curve digital signatures using ed25519" | 
|  | 127 | + | 
|  | 128 | +endchoice # ESP_BOOT_SIGNATURE_TYPE | 
|  | 129 | + | 
|  | 130 | +config ESP_BOOT_SIGNATURE_KEY_FILE | 
|  | 131 | +	string "Signing PEM key file" | 
|  | 132 | +	depends on !ESP_BOOT_SIGNATURE_TYPE_NONE | 
|  | 133 | +	default "$(ZEPHYR_MCUBOOT_MODULE_DIR)/root-ec-p256.pem" if ESP_BOOT_SIGNATURE_TYPE_ECDSA_P256 | 
|  | 134 | +	default "$(ZEPHYR_MCUBOOT_MODULE_DIR)/root-ed25519.pem" if ESP_BOOT_SIGNATURE_TYPE_ED25519 | 
|  | 135 | +	default "$(ZEPHYR_MCUBOOT_MODULE_DIR)/root-rsa-2048.pem" if ESP_BOOT_SIGNATURE_TYPE_RSA && ESP_BOOT_SIGNATURE_RSA_LEN=2048 | 
|  | 136 | +	default "$(ZEPHYR_MCUBOOT_MODULE_DIR)/root-rsa-3072.pem" if ESP_BOOT_SIGNATURE_TYPE_RSA && ESP_BOOT_SIGNATURE_RSA_LEN=3072 | 
|  | 137 | +	default "" | 
|  | 138 | +	help | 
|  | 139 | +	  Absolute path to signing key file to use with MCUBoot. | 
|  | 140 | + | 
|  | 141 | +endif # BOOTLOADER_MCUBOOT_ESPRESSIF | 
0 commit comments