mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] scripts: rk-usb-loader: push header first
@ 2026-03-11 10:03 Sascha Hauer
  2026-03-11 10:13 ` Michael Tretter
  2026-03-13 14:20 ` Sascha Hauer
  0 siblings, 2 replies; 5+ messages in thread
From: Sascha Hauer @ 2026-03-11 10:03 UTC (permalink / raw)
  To: Barebox List; +Cc: Michael Tretter

From: Michael Tretter <m.tretter@pengutronix.de>

Board that have secure boot enabled need the image header to be able
to verify the signature. Boards with secure boot disabled still work
with this patch as tested on a RK3588 board.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 scripts/rk-usb-loader.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/rk-usb-loader.c b/scripts/rk-usb-loader.c
index c9769d79d3..157bb5ad5c 100644
--- a/scripts/rk-usb-loader.c
+++ b/scripts/rk-usb-loader.c
@@ -256,6 +256,11 @@ static int upload_image(const char *filename)
 		goto err;
 	}
 
+	log_info("Uploading header\n");
+	ret = upload(dev, 0x471, hdr, sizeof(*hdr));
+	if (ret)
+		goto err;
+
 	for (i = 0; i < n_files; i++) {
 		struct newidb_entry *entry = &hdr->entries[i];
 		int foffset, fsize, wIndex;
-- 
2.47.3




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

* Re: [PATCH] scripts: rk-usb-loader: push header first
  2026-03-11 10:03 [PATCH] scripts: rk-usb-loader: push header first Sascha Hauer
@ 2026-03-11 10:13 ` Michael Tretter
  2026-03-12  8:29   ` Robin van der Gracht
  2026-03-12 14:02   ` Sascha Hauer
  2026-03-13 14:20 ` Sascha Hauer
  1 sibling, 2 replies; 5+ messages in thread
From: Michael Tretter @ 2026-03-11 10:13 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: Barebox List, Robin van der Gracht

On Wed, 11 Mar 2026 11:03:47 +0100, Sascha Hauer wrote:
> From: Michael Tretter <m.tretter@pengutronix.de>
> 
> Board that have secure boot enabled need the image header to be able
> to verify the signature. Boards with secure boot disabled still work
> with this patch as tested on a RK3588 board.

I'm not against adding this to the rk-usb-loader, but maybe add some
comment that this change is based on a wild guess and works by chance. I
still don't know, how the ROM code or the USB protocol works and if it
is really correct or necessary to send the entire header.

Michael

> 
> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  scripts/rk-usb-loader.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/scripts/rk-usb-loader.c b/scripts/rk-usb-loader.c
> index c9769d79d3..157bb5ad5c 100644
> --- a/scripts/rk-usb-loader.c
> +++ b/scripts/rk-usb-loader.c
> @@ -256,6 +256,11 @@ static int upload_image(const char *filename)
>  		goto err;
>  	}
>  
> +	log_info("Uploading header\n");
> +	ret = upload(dev, 0x471, hdr, sizeof(*hdr));
> +	if (ret)
> +		goto err;
> +
>  	for (i = 0; i < n_files; i++) {
>  		struct newidb_entry *entry = &hdr->entries[i];
>  		int foffset, fsize, wIndex;
> -- 
> 2.47.3
> 
> 



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

* Re: [PATCH] scripts: rk-usb-loader: push header first
  2026-03-11 10:13 ` Michael Tretter
@ 2026-03-12  8:29   ` Robin van der Gracht
  2026-03-12 14:02   ` Sascha Hauer
  1 sibling, 0 replies; 5+ messages in thread
From: Robin van der Gracht @ 2026-03-12  8:29 UTC (permalink / raw)
  To: Michael Tretter, Sascha Hauer; +Cc: Barebox List

Hi Michael,

On 3/11/26 11:13, Michael Tretter wrote:
> On Wed, 11 Mar 2026 11:03:47 +0100, Sascha Hauer wrote:
>> From: Michael Tretter <m.tretter@pengutronix.de>
>>
>> Board that have secure boot enabled need the image header to be able
>> to verify the signature. Boards with secure boot disabled still work
>> with this patch as tested on a RK3588 board.
> I'm not against adding this to the rk-usb-loader, but maybe add some
> comment that this change is based on a wild guess and works by chance. I
> still don't know, how the ROM code or the USB protocol works and if it
> is really correct or necessary to send the entire header.
Right, add it to the list ;)

I already have this change to my repo so I think its great that this 
gets mainlined.

Tested-By: Robin van der Gracht <robin.van.der.gracht@protonic.nl>

- Robin



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

* Re: [PATCH] scripts: rk-usb-loader: push header first
  2026-03-11 10:13 ` Michael Tretter
  2026-03-12  8:29   ` Robin van der Gracht
@ 2026-03-12 14:02   ` Sascha Hauer
  1 sibling, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2026-03-12 14:02 UTC (permalink / raw)
  To: Michael Tretter; +Cc: Barebox List, Robin van der Gracht

On Wed, Mar 11, 2026 at 11:13:47AM +0100, Michael Tretter wrote:
> On Wed, 11 Mar 2026 11:03:47 +0100, Sascha Hauer wrote:
> > From: Michael Tretter <m.tretter@pengutronix.de>
> > 
> > Board that have secure boot enabled need the image header to be able
> > to verify the signature. Boards with secure boot disabled still work
> > with this patch as tested on a RK3588 board.
> 
> I'm not against adding this to the rk-usb-loader, but maybe add some
> comment that this change is based on a wild guess and works by chance. I
> still don't know, how the ROM code or the USB protocol works and if it
> is really correct or necessary to send the entire header.

I can add a comment. FWIW I found another project [1] for a rk-usb-loader
which does exactly the same.

[1] https://github.com/DualTachyon/rk3588-tools/blob/main/rk-usb.c#L117

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

* Re: [PATCH] scripts: rk-usb-loader: push header first
  2026-03-11 10:03 [PATCH] scripts: rk-usb-loader: push header first Sascha Hauer
  2026-03-11 10:13 ` Michael Tretter
@ 2026-03-13 14:20 ` Sascha Hauer
  1 sibling, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2026-03-13 14:20 UTC (permalink / raw)
  To: Barebox List, Sascha Hauer; +Cc: Michael Tretter


On Wed, 11 Mar 2026 11:03:47 +0100, Sascha Hauer wrote:
> Board that have secure boot enabled need the image header to be able
> to verify the signature. Boards with secure boot disabled still work
> with this patch as tested on a RK3588 board.
> 
> 

Applied, thanks!

[1/1] scripts: rk-usb-loader: push header first
      https://git.pengutronix.de/cgit/barebox/commit/?id=4cc52dda164b (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




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

end of thread, other threads:[~2026-03-13 14:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-11 10:03 [PATCH] scripts: rk-usb-loader: push header first Sascha Hauer
2026-03-11 10:13 ` Michael Tretter
2026-03-12  8:29   ` Robin van der Gracht
2026-03-12 14:02   ` Sascha Hauer
2026-03-13 14:20 ` Sascha Hauer

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