mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: barebox@lists.infradead.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH v7 06/10] scripts: imx-image: Use a loop to create multiple header copies
Date: Thu, 14 Jun 2018 20:44:05 -0700	[thread overview]
Message-ID: <20180615034409.22180-7-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <20180615034409.22180-1-andrew.smirnov@gmail.com>

Use a loop to create multiple header copies on i.MX35 to avoid code
duplication.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 scripts/imx/imx-image.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/scripts/imx/imx-image.c b/scripts/imx/imx-image.c
index 294f51a90..bc1f821bd 100644
--- a/scripts/imx/imx-image.c
+++ b/scripts/imx/imx-image.c
@@ -679,6 +679,7 @@ int main(int argc, char *argv[])
 	int dcd_only = 0;
 	int now = 0;
 	int sign_image = 0;
+	int i, header_copies;
 	struct config_data data = {
 		.image_dcd_offset = 0xffffffff,
 		.write_mem = write_mem,
@@ -824,13 +825,9 @@ int main(int argc, char *argv[])
 		exit(1);
 	}
 
-	ret = xwrite(outfd, buf, HEADER_LEN);
-	if (ret < 0) {
-		perror("write");
-		exit(1);
-	}
+	header_copies = (data.cpu_type == IMX_CPU_IMX35) ? 2 : 1;
 
-	if (data.cpu_type == IMX_CPU_IMX35) {
+	for (i = 0; i < header_copies; i++) {
 		ret = xwrite(outfd, buf, HEADER_LEN);
 		if (ret < 0) {
 			perror("write");
-- 
2.17.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2018-06-15  3:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-15  3:43 [PATCH v7 00/10] ARM: i.MX8MQ and EVK support Andrey Smirnov
2018-06-15  3:44 ` [PATCH v7 01/10] ARM: i.MX: ocotp: Provide missing .format_mac for i.MX8MQ Andrey Smirnov
2018-06-15  3:44 ` [PATCH v7 02/10] Port <linux/iopoll.h> from U-Boot Andrey Smirnov
2018-06-15  3:44 ` [PATCH v7 03/10] clock: Use udelay() to implement mdelay() Andrey Smirnov
2018-06-15  3:44 ` [PATCH v7 04/10] ARM: i.MX8: Add DDRC PHY support code Andrey Smirnov
2018-06-15  3:44 ` [PATCH v7 05/10] ARM: Specify HAVE_PBL_IMAGE for CPU_64 Andrey Smirnov
2018-06-15  3:44 ` Andrey Smirnov [this message]
2018-06-15  3:44 ` [PATCH v7 07/10] scripts: imx-image: Share the code to write barebox header Andrey Smirnov
2018-06-15  3:44 ` [PATCH v7 08/10] scripts: imx-image: Add i.MX8MQ support Andrey Smirnov
2018-06-15  3:44 ` [PATCH v7 09/10] ARM: i.MX8: Add i.MX8mq EVK support Andrey Smirnov
2018-06-15  3:44 ` [PATCH v7 10/10] ARM: Introduce imx_v8_defconfig Andrey Smirnov
2018-06-15  7:06 ` [PATCH v7 00/10] ARM: i.MX8MQ and EVK support Sascha Hauer
2018-06-15 12:24   ` Andrey Smirnov

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20180615034409.22180-7-andrew.smirnov@gmail.com \
    --to=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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