public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] dfu: Make the DFU_WRITE_ALT symbol available outside of DFU
@ 2026-03-10 16:26 Tom Rini
  2026-03-12  9:10 ` Mattijs Korpershoek
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Tom Rini @ 2026-03-10 16:26 UTC (permalink / raw)
  To: u-boot
  Cc: Lukasz Majewski, Mattijs Korpershoek, Heinrich Schuchardt,
	Ilias Apalodimas

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.

Signed-off-by: Tom Rini <trini@konsulko.com>
---
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Mattijs Korpershoek <mkorpershoek@kernel.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Ilias Apalodimas <ilias.apalodimas@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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] dfu: Make the DFU_WRITE_ALT symbol available outside of DFU
  2026-03-10 16:26 [PATCH] dfu: Make the DFU_WRITE_ALT symbol available outside of DFU Tom Rini
@ 2026-03-12  9:10 ` Mattijs Korpershoek
  2026-03-12 22:58   ` Tom Rini
  2026-03-13 12:56 ` Ilias Apalodimas
  2026-03-16  9:39 ` Mattijs Korpershoek
  2 siblings, 1 reply; 6+ messages in thread
From: Mattijs Korpershoek @ 2026-03-12  9:10 UTC (permalink / raw)
  To: Tom Rini, u-boot
  Cc: Lukasz Majewski, Mattijs Korpershoek, Heinrich Schuchardt,
	Ilias Apalodimas

Hi Tom,

Thank you for the patch.

On Tue, Mar 10, 2026 at 10:26, Tom Rini <trini@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@konsulko.com>
> ---
> Cc: Lukasz Majewski <lukma@denx.de>
> Cc: Mattijs Korpershoek <mkorpershoek@kernel.org>
> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Cc: Ilias Apalodimas <ilias.apalodimas@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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] dfu: Make the DFU_WRITE_ALT symbol available outside of DFU
  2026-03-12  9:10 ` Mattijs Korpershoek
@ 2026-03-12 22:58   ` Tom Rini
  2026-03-13  8:59     ` Mattijs Korpershoek
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Rini @ 2026-03-12 22:58 UTC (permalink / raw)
  To: Mattijs Korpershoek
  Cc: u-boot, Lukasz Majewski, Heinrich Schuchardt, Ilias Apalodimas

[-- Attachment #1: Type: text/plain, Size: 1480 bytes --]

On Thu, Mar 12, 2026 at 10:10:06AM +0100, Mattijs Korpershoek wrote:
> Hi Tom,
> 
> Thank you for the patch.
> 
> On Tue, Mar 10, 2026 at 10:26, Tom Rini <trini@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() ?

So, to me the challenge is that DFU_TFTP, UPDATE_FIT and UPDATE_TFTP all
are the three users of UPDATE_COMMON and so DFU_WRITE_ALT. The first two
depend on DFU, but the latter does not. And there's nothing in-tree
using it, either (but it does compile I believe, or allyesconfig would
have failed).

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] dfu: Make the DFU_WRITE_ALT symbol available outside of DFU
  2026-03-12 22:58   ` Tom Rini
@ 2026-03-13  8:59     ` Mattijs Korpershoek
  0 siblings, 0 replies; 6+ messages in thread
From: Mattijs Korpershoek @ 2026-03-13  8:59 UTC (permalink / raw)
  To: Tom Rini, Mattijs Korpershoek
  Cc: u-boot, Lukasz Majewski, Heinrich Schuchardt, Ilias Apalodimas

Hi Tom,

On Thu, Mar 12, 2026 at 16:58, Tom Rini <trini@konsulko.com> wrote:

> On Thu, Mar 12, 2026 at 10:10:06AM +0100, Mattijs Korpershoek wrote:
>> Hi Tom,
>>
>> Thank you for the patch.
>>
>> On Tue, Mar 10, 2026 at 10:26, Tom Rini <trini@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() ?
>
> So, to me the challenge is that DFU_TFTP, UPDATE_FIT and UPDATE_TFTP all
> are the three users of UPDATE_COMMON and so DFU_WRITE_ALT. The first two
> depend on DFU, but the latter does not. And there's nothing in-tree
> using it, either (but it does compile I believe, or allyesconfig would
> have failed).

I see, thank you for explaining. I've done some testing on sandbox with
the following diff:

diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 280f9c9cfe77..5bc114bad064 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -16,9 +16,6 @@ CONFIG_EFI_SECURE_BOOT=y
 CONFIG_EFI_RT_VOLATILE_STORE=y
 CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
 CONFIG_EFI_CAPSULE_ON_DISK=y
-CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
-CONFIG_EFI_CAPSULE_AUTHENTICATE=y
-CONFIG_EFI_CAPSULE_CRT_FILE="board/sandbox/capsule_pub_key_good.crt"
 CONFIG_BUTTON_CMD=y
 CONFIG_FIT=y
 CONFIG_FIT_CIPHER=y
@@ -50,6 +47,7 @@ CONFIG_LOGF_FUNC=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 # CONFIG_BOARD_INIT is not set
 CONFIG_STACKPROTECTOR=y
+CONFIG_UPDATE_TFTP=y
 CONFIG_ANDROID_AB=y
 CONFIG_CMD_CPU=y
 CONFIG_CMD_UFETCH=y
@@ -201,7 +199,6 @@ CONFIG_AES_SOFTWARE=y
 CONFIG_DM_DEMO=y
 CONFIG_DM_DEMO_SIMPLE=y
 CONFIG_DM_DEMO_SHAPE=y
-CONFIG_DFU_SF=y
 CONFIG_DMA=y
 CONFIG_DMA_CHANNELS=y
 CONFIG_SANDBOX_DMA=y
@@ -362,7 +359,6 @@ CONFIG_CONSOLE_ROTATION=y
 CONFIG_CONSOLE_TRUETYPE=y
 CONFIG_CONSOLE_TRUETYPE_CANTORAONE=y
 CONFIG_I2C_EDID=y
-CONFIG_VIDEO_SANDBOX_SDL=y
 CONFIG_VIDEO_BRIDGE=y
 CONFIG_VIDEO_BRIDGE_LVDS_CODEC=y
 CONFIG_VIDEO_DSI_HOST_SANDBOX=y

We indeed have:

$ grep -e CONFIG_DFU -e DFU_TFTP -e UPDATE_FIT -e UPDATE_TFTP .config
CONFIG_UPDATE_TFTP=y
CONFIG_UPDATE_TFTP_CNT_MAX=0
CONFIG_UPDATE_TFTP_MSEC_MAX=100
CONFIG_DFU_WRITE_ALT=y

Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>

>
> --
> Tom

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] dfu: Make the DFU_WRITE_ALT symbol available outside of DFU
  2026-03-10 16:26 [PATCH] dfu: Make the DFU_WRITE_ALT symbol available outside of DFU Tom Rini
  2026-03-12  9:10 ` Mattijs Korpershoek
@ 2026-03-13 12:56 ` Ilias Apalodimas
  2026-03-16  9:39 ` Mattijs Korpershoek
  2 siblings, 0 replies; 6+ messages in thread
From: Ilias Apalodimas @ 2026-03-13 12:56 UTC (permalink / raw)
  To: Tom Rini
  Cc: u-boot, Lukasz Majewski, Mattijs Korpershoek, Heinrich Schuchardt

On Tue, 10 Mar 2026 at 18:26, Tom Rini <trini@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.
>
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
> Cc: Lukasz Majewski <lukma@denx.de>
> Cc: Mattijs Korpershoek <mkorpershoek@kernel.org>
> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> ---
>  drivers/dfu/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

>
> 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
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] dfu: Make the DFU_WRITE_ALT symbol available outside of DFU
  2026-03-10 16:26 [PATCH] dfu: Make the DFU_WRITE_ALT symbol available outside of DFU Tom Rini
  2026-03-12  9:10 ` Mattijs Korpershoek
  2026-03-13 12:56 ` Ilias Apalodimas
@ 2026-03-16  9:39 ` Mattijs Korpershoek
  2 siblings, 0 replies; 6+ messages in thread
From: Mattijs Korpershoek @ 2026-03-16  9:39 UTC (permalink / raw)
  To: u-boot, Tom Rini; +Cc: Lukasz Majewski, Heinrich Schuchardt, Ilias Apalodimas

Hi,

On Tue, 10 Mar 2026 10:26:21 -0600, Tom Rini 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.
> 
> 

Thanks, Applied to https://source.denx.de/u-boot/custodians/u-boot-dfu (u-boot-dfu)

[1/1] dfu: Make the DFU_WRITE_ALT symbol available outside of DFU
      https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/4b77b07811c2fb48b4a65ae14c387540ae6b8998

--
Mattijs

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-03-16  9:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-10 16:26 [PATCH] dfu: Make the DFU_WRITE_ALT symbol available outside of DFU Tom Rini
2026-03-12  9:10 ` Mattijs Korpershoek
2026-03-12 22:58   ` Tom Rini
2026-03-13  8:59     ` Mattijs Korpershoek
2026-03-13 12:56 ` Ilias Apalodimas
2026-03-16  9:39 ` Mattijs Korpershoek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox