mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <>
To: Barebox List <>
Subject: [PATCH 09/12] imx-usb-loader: Fix first stage length
Date: Thu, 14 Jul 2022 09:27:19 +0200	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On most SoCs the IVT header is not at the beginning of the image but at
offset 0x400. As we skip the leading 0x400 bytes while uploading we can
substract that offset from the image size we upload. This shouldn't make
a difference now, but in future we might change the two-staged upload
process: Now we upload the PBL once and afterwards the full image
incuding the same PBL again. It would be more elegant to upload the PBL
only once and only the rest of the image afterwards. If we do so, it it
important to exactly upload the first stage so that barebox on the other
end receives exactly the second stage at the offset it expects it to be.

Signed-off-by: Sascha Hauer <>
 scripts/imx/imx-usb-loader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c
index b2c835225c..f4f13d5cc7 100644
--- a/scripts/imx/imx-usb-loader.c
+++ b/scripts/imx/imx-usb-loader.c
@@ -1271,7 +1271,7 @@ static int get_dl_start(const unsigned char *p, const unsigned char *file_start,
 		bd = (void *)_bd;
-		*firststage_len = bd->size;
+		*firststage_len = bd->size - (hdr->self - bd->start);
 		*plugin = bd->plugin;
 		bd->plugin = 0;

  parent reply	other threads:[~2022-07-14  7:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14  7:27 [PATCH 00/12] imx-usb-loader support for i.MX8MP Sascha Hauer
2022-07-14  7:27 ` [PATCH 01/12] ARM: i.MX8MM: Prepare loading only piggydata in imx-usb-loader Sascha Hauer
2022-07-14  7:27 ` [PATCH 02/12] ARM: i.MX8M: Add romapi support Sascha Hauer
2022-07-14  7:27 ` [PATCH 03/12] ARM: i.MX8MP: Add common code to load image and jump to it via TF-A Sascha Hauer
2022-07-14  7:27 ` [PATCH 04/12] ARM: i.MX8MP-EVK: Use imx8mp_load_and_start_image_via_tfa() Sascha Hauer
2022-07-14  7:27 ` [PATCH 05/12] imx-usb-loader: Factor out common code to function Sascha Hauer
2022-07-14  7:27 ` [PATCH 06/12] imx-usb-loader: rename mxs functions Sascha Hauer
2022-07-14  7:27 ` [PATCH 07/12] imx-usb-loader: Add i.MX8MP support Sascha Hauer
2022-07-29  9:33   ` Marco Felsch
2022-08-08 12:20     ` Sascha Hauer
2022-07-14  7:27 ` [PATCH 08/12] imx-usb-loader: drop some casting Sascha Hauer
2022-07-14  7:27 ` Sascha Hauer [this message]
2022-07-14  7:27 ` [PATCH 10/12] imx-usb-loader: simplify read_memory() Sascha Hauer
2022-07-14  7:27 ` [PATCH 11/12] imx-usb-loader: verify correct image length Sascha Hauer
2022-07-14  7:27 ` [PATCH 12/12] imx-usb-loader: drop some unnecessary casting Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox