public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] imximage: Fix imximage IVT bug for EIM-NOR boot
Date: Wed, 20 Aug 2014 11:44:07 +0200	[thread overview]
Message-ID: <53F46DE7.2050504@denx.de> (raw)
In-Reply-To: <1408524932-26712-1-git-send-email-Ye.Li@freescale.com>

Hi Ye,

On 20/08/2014 10:55, Ye.Li wrote:
> From: "Ye.Li" <Ye.Li@freescale.com>
> 
> 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 <B37916@freescale.com>
> ---
>  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);
> +	}
> +

Agree that this must be fixed for NOR flash. I am checking where the fix
should be done.

As far as I see, there are multiple entry involved in the computation:

387       if (imximage_init_loadsize < imximage_ivt_offset)
388          imximage_init_loadsize = imximage_ivt_offset;

It seems more logical that the check should be here.

The other point is:

#define FLASH_LOADSIZE_NOR              0x0 /* entire image */

Well, if the comment is correct (with NOR the SOC can load the entire
image and there is no limit as with other storage), setting it to "0"
has nothing to do with it.
Then it seems to me clearer something at line 372:

if (!imximage_init_loadsize && imximage_version == IMXIMAGE_V2)
			imximage_init_loadsize = imximage_ivt_offset +
				sizeof(imx_header_v2_t);

What do you think ?

Best regards,
Stefano Babic




-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================

  reply	other threads:[~2014-08-20  9:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-20  8:55 [U-Boot] [PATCH] imximage: Fix imximage IVT bug for EIM-NOR boot Ye.Li
2014-08-20  9:44 ` Stefano Babic [this message]
2014-08-21  7:04   ` Li Ye-B37916
2014-09-09 14:38     ` Stefano Babic

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=53F46DE7.2050504@denx.de \
    --to=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    /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