[PATCH] dfu: Make the DFU_WRITE_ALT symbol available outside of DFU

Mattijs Korpershoek mkorpershoek at kernel.org
Thu Mar 12 10:10:06 CET 2026


Hi Tom,

Thank you for the patch.

On Tue, Mar 10, 2026 at 10:26, Tom Rini <trini at konsulko.com> wrote:

> The DFU_WRITE_ALT symbol is used both directly and indirectly (via
> UPDATE_COMMON) for EFI capsule updates (FIT or raw), but does not depend
> on DFU itself. Move this symbol outside of "if DFU" to remove a Kconfig
> dependency problem.

Looking at drivers/dfu/dfu_alt.c both dfu_write_by_name() and
dfu_write_by_alt() seem to rely on functions from drivers/dfu/dfu.c such
as dfu_init_env_entities(), dfu_get_entity() and more.

Looking at UPDATE_COMMON, I see:
config UPDATE_COMMON
	bool
	select DFU_WRITE_ALT
	imply CMD_TFTPBOOT

And if we check the code in common/update.c, we can see that
dfu_write_by_name() is called.

So fit_update() calls
   dfu_write_by_name() which calls
       dfu_init_env_entities() which might no longer be defined when
                               applying this patch.

I'm not sure how is this supposed to work. Do we have to stub
dfu_init_env_entities() ?

>
> Signed-off-by: Tom Rini <trini at konsulko.com>
> ---
> Cc: Lukasz Majewski <lukma at denx.de>
> Cc: Mattijs Korpershoek <mkorpershoek at kernel.org>
> Cc: Heinrich Schuchardt <xypron.glpk at gmx.de>
> Cc: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> ---
>  drivers/dfu/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig
> index 2cf4289b4486..962bda40ad2d 100644
> --- a/drivers/dfu/Kconfig
> +++ b/drivers/dfu/Kconfig
> @@ -13,10 +13,10 @@ config DFU_OVER_TFTP
>  	bool
>  	depends on NET
>  
> -if DFU
>  config DFU_WRITE_ALT
>  	bool
>  
> +if DFU
>  config DFU_TFTP
>  	bool "DFU via TFTP"
>  	depends on NETDEVICES
> -- 
> 2.43.0


More information about the U-Boot mailing list