|
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 build |
| 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 "Use overwrite-only instead of swap upgrades" |
| 25 | + help |
| 26 | + If enabled, --overwrite-only option 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 if BOOTLOADER_MCUBOOT_ESPRESSIF |
| 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 contents of secondary slot of an image and will overwrite primary slot |
| 77 | + with it. In this mode it is not possible to revert back to previous version as it is not |
| 78 | + 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 | +config ESP_MCUBOOT_BOOTLOADER_NO_DOWNGRADE |
| 93 | + bool "MCUboot mode has downgrade prevention enabled" |
| 94 | + help |
| 95 | + Selected MCUboot mode has downgrade prevention enabled, where you are not |
| 96 | + able to change back to image with lower version number. |
| 97 | + This options should be selected when MCUboot has been built with |
| 98 | + MCUBOOT_DOWNGRADE_PREVENTION option enabled. |
| 99 | +endif # ESP_MCUBOOT_BOOTLOADER_MODE_HAS_NO_DOWNGRADE |
| 100 | + |
| 101 | +choice ESP_BOOT_SIGNATURE_TYPE |
| 102 | + prompt "Signature type" |
| 103 | + default ESP_BOOT_SIGNATURE_TYPE_NONE |
| 104 | + |
| 105 | +config ESP_BOOT_SIGNATURE_TYPE_NONE |
| 106 | + bool "No signature; use only hash check" |
| 107 | + |
| 108 | +config ESP_BOOT_SIGNATURE_TYPE_RSA |
| 109 | + bool "RSA signatures" |
| 110 | + |
| 111 | +if ESP_BOOT_SIGNATURE_TYPE_RSA |
| 112 | +config ESP_BOOT_SIGNATURE_RSA_LEN |
| 113 | + int "RSA signature length" |
| 114 | + range 2048 3072 |
| 115 | + default 2048 |
| 116 | +endif |
| 117 | + |
| 118 | +config ESP_BOOT_SIGNATURE_TYPE_ECDSA_P256 |
| 119 | + bool "Elliptic curve digital signatures with curve P-256" |
| 120 | + |
| 121 | +config ESP_BOOT_SIGNATURE_TYPE_ED25519 |
| 122 | + bool "Edwards curve digital signatures using ed25519" |
| 123 | + |
| 124 | +endchoice # ESP_BOOT_SIGNATURE_TYPE |
| 125 | + |
| 126 | +config ESP_BOOT_SIGNATURE_KEY_FILE |
| 127 | + string "Signing PEM key file" |
| 128 | + depends on !ESP_BOOT_SIGNATURE_TYPE_NONE |
| 129 | + default "$(ZEPHYR_MCUBOOT_MODULE_DIR)/root-ec-p256.pem" if ESP_BOOT_SIGNATURE_TYPE_ECDSA_P256 |
| 130 | + default "$(ZEPHYR_MCUBOOT_MODULE_DIR)/root-ed25519.pem" if ESP_BOOT_SIGNATURE_TYPE_ED25519 |
| 131 | + default "$(ZEPHYR_MCUBOOT_MODULE_DIR)/root-rsa-2048.pem" if ESP_BOOT_SIGNATURE_TYPE_RSA && ESP_BOOT_SIGNATURE_RSA_LEN=2048 |
| 132 | + default "$(ZEPHYR_MCUBOOT_MODULE_DIR)/root-rsa-3072.pem" if ESP_BOOT_SIGNATURE_TYPE_RSA && ESP_BOOT_SIGNATURE_RSA_LEN=3072 |
| 133 | + default "" |
| 134 | + help |
| 135 | + Absolute path to signing key file to use with MCUBoot. |
| 136 | + |
| 137 | +endif # BOOTLOADER_MCUBOOT_ESPRESSIF |
0 commit comments