public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/4] imx: Align the imximage header and payload to multiples of 4k
Date: Mon, 25 Feb 2013 22:07:49 +0100	[thread overview]
Message-ID: <201302252207.49803.marex@denx.de> (raw)
In-Reply-To: <485665541.106371.1361819618703.JavaMail.root@advansee.com>

Dear Beno?t Th?baudeau,

> On Monday, February 25, 2013 7:19:55 PM, Marek Vasut wrote:
> > The MX53 ROM loads the data from NAND in multiples of pages and
> > supports maximum page size of 4k. Thus, align the image and header
> > to 4k to be safe from ROM bugs.
> > 
> > Signed-off-by: Marek Vasut <marex@denx.de>
> > Cc: Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>
> > Cc: Fabio Estevam <fabio.estevam@freescale.com>
> > Cc: Stefano Babic <sbabic@denx.de>
> > ---
> > 
> >  tools/imximage.c |   11 +++++++----
> >  tools/imximage.h |    3 ++-
> >  2 files changed, 9 insertions(+), 5 deletions(-)
> > 
> > diff --git a/tools/imximage.c b/tools/imximage.c
> > index fa308c9..c018562 100644
> > --- a/tools/imximage.c
> > +++ b/tools/imximage.c
> > @@ -518,11 +518,14 @@ static void imximage_set_header(void *ptr, struct
> > stat *sbuf, int ifd,
> > 
> >  	/*
> >  	
> >  	 * ROM bug alert
> > 
> > -	 * mx53 only loads 512 byte multiples.
> > -	 * The remaining fraction of a block bytes would
> > -	 * not be loaded.
> > +	 *
> > +	 * MX53 only loads 512 byte multiples in case of SD boot.
> > +	 * MX53 only loads NAND page multiples in case of NAND boot and
> > +	 * supports up to 4096 byte large pages, thus align to 4096.
> > +	 *
> > +	 * The remaining fraction of a block bytes would not be loaded!
> > 
> >  	 */
> > 
> > -	*header_size_ptr = ROUND(sbuf->st_size + imxhdr->flash_offset, 512);
> > +	*header_size_ptr = ROUND(sbuf->st_size + imxhdr->flash_offset, 4096);
> > 
> >  }
> >  
> >  int imximage_check_params(struct mkimage_params *params)
> > 
> > diff --git a/tools/imximage.h b/tools/imximage.h
> > index 42b6090..dfd2e9e 100644
> > --- a/tools/imximage.h
> > +++ b/tools/imximage.h
> > @@ -151,13 +151,14 @@ typedef struct {
> > 
> >  	dcd_v2_t dcd_table;
> >  
> >  } imx_header_v2_t;
> > 
> > +/* The header must be aligned to 4k on MX53 for NAND boot */
> > 
> >  struct imx_header {
> >  
> >  	union {
> >  	
> >  		imx_header_v1_t hdr_v1;
> >  		imx_header_v2_t hdr_v2;
> >  	
> >  	} header;
> >  	uint32_t flash_offset;
> > 
> > -};
> > +} __attribute__((aligned(4096)));
> 
> So what is the exact rule for the image start page in the FCB? Is it just
> 0x400 + 4096 + start page * page size? This does not seem to match table
> 7-12, unless 0 has a special meaning?

I believe it's '0 == offset 4096 in NAND', do you happen to have board with 4k 
page NAND to verify this?

> >  typedef void (*set_dcd_val_t)(struct imx_header *imxhdr,
> >  
> >  					char *name, int lineno,
> > 
> > --
> > 1.7.10.4
> 
> Best regards,
> Beno?t

Best regards,
Marek Vasut

  reply	other threads:[~2013-02-25 21:07 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-25 18:19 [U-Boot] [PATCH 1/4] common: imx: Implement generic u-boot.nand target Marek Vasut
2013-02-25 18:19 ` [U-Boot] [PATCH 2/4] imx: Align the imximage header and payload to multiples of 4k Marek Vasut
2013-02-25 19:13   ` Benoît Thébaudeau
2013-02-25 21:07     ` Marek Vasut [this message]
2013-02-25 21:16       ` Benoît Thébaudeau
2013-02-25 18:19 ` [U-Boot] [PATCH 3/4] mx5: Add NAND clock handling Marek Vasut
2013-02-25 19:27   ` Benoît Thébaudeau
2013-02-25 18:24 ` [U-Boot] [PATCH 4/4] mx5: Add support for DENX M53EVK Marek Vasut
2013-02-25 19:33   ` Benoît Thébaudeau
2013-02-26 13:52   ` Fabio Estevam
2013-02-26 19:32   ` Fabio Estevam
2013-04-14 17:20     ` Marek Vasut
2013-04-14 19:07       ` Wolfgang Denk
2013-04-14 19:18         ` Marek Vasut
2013-02-25 18:51 ` [U-Boot] [PATCH 1/4] common: imx: Implement generic u-boot.nand target Benoît Thébaudeau
2013-02-25 21:09   ` Marek Vasut
2013-02-25 21:13     ` Benoît Thébaudeau
2013-02-26  1:02   ` [U-Boot] patch error wanxs
2013-02-25 20:10 ` [U-Boot] [PATCH 1/4] common: imx: Implement generic u-boot.nand target Scott Wood
2013-02-25 21:10   ` Marek Vasut
2013-02-25 22:15     ` Scott Wood
2013-02-25 23:03       ` Marek Vasut
2013-02-25 23:07         ` Scott Wood
2013-02-25 23:50           ` Benoît Thébaudeau
2013-02-26  7:19             ` Marek Vasut
2013-02-26 11:33               ` Benoît Thébaudeau
2013-02-27 17:33                 ` Tom Rini
2013-02-28 18:50                   ` Marek Vasut
2013-02-28 18:53                     ` Tom Rini
2013-02-26  7:17           ` Marek Vasut
2013-02-26 23:10             ` Scott Wood
2013-02-27 22:18 ` Benoît Thébaudeau
2013-02-27 23:44   ` Tom Rini
2013-02-27 23:47     ` Benoît Thébaudeau
2013-02-28 12:18       ` Benoît Thébaudeau
2013-02-28 14:03   ` Tom Rini
2013-02-28 15:24     ` Benoît Thébaudeau
2013-02-28 16:06       ` Benoît Thébaudeau
2013-02-28 16:21         ` Tom Rini
2013-02-28 16:29           ` Benoît Thébaudeau
2013-02-28 16:42             ` Tom Rini

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=201302252207.49803.marex@denx.de \
    --to=marex@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