[PATCH] dfu: add CONFIG_DFU_NAME_MAX_SIZE configuration

Mattijs Korpershoek mkorpershoek at baylibre.com
Tue Oct 31 15:47:10 CET 2023


Hi Jaehoon,

Thank you for your patch.

On lun., juin 20, 2022 at 20:13, Jaehoon Chung <jh80.chung at samsung.com> wrote:

> 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 at samsung.com>

I could not find a maximum size in the DFU 1.1 spec [1] neither in the
dfu-util codebase.

[1] https://www.usb.org/sites/default/files/DFU_1.1.pdf

Reviewed-by: Mattijs Korpershoek <mkorpershoek at baylibre.com>

> ---
>  drivers/dfu/Kconfig | 9 +++++++++
>  include/dfu.h       | 2 +-
>  2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig
> index 8d7f13dcb0b5..a181f0b8d7ba 100644
> --- a/drivers/dfu/Kconfig
> +++ b/drivers/dfu/Kconfig
> @@ -111,5 +111,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
> diff --git a/include/dfu.h b/include/dfu.h
> index dcb9cd9d799a..948596f367d9 100644
> --- a/include/dfu.h
> +++ b/include/dfu.h
> @@ -99,7 +99,7 @@ struct virt_internal_data {
>  	int dev_num;
>  };
>  
> -#define DFU_NAME_SIZE			32
> +#define DFU_NAME_SIZE			CONFIG_DFU_NAME_MAX_SIZE
>  #ifndef DFU_DEFAULT_POLL_TIMEOUT
>  #define DFU_DEFAULT_POLL_TIMEOUT 0
>  #endif
> -- 
> 2.25.1


More information about the U-Boot mailing list