[PATCH 03/20] scripts: imx-image: Add extra code path for i.MX35

Sascha Hauer s.hauer at pengutronix.de
Tue Jun 23 09:15:49 EDT 2020


The i.MX35 writes two copies of the header at the beginning of the
image. This is written in a loop right now. Make the i.MX35 an extra
code path so that it is out of the way for the changes in the next
patches.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 scripts/imx/imx-image.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/scripts/imx/imx-image.c b/scripts/imx/imx-image.c
index 04c707cb7f..edff3580dd 100644
--- a/scripts/imx/imx-image.c
+++ b/scripts/imx/imx-image.c
@@ -781,7 +781,6 @@ int main(int argc, char *argv[])
 	int outfd;
 	int dcd_only = 0;
 	int now = 0;
-	int i, header_copies;
 	int add_barebox_header;
 	uint32_t barebox_image_size = 0;
 	struct config_data data = {
@@ -978,9 +977,13 @@ int main(int argc, char *argv[])
 		exit(1);
 	}
 
-	header_copies = (data.cpu_type == IMX_CPU_IMX35) ? 2 : 1;
-
-	for (i = 0; i < header_copies; i++) {
+	if (data.cpu_type == IMX_CPU_IMX35) {
+		xwrite(outfd, add_barebox_header ? bb_header : buf,
+		       sizeof_bb_header);
+		xwrite(outfd, buf + sizeof_bb_header,
+		       header_len - sizeof_bb_header);
+		xwrite(outfd, buf, header_len);
+	} else {
 		xwrite(outfd, add_barebox_header ? bb_header : buf,
 		       sizeof_bb_header);
 
-- 
2.27.0




More information about the barebox mailing list