diff --git a/boot/zephyr/Kconfig b/boot/zephyr/Kconfig index 99b5a5cd..b7c707c7 100644 --- a/boot/zephyr/Kconfig +++ b/boot/zephyr/Kconfig @@ -567,7 +567,7 @@ config BOOT_ERASE_PROGRESSIVELY on some hardware that has long erase times, to prevent long wait times at the beginning of the DFU process. -config ENABLE_MGMT_PERUSER +menuconfig ENABLE_MGMT_PERUSER bool "Enable system specific mcumgr commands" depends on BOOT_SERIAL_UART help @@ -577,6 +577,14 @@ config ENABLE_MGMT_PERUSER These are system specific command and system specific implementation function is required to process these commands. +if ENABLE_MGMT_PERUSER +config BOOT_MGMT_CUSTOM_IMG_LIST + bool "Enable custom image list command" + help + The option enables command which returns versions and installation + statuses (custom property) for all images. + +endif # ENABLE_MGMT_PERUSER endif # MCUBOOT_SERIAL config BOOT_INTR_VEC_RELOC diff --git a/boot/zephyr/boot_serial_extensions.c b/boot/zephyr/boot_serial_extensions.c index 88f84adf..3cd801c1 100644 --- a/boot/zephyr/boot_serial_extensions.c +++ b/boot/zephyr/boot_serial_extensions.c @@ -50,6 +50,7 @@ static int bs_custom_storage_erase(cbor_state_t *cs) return rc; } +#ifdef MCUBOOT_MGMT_CUSTOM_IMG_LIST static int custom_img_status(int image_index, uint32_t slot,char *buffer, ssize_t len) { @@ -117,6 +118,8 @@ static int bs_custom_img_list(cbor_state_t *cs) #ifndef ZEPHYR_MGMT_GRP_BASIC_CMD_IMAGE_LIST #define ZEPHYR_MGMT_GRP_BASIC_CMD_IMAGE_LIST 1 #endif +#endif /*MCUBOOT_MGMT_CUSTOM_IMG_LIST*/ + int bs_peruser_system_specific(const struct nmgr_hdr *hdr, const char *buffer, int len, cbor_state_t *cs) { @@ -128,9 +131,11 @@ int bs_peruser_system_specific(const struct nmgr_hdr *hdr, const char *buffer, mgmt_rc = bs_custom_storage_erase(cs); } } else if (hdr->nh_op == NMGR_OP_READ) { +#ifdef MCUBOOT_MGMT_CUSTOM_IMG_LIST if (hdr->nh_id == ZEPHYR_MGMT_GRP_BASIC_CMD_IMAGE_LIST) { mgmt_rc = bs_custom_img_list(cs); } +#endif } } diff --git a/boot/zephyr/include/mcuboot_config/mcuboot_config.h b/boot/zephyr/include/mcuboot_config/mcuboot_config.h index 0de69740..ed62d98e 100644 --- a/boot/zephyr/include/mcuboot_config/mcuboot_config.h +++ b/boot/zephyr/include/mcuboot_config/mcuboot_config.h @@ -151,6 +151,10 @@ #define MCUBOOT_PERUSER_MGMT_GROUP_ENABLED 0 #endif +#ifdef CONFIG_BOOT_MGMT_CUSTOM_IMG_LIST +#define MCUBOOT_MGMT_CUSTOM_IMG_LIST +#endif + /* * The configuration option enables direct image upload with the * serial recovery.