Skip to content

Commit c6c00e1

Browse files
nordicjmfabiobaltieri
authored andcommitted
mgmt: mcumgr: grp: os_mgmt: Allow bootloader info without MCUboot
Allows enabling the bootloader info functionality without MCUboot being enabled, so that other bootloaders can add hooks with their own responses Signed-off-by: Jamie McCrae <[email protected]>
1 parent 61f4ba2 commit c6c00e1

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,6 @@ config MCUMGR_GRP_OS_INFO_BUILD_DATE_TIME
194194

195195
endif
196196

197-
if BOOTLOADER_MCUBOOT
198-
199197
config MCUMGR_GRP_OS_BOOTLOADER_INFO
200198
bool "Bootloader information"
201199
help
@@ -209,8 +207,6 @@ config MCUMGR_GRP_OS_BOOTLOADER_INFO_HOOK
209207
Supports adding custom responses to the bootloader info command by using registered
210208
callbacks. Data can be appended to the struct provided in the callback.
211209

212-
endif # BOOTLOADER_MCUBOOT
213-
214210
module = MCUMGR_GRP_OS
215211
module-str = mcumgr_grp_os
216212
source "subsys/logging/Kconfig.template.log_config"

subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ os_mgmt_mcumgr_params(struct smp_streamer *ctxt)
423423

424424
#if defined(CONFIG_MCUMGR_GRP_OS_BOOTLOADER_INFO)
425425

426+
#if defined(CONFIG_BOOTLOADER_MCUBOOT)
426427
#if defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP)
427428
#define BOOTLOADER_MODE MCUBOOT_MODE_SINGLE_SLOT
428429
#elif defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_SCRATCH)
@@ -440,6 +441,7 @@ os_mgmt_mcumgr_params(struct smp_streamer *ctxt)
440441
#else
441442
#define BOOTLOADER_MODE -1
442443
#endif
444+
#endif
443445

444446
static int
445447
os_mgmt_bootloader_info(struct smp_streamer *ctxt)
@@ -485,6 +487,7 @@ os_mgmt_bootloader_info(struct smp_streamer *ctxt)
485487
#endif
486488

487489
/* If no parameter is recognized then just introduce the bootloader. */
490+
#if defined(CONFIG_BOOTLOADER_MCUBOOT)
488491
if (decoded == 0) {
489492
ok = zcbor_tstr_put_lit(zse, "bootloader") &&
490493
zcbor_tstr_put_lit(zse, "MCUboot");
@@ -499,7 +502,9 @@ os_mgmt_bootloader_info(struct smp_streamer *ctxt)
499502
ok = ok && zcbor_tstr_put_lit(zse, "no-downgrade") &&
500503
zcbor_bool_encode(zse, &(bool){true});
501504
#endif
502-
} else {
505+
} else
506+
#endif
507+
{
503508
return OS_MGMT_ERR_QUERY_YIELDS_NO_ANSWER;
504509
}
505510

0 commit comments

Comments
 (0)