Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zephyr: CONFIG_BOOT_MAX_IMG_SECTORS is not configurable for downstream platforms #1919

Open
JordanYates opened this issue Mar 15, 2024 · 0 comments · May be fixed by #1920
Open

zephyr: CONFIG_BOOT_MAX_IMG_SECTORS is not configurable for downstream platforms #1919

JordanYates opened this issue Mar 15, 2024 · 0 comments · May be fixed by #1920

Comments

@JordanYates
Copy link

Problem

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

mcuboot/boot/zephyr/Kconfig

Lines 383 to 390 in 5d067f0

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.

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.

source "Kconfig.zephyr"

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:

# Copyright 2023 NXP
# SPDX-License-Identifier: Apache-2.0
#LPC does not support the MCUBoot swap mode.
CONFIG_BOOT_UPGRADE_ONLY=y
CONFIG_BOOT_MAX_IMG_SECTORS=512

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.

JordanYates pushed a commit to JordanYates/mcuboot that referenced this issue Mar 15, 2024
Add a symbol to allow the default value of `BOOT_MAX_IMG_SECTORS` to be
updated by external kconfig files.

${BOARD_ROOT}/board/kconfig.default
```
// This board requires at least 206 sectors
config BOOT_MAX_IMG_SECTORS_OVERRIDE
	bool "Override default value"
	default y if MCUBOOT

config BOOT_MAX_IMG_SECTORS
	int "Override default value"
	depends on MCUBOOT
	default 256
```

Resolves mcu-tools#1919

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
@JordanYates JordanYates linked a pull request Mar 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant