From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-pf0-x231.google.com ([2607:f8b0:400e:c00::231]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fTffG-0004Vi-Tf for barebox@lists.infradead.org; Fri, 15 Jun 2018 03:44:52 +0000 Received: by mail-pf0-x231.google.com with SMTP id h12-v6so4217996pfk.11 for ; Thu, 14 Jun 2018 20:44:32 -0700 (PDT) From: Andrey Smirnov Date: Thu, 14 Jun 2018 20:44:05 -0700 Message-Id: <20180615034409.22180-7-andrew.smirnov@gmail.com> In-Reply-To: <20180615034409.22180-1-andrew.smirnov@gmail.com> References: <20180615034409.22180-1-andrew.smirnov@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH v7 06/10] scripts: imx-image: Use a loop to create multiple header copies To: barebox@lists.infradead.org Cc: Andrey Smirnov Use a loop to create multiple header copies on i.MX35 to avoid code duplication. Signed-off-by: Andrey Smirnov --- 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