dfu: add CONFIG_DFU_NAME_MAX_SIZE configuration

Add CONFIG_DFU_NAME_MAX_SIZE to change the proper size.
If name is longer than default size, it can do wrong behavior during updating
image. So it need to change the proper maximum size.

This patch is proviced the solution to change value with configuration.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Link: https://lore.kernel.org/r/20220620111354.448512-1-jh80.chung@samsung.com
[mkorpershoek: fixed build errors for dfu.h includes]
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
This commit is contained in:
Jaehoon Chung 2022-06-20 20:13:54 +09:00 committed by Mattijs Korpershoek
parent dca7a8958f
commit f490623309
2 changed files with 14 additions and 0 deletions

View File

@ -112,5 +112,14 @@ config SYS_DFU_MAX_FILE_SIZE
the buffer once we've been given the whole file. Define
this to the maximum filesize (in bytes) for the buffer.
If undefined it defaults to the CONFIG_SYS_DFU_DATA_BUF_SIZE.
config DFU_NAME_MAX_SIZE
int "Size of the name to be added in dfu entity"
default 32
depends on DFU
help
This value is used to maximum size. If name is longer than default size,
we need to change the proper maximum size.
endif
endmenu

View File

@ -98,7 +98,12 @@ struct virt_internal_data {
int dev_num;
};
#if defined(CONFIG_DFU_NAME_MAX_SIZE)
#define DFU_NAME_SIZE CONFIG_DFU_NAME_MAX_SIZE
#else
#define DFU_NAME_SIZE 32
#endif
#ifndef DFU_DEFAULT_POLL_TIMEOUT
#define DFU_DEFAULT_POLL_TIMEOUT 0
#endif