From patchwork Wed Aug 20 08:55:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ye Li X-Patchwork-Id: 381660 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 7272514013B for ; Wed, 20 Aug 2014 22:38:39 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6EDDCA7446; Wed, 20 Aug 2014 14:38:36 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id H9eLHS15FpXh; Wed, 20 Aug 2014 14:38:35 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AA8C3A73F3; Wed, 20 Aug 2014 14:38:31 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D681C4A04A for ; Wed, 20 Aug 2014 11:10:58 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wrOQzkBo8ITg for ; Wed, 20 Aug 2014 11:10:55 +0200 (CEST) X-Greylist: delayed 882 seconds by postgrey-1.27 at theia; Wed, 20 Aug 2014 11:10:50 CEST X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2lp0238.outbound.protection.outlook.com [207.46.163.238]) by theia.denx.de (Postfix) with ESMTPS id A43514A040 for ; Wed, 20 Aug 2014 11:10:50 +0200 (CEST) Received: from BN3PR0301CA0066.namprd03.prod.outlook.com (25.160.152.162) by BN1PR03MB251.namprd03.prod.outlook.com (10.255.200.18) with Microsoft SMTP Server (TLS) id 15.0.1005.10; Wed, 20 Aug 2014 08:55:54 +0000 Received: from BN1BFFO11FD037.protection.gbl (2a01:111:f400:7c10::1:149) by BN3PR0301CA0066.outlook.office365.com (2a01:111:e400:401e::34) with Microsoft SMTP Server (TLS) id 15.0.1010.18 via Frontend Transport; Wed, 20 Aug 2014 08:55:54 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BN1BFFO11FD037.mail.protection.outlook.com (10.58.144.100) with Microsoft SMTP Server (TLS) id 15.0.1010.11 via Frontend Transport; Wed, 20 Aug 2014 08:55:54 +0000 Received: from dissersh1-WorkStation.ap.freescale.net (dissersh1-WorkStation.ap.freescale.net [10.192.241.185]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id s7K8tovZ001629; Wed, 20 Aug 2014 01:55:51 -0700 From: Ye.Li To: Date: Wed, 20 Aug 2014 16:55:32 +0800 Message-ID: <1408524932-26712-1-git-send-email-Ye.Li@freescale.com> X-Mailer: git-send-email 1.7.9.5 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(6009001)(199003)(189002)(106466001)(2351001)(77156001)(110136001)(104166001)(74662001)(81156004)(229853001)(102836001)(69596002)(68736004)(107046002)(50226001)(77982001)(36756003)(95666004)(4396001)(105606002)(50986999)(26826002)(79102001)(81542001)(104016003)(19580405001)(86362001)(47776003)(88136002)(87936001)(97736001)(84676001)(19580395003)(83322001)(6806004)(89996001)(20776003)(50466002)(44976005)(92726001)(46102001)(31966008)(87286001)(99396002)(74502001)(76482001)(81342001)(64706001)(85306004)(80022001)(21056001)(85852003)(62966002)(83072002)(92566001)(48376002)(93916002); DIR:OUT; SFP:; SCL:1; SRVR:BN1PR03MB251; H:az84smr01.freescale.net; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;UriScan:; X-Forefront-PRVS: 03094A4065 Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=Ye.Li@freescale.com; X-OriginatorOrg: freescale.com X-Mailman-Approved-At: Wed, 20 Aug 2014 14:38:29 +0200 Cc: fabio.estevam@freescale.com, u-boot@lists.denx.de Subject: [U-Boot] [PATCH] imximage: Fix imximage IVT bug for EIM-NOR boot X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: "Ye.Li" The load region size of EIM-NOR are defined to 0. For this case, the parameter "imximage_init_loadsize" must be calculated. The imximage tool implements the calculation in the "imximage_generate" function, but the following function "imximage_set_header" resets the value and not calculate. This bug cause some fields of IVT head are not correct, for example the boot_data and DCD overlay the application area. Signed-off-by: Ye.Li --- tools/imximage.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/imximage.c b/tools/imximage.c index 18dc051..faba238 100644 --- a/tools/imximage.c +++ b/tools/imximage.c @@ -568,6 +568,13 @@ static void imximage_set_header(void *ptr, struct stat *sbuf, int ifd, /* Parse dcd configuration file */ dcd_len = parse_cfg_file(imxhdr, params->imagename); + if (imximage_version == IMXIMAGE_V2) { + if (imximage_init_loadsize < imximage_ivt_offset + + sizeof(imx_header_v2_t)) + imximage_init_loadsize = imximage_ivt_offset + + sizeof(imx_header_v2_t); + } + /* Set the imx header */ (*set_imx_hdr)(imxhdr, dcd_len, params->ep, imximage_ivt_offset);