diff --git a/subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig index bb2ae92053c..8839d3664a3 100644 --- a/subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig @@ -194,8 +194,6 @@ config MCUMGR_GRP_OS_INFO_BUILD_DATE_TIME endif -if BOOTLOADER_MCUBOOT - config MCUMGR_GRP_OS_BOOTLOADER_INFO bool "Bootloader information" help @@ -209,8 +207,6 @@ config MCUMGR_GRP_OS_BOOTLOADER_INFO_HOOK Supports adding custom responses to the bootloader info command by using registered callbacks. Data can be appended to the struct provided in the callback. -endif # BOOTLOADER_MCUBOOT - module = MCUMGR_GRP_OS module-str = mcumgr_grp_os source "subsys/logging/Kconfig.template.log_config" diff --git a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c index 15342fcb936..648f3842705 100644 --- a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c @@ -423,6 +423,7 @@ os_mgmt_mcumgr_params(struct smp_streamer *ctxt) #if defined(CONFIG_MCUMGR_GRP_OS_BOOTLOADER_INFO) +#if defined(CONFIG_BOOTLOADER_MCUBOOT) #if defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP) #define BOOTLOADER_MODE MCUBOOT_MODE_SINGLE_SLOT #elif defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_SCRATCH) @@ -440,6 +441,7 @@ os_mgmt_mcumgr_params(struct smp_streamer *ctxt) #else #define BOOTLOADER_MODE -1 #endif +#endif static int os_mgmt_bootloader_info(struct smp_streamer *ctxt) @@ -485,6 +487,7 @@ os_mgmt_bootloader_info(struct smp_streamer *ctxt) #endif /* If no parameter is recognized then just introduce the bootloader. */ +#if defined(CONFIG_BOOTLOADER_MCUBOOT) if (decoded == 0) { ok = zcbor_tstr_put_lit(zse, "bootloader") && zcbor_tstr_put_lit(zse, "MCUboot"); @@ -499,8 +502,10 @@ os_mgmt_bootloader_info(struct smp_streamer *ctxt) ok = ok && zcbor_tstr_put_lit(zse, "no-downgrade") && zcbor_bool_encode(zse, &(bool){true}); #endif - } else { - return OS_MGMT_ERR_QUERY_YIELDS_NO_ANSWER; + } else +#endif + { + ok = smp_add_cmd_err(zse, MGMT_GROUP_ID_OS, OS_MGMT_ERR_QUERY_YIELDS_NO_ANSWER); } return ok ? MGMT_ERR_EOK : MGMT_ERR_EMSGSIZE;