Kconfig.projbuild 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. menu "Bootloader config"
  2. choice LOG_BOOTLOADER_LEVEL
  3. bool "Bootloader log verbosity"
  4. default LOG_BOOTLOADER_LEVEL_INFO
  5. help
  6. Specify how much output to see in bootloader logs.
  7. config LOG_BOOTLOADER_LEVEL_NONE
  8. bool "No output"
  9. config LOG_BOOTLOADER_LEVEL_ERROR
  10. bool "Error"
  11. config LOG_BOOTLOADER_LEVEL_WARN
  12. bool "Warning"
  13. config LOG_BOOTLOADER_LEVEL_INFO
  14. bool "Info"
  15. config LOG_BOOTLOADER_LEVEL_DEBUG
  16. bool "Debug"
  17. config LOG_BOOTLOADER_LEVEL_VERBOSE
  18. bool "Verbose"
  19. endchoice
  20. config LOG_BOOTLOADER_LEVEL
  21. int
  22. default 0 if LOG_BOOTLOADER_LEVEL_NONE
  23. default 1 if LOG_BOOTLOADER_LEVEL_ERROR
  24. default 2 if LOG_BOOTLOADER_LEVEL_WARN
  25. default 3 if LOG_BOOTLOADER_LEVEL_INFO
  26. default 4 if LOG_BOOTLOADER_LEVEL_DEBUG
  27. default 5 if LOG_BOOTLOADER_LEVEL_VERBOSE
  28. config BOOTLOADER_SPI_WP_PIN
  29. int "SPI Flash WP Pin when customising pins via efuse (read help)"
  30. range 0 33
  31. default 7
  32. depends on FLASHMODE_QIO || FLASHMODE_QOUT
  33. help
  34. This value is ignored unless flash mode is set to QIO or QOUT *and* the SPI flash pins have been
  35. overriden by setting the efuses SPI_PAD_CONFIG_xxx.
  36. When this is the case, the Efuse config only defines 3 of the 4 Quad I/O data pins. The WP pin (aka ESP32
  37. pin "SD_DATA_3" or SPI flash pin "IO2") is not specified in Efuse. That pin number is compiled into the bootloader
  38. instead.
  39. The default value (GPIO 7) is correct for WP pin on ESP32-D2WD integrated flash.
  40. choice BOOTLOADER_VDDSDIO_BOOST
  41. bool "VDDSDIO LDO voltage"
  42. default BOOTLOADER_VDDSDIO_BOOST_1_9V
  43. help
  44. If this option is enabled, and VDDSDIO LDO is set to 1.8V (using EFUSE
  45. or MTDI bootstrapping pin), bootloader will change LDO settings to
  46. output 1.9V instead. This helps prevent flash chip from browning out
  47. during flash programming operations.
  48. This option has no effect if VDDSDIO is set to 3.3V, or if the internal
  49. VDDSDIO regulator is disabled via efuse.
  50. config BOOTLOADER_VDDSDIO_BOOST_1_8V
  51. bool "1.8V"
  52. depends on !ESPTOOLPY_FLASHFREQ_80M
  53. config BOOTLOADER_VDDSDIO_BOOST_1_9V
  54. bool "1.9V"
  55. endchoice
  56. config BOOTLOADER_FACTORY_RESET
  57. bool "GPIO triggers factory reset"
  58. default N
  59. help
  60. Allows to reset the device to factory settings:
  61. - clear one or more data partitions;
  62. - boot from "factory" partition.
  63. The factory reset will occur if there is a GPIO input pulled low while device starts up.
  64. See settings below.
  65. config BOOTLOADER_NUM_PIN_FACTORY_RESET
  66. int "Number of the GPIO input for factory reset"
  67. depends on BOOTLOADER_FACTORY_RESET
  68. range 0 39
  69. default 4
  70. help
  71. The selected GPIO will be configured as an input with internal pull-up enabled.
  72. To trigger a factory reset, this GPIO must be pulled low on reset.
  73. Note that GPIO34-39 do not have an internal pullup and an external one must be provided.
  74. config BOOTLOADER_OTA_DATA_ERASE
  75. bool "Clear OTA data on factory reset (select factory partition)"
  76. depends on BOOTLOADER_FACTORY_RESET
  77. help
  78. The device will boot from "factory" partition (or OTA slot 0 if no factory partition is present) after a factory reset.
  79. config BOOTLOADER_DATA_FACTORY_RESET
  80. string "Comma-separated names of partitions to clear on factory reset"
  81. depends on BOOTLOADER_FACTORY_RESET
  82. default "nvs"
  83. help
  84. Allows customers to select which data partitions will be erased while factory reset.
  85. Specify the names of partitions as a comma-delimited with optional spaces for readability. (Like this: "nvs, phy_init, ...")
  86. Make sure that the name specified in the partition table and here are the same.
  87. Partitions of type "app" cannot be specified here.
  88. config BOOTLOADER_APP_TEST
  89. bool "GPIO triggers boot from test app partition"
  90. default N
  91. help
  92. Allows to run the test app from "TEST" partition.
  93. A boot from "test" partition will occur if there is a GPIO input pulled low while device starts up.
  94. See settings below.
  95. config BOOTLOADER_NUM_PIN_APP_TEST
  96. int "Number of the GPIO input to boot TEST partition"
  97. depends on BOOTLOADER_APP_TEST
  98. range 0 39
  99. default 18
  100. help
  101. The selected GPIO will be configured as an input with internal pull-up enabled.
  102. To trigger a test app, this GPIO must be pulled low on reset.
  103. After the GPIO input is deactivated and the device reboots, the old application will boot.
  104. (factory or OTA[x]).
  105. Note that GPIO34-39 do not have an internal pullup and an external one must be provided.
  106. config BOOTLOADER_HOLD_TIME_GPIO
  107. int "Hold time of GPIO for reset/test mode (seconds)"
  108. depends on BOOTLOADER_FACTORY_RESET || BOOTLOADER_APP_TEST
  109. default 5
  110. help
  111. The GPIO must be held low continuously for this period of time after reset
  112. before a factory reset or test partition boot (as applicable) is performed.
  113. endmenu # Bootloader
  114. menu "Security features"
  115. config SECURE_BOOT_ENABLED
  116. bool "Enable secure boot in bootloader (READ DOCS FIRST)"
  117. default N
  118. help
  119. Build a bootloader which enables secure boot on first boot.
  120. Once enabled, secure boot will not boot a modified bootloader. The bootloader will only load a partition table or boot an app if the data has a verified digital signature. There are implications for reflashing updated apps once secure boot is enabled.
  121. When enabling secure boot, JTAG and ROM BASIC Interpreter are permanently disabled by default.
  122. Refer to https://esp-idf.readthedocs.io/en/latest/security/secure-boot.html before enabling.
  123. choice SECURE_BOOTLOADER_MODE
  124. bool "Secure bootloader mode"
  125. depends on SECURE_BOOT_ENABLED
  126. default SECURE_BOOTLOADER_ONE_TIME_FLASH
  127. config SECURE_BOOTLOADER_ONE_TIME_FLASH
  128. bool "One-time flash"
  129. help
  130. On first boot, the bootloader will generate a key which is not readable externally or by software. A digest is generated from the bootloader image itself. This digest will be verified on each subsequent boot.
  131. Enabling this option means that the bootloader cannot be changed after the first time it is booted.
  132. config SECURE_BOOTLOADER_REFLASHABLE
  133. bool "Reflashable"
  134. help
  135. Generate a reusable secure bootloader key, derived (via SHA-256) from the secure boot signing key.
  136. This allows the secure bootloader to be re-flashed by anyone with access to the secure boot signing key.
  137. This option is less secure than one-time flash, because a leak of the digest key from one device allows reflashing of any device that uses it.
  138. endchoice
  139. config SECURE_BOOT_BUILD_SIGNED_BINARIES
  140. bool "Sign binaries during build"
  141. depends on SECURE_BOOT_ENABLED
  142. default y
  143. help
  144. Once secure boot is enabled, bootloader will only boot if partition table and app image are signed.
  145. If enabled, these binary files are signed as part of the build process. The file named in "Secure boot private signing key" will be used to sign the image.
  146. If disabled, unsigned app/partition data will be built. They must be signed manually using espsecure.py (for example, on a remote signing server.)
  147. config SECURE_BOOT_SIGNING_KEY
  148. string "Secure boot private signing key"
  149. depends on SECURE_BOOT_BUILD_SIGNED_BINARIES
  150. default secure_boot_signing_key.pem
  151. help
  152. Path to the key file used to sign partition tables and app images for secure boot. Once secure boot is enabled, bootloader will only boot if partition table and app image are signed.
  153. Key file is an ECDSA private key (NIST256p curve) in PEM format.
  154. Path is evaluated relative to the project directory.
  155. You can generate a new signing key by running the following command:
  156. espsecure.py generate_signing_key secure_boot_signing_key.pem
  157. See docs/security/secure-boot.rst for details.
  158. config SECURE_BOOT_VERIFICATION_KEY
  159. string "Secure boot public signature verification key"
  160. depends on SECURE_BOOT_ENABLED && !SECURE_BOOT_BUILD_SIGNED_BINARIES
  161. default signature_verification_key.bin
  162. help
  163. Path to a public key file used to verify signed images. This key is compiled into the bootloader,
  164. and may also be used to verify signatures on OTA images after download.
  165. Key file is in raw binary format, and can be extracted from a
  166. PEM formatted private key using the espsecure.py
  167. extract_public_key command.
  168. Refer to https://esp-idf.readthedocs.io/en/latest/security/secure-boot.html before enabling.
  169. config SECURE_BOOT_INSECURE
  170. bool "Allow potentially insecure options"
  171. depends on SECURE_BOOT_ENABLED
  172. default N
  173. help
  174. You can disable some of the default protections offered by secure boot, in order to enable testing or a custom combination of security features.
  175. Only enable these options if you are very sure.
  176. Refer to https://esp-idf.readthedocs.io/en/latest/security/secure-boot.html before enabling.
  177. config FLASH_ENCRYPTION_ENABLED
  178. bool "Enable flash encryption on boot (READ DOCS FIRST)"
  179. default N
  180. help
  181. If this option is set, flash contents will be encrypted by the bootloader on first boot.
  182. Note: After first boot, the system will be permanently encrypted. Re-flashing an encrypted
  183. system is complicated and not always possible.
  184. Read https://esp-idf.readthedocs.io/en/latest/security/flash-encryption.html before enabling.
  185. config FLASH_ENCRYPTION_INSECURE
  186. bool "Allow potentially insecure options"
  187. depends on FLASH_ENCRYPTION_ENABLED
  188. default N
  189. help
  190. You can disable some of the default protections offered by flash encryption, in order to enable testing or a custom combination of security features.
  191. Only enable these options if you are very sure.
  192. Refer to docs/security/secure-boot.rst and docs/security/flash-encryption.rst for details.
  193. menu "Potentially insecure options"
  194. visible if FLASH_ENCRYPTION_INSECURE || SECURE_BOOT_INSECURE
  195. # NOTE: Options in this menu NEED to have SECURE_BOOT_INSECURE
  196. # and/or FLASH_ENCRYPTION_INSECURE in "depends on", as the menu
  197. # itself doesn't enable/disable its children (if it's not set,
  198. # it's possible for the insecure menu to be disabled but the insecure option
  199. # to remain on which is very bad.)
  200. config SECURE_BOOT_ALLOW_ROM_BASIC
  201. bool "Leave ROM BASIC Interpreter available on reset"
  202. depends on SECURE_BOOT_INSECURE || FLASH_ENCRYPTION_INSECURE
  203. default N
  204. help
  205. By default, the BASIC ROM Console starts on reset if no valid bootloader is
  206. read from the flash.
  207. When either flash encryption or secure boot are enabled, the default is to
  208. disable this BASIC fallback mode permanently via efuse.
  209. If this option is set, this efuse is not burned and the BASIC ROM Console may
  210. remain accessible. Only set this option in testing environments.
  211. config SECURE_BOOT_ALLOW_JTAG
  212. bool "Allow JTAG Debugging"
  213. depends on SECURE_BOOT_INSECURE || FLASH_ENCRYPTION_INSECURE
  214. default N
  215. help
  216. If not set (default), the bootloader will permanently disable JTAG (across entire chip) on first boot when either secure boot or flash encryption is enabled.
  217. Setting this option leaves JTAG on for debugging, which negates all protections of flash encryption and some of the protections of secure boot.
  218. Only set this option in testing environments.
  219. config FLASH_ENCRYPTION_UART_BOOTLOADER_ALLOW_ENCRYPT
  220. bool "Leave UART bootloader encryption enabled"
  221. depends on FLASH_ENCRYPTION_INSECURE
  222. default N
  223. help
  224. If not set (default), the bootloader will permanently disable UART bootloader encryption access on first boot. If set, the UART bootloader will still be able to access hardware encryption.
  225. It is recommended to only set this option in testing environments.
  226. config FLASH_ENCRYPTION_UART_BOOTLOADER_ALLOW_DECRYPT
  227. bool "Leave UART bootloader decryption enabled"
  228. depends on FLASH_ENCRYPTION_INSECURE
  229. default N
  230. help
  231. If not set (default), the bootloader will permanently disable UART bootloader decryption access on first boot. If set, the UART bootloader will still be able to access hardware decryption.
  232. Only set this option in testing environments. Setting this option allows complete bypass of flash encryption.
  233. config FLASH_ENCRYPTION_UART_BOOTLOADER_ALLOW_CACHE
  234. bool "Leave UART bootloader flash cache enabled"
  235. depends on FLASH_ENCRYPTION_INSECURE
  236. default N
  237. help
  238. If not set (default), the bootloader will permanently disable UART bootloader flash cache access on first boot. If set, the UART bootloader will still be able to access the flash cache.
  239. Only set this option in testing environments.
  240. config SECURE_BOOT_TEST_MODE
  241. bool "Secure boot test mode: don't permanently set any efuses"
  242. depends on SECURE_BOOT_INSECURE
  243. default N
  244. help
  245. If this option is set, all permanent secure boot changes (via Efuse) are disabled.
  246. Log output will state changes which would be applied, but they will not be.
  247. This option is for testing purposes only - it completely disables secure boot protection.
  248. endmenu # Potentially Insecure
  249. endmenu # Security features