mcu-tools / mcuboot

Secure boot for 32-bit Microcontrollers!
Apache License 2.0
1.34k stars 674 forks source link

zephyr: `CONFIG_BOOT_MAX_IMG_SECTORS` is not configurable for downstream platforms #1919

Closed JordanYates closed 1 month ago

JordanYates commented 7 months ago

Problem

The BOOT_MAX_IMG_SECTORS setup currently requires modifications to the mcuboot repo to support boards with non-default values.

https://github.com/mcu-tools/mcuboot/blob/5d067f0e0ca7639b8c1f9aa2804c8718caae2440/boot/zephyr/Kconfig#L383-L390

Because this file is the absolute first contents of the kconfig tree, there is no ability to update this default on a per-board basis.

https://github.com/mcu-tools/mcuboot/blob/5d067f0e0ca7639b8c1f9aa2804c8718caae2440/boot/zephyr/Kconfig#L758

As a result, there are board specific overlays in this application that for purposes of maintability really should be set wherever the board is defined, e.g: https://github.com/mcu-tools/mcuboot/blob/5d067f0e0ca7639b8c1f9aa2804c8718caae2440/boot/zephyr/boards/lpcxpresso55s28.conf#L1-L6

The only way to set this value is explicitly via CONFIG_BOOT_MAX_IMG_SECTORS=N. This is only possible from the command line or by modifying the mcuboot application. Attempting to set it in a board_defconfig file results in compilation errors as the symbol only exists for the bootloader application.

Expected behaviour

Defaults for the zephyr bootloader that reasonably could change on a per-board basis should be configurable in the same location that the board is defined.

github-actions[bot] commented 1 month ago

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.