public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v7 13/19] Makefile: u-boot-with-spl.bin: Fix SPL padding
Date: Mon, 18 Feb 2013 20:30:09 +0100 (CET)	[thread overview]
Message-ID: <567228252.1556679.1361215809621.JavaMail.root@advansee.com> (raw)
In-Reply-To: <1361214682.14186.13@snotra>

Hi Scott,

On Monday, February 18, 2013 8:11:22 PM, Scott Wood wrote:
> On 02/18/2013 12:52:51 PM, Beno?t Th?baudeau wrote:
> > On Monday, February 18, 2013 7:24:51 PM, Scott Wood wrote:
> > > On 02/18/2013 12:22:58 PM, Beno?t Th?baudeau wrote:
> > > > On Monday, February 18, 2013 7:02:49 PM, Scott Wood wrote:
> > > > > On 02/18/2013 12:00:52 PM, Beno?t Th?baudeau wrote:
> > > > > > The only question is if we may need to have an empty gap
> > between
> > > > the
> > > > > > SPL and
> > > > > > U-Boot within the resulting image. I don't think so since that
> > > > would
> > > > > > mean that
> > > > > > the target memory device has an area that is not really
> > available
> > > > at
> > > > > > the
> > > > > > location of this gap.
> > > > >
> > > > > Why not allow that possibility?
> > > >
> > > > To save a config setting (there are already many for SPL) if this
> > is
> > > > not
> > > > strictly required, but also for the reason below.
> > > >
> > > > >  Maybe it's easier for the SPL to load
> > > > > from a particular offset (e.g. NAND starting at the beginning
> > of a
> > > > > block)?
> > > >
> > > > CONFIG_SPL_MAX_SIZE would be closer to a NAND mapping in that case
> > > > (e.g. size of
> > > > 1 NAND Flash block) than CONFIG_SPL_PAD_TO (address within RAM
> > that
> > > > should be
> > > > considered relatively to CONFIG_SPL_TEXT_BASE to get the NAND
> > offset).
> > >
> > > CONFIG_SPL_PAD_TO is for the placement of the payload
> > 
> > Correct.
> > 
> > > -- and it's not a
> > > RAM address.
> > 
> > It doesn't have to be, but it may be for some configs.
> 
> Right.  My point is it shouldn't be defined as a RAM address.
> 
> > >  Currently it is a link address (or zero if the linker
> > > script handles padding, or padding is not required for other
> > reasons).
> > 
> > Correct.
> > 
> > > With your patch it it is a file offset, IIUC.
> > 
> > With my patch, it is nothing at all since only CONFIG_SPL_MAX_SIZE is
> > used.
> 
> Sorry, I just meant with your change to how objcopy is invoked.  What
> you pass into objcopy is a file offset.
> 
> > > CONFIG_SPL_MAX_SIZE is what it says -- the maximum size that the SPL
> > > may be, ideally to be enforced by the linker script.
> > 
> > Correct.
> > 
> > > They are different.  An SPL wanting the payload to begin as a block
> > > boundary does not mean the hardware is suddenly capable of loading
> > an
> > > entire block of SPL.
> > 
> > Sure, but my question is: Why would you want to have a 2-kiB SPL
> > followed by a
> > 126-kiB gap before the payload? Why couldn't you place the payload on
> > the 1st
> > page boundary after the SPL?
> 
> You can, and we usually do.  But size-limited SPLs may want to simplify
> (e.g. bad block detection needs some special logic to handle beginning
> inside a block), and it may not always be 126 KiB.
> 
> E.g. MPC8313ERDB uses small-page NAND, so it's only 12KiB that gets
> wasted.  It currently has MAX_SIZE of 4KiB but PAD_TO of base plus
> 16KiB.
> 
> > If there are hardware constraints or something that make
> > CONFIG_SPL_PAD_TO
> > useful in some cases, then let's use it, but otherwise, why keep it?
> 
> It's easier to mainain orthogonality (and use defaults for simplicity)
> than to restore it after the fact if we need it later.
> 
> > And if we keep it, do we change it to an image offset, or do we keep
> > it as a
> > link address?
> 
> Changing to an image offset sounds good.
> 
> > > > Also, CONFIG_SPL_PAD_TO and CONFIG_SPL_MAX_SIZE depend on each
> > other:
> > > > If both
> > > > can be defined, you may change one forgetting the other one, which
> > > > could e.g.
> > > > result in an overlapping of SPL and U-Boot that won't show up at
> > > > build time
> > > > (with CONFIG_SPL_MAX_SIZE = 0x1000 and CONFIG_SPL_PAD_TO =
> > > > CONFIG_SPL_TEXT_BASE
> > > > + 0x800, the SPL would build fine, and objcopy wouldn't complain).
> > >
> > > So add a check that CONFIG_SPL_PAD_TO >= CONFIG_SPL_MAX_SIZE
> > (assuming
> > > the new interpretation of CONFIG_SPL_PAD_TO as a file offset), and
> > let
> > > CONFIG_SPL_PAD_TO default to CONFIG_SPL_MAX_SIZE if not set.
> > 
> > That would make sense. The current default value of 0 for
> > CONFIG_SPL_PAD_TO does
> > not make sense since it means that the SPL can't know where the
> > payload is
> > located within the image.
> 
> CONFIG_SPL_PAD_TO is not the mechanism that is used for finding the
> payload.  On mpc85xx it is unnecessary because the SPL will always be
> fixed size, because the reset vector goes at the end.  It's also
> possible that some SPLs could use linker symbols to find the end of the
> SPL, if they want to pack more tightly.

Thanks for all the clarifications.

So I will make a v8 with CONFIG_SPL_PAD_TO as an image offset, and use it to
generate u-boot-with-spl.bin. But first, I will wait for more feedback on v7
(Fabio should give his test results this week), and for Stefano to re-sync
u-boot-imx/master with u-boot/master.

Best regards,
Beno?t

  reply	other threads:[~2013-02-18 19:30 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-15 20:54 [U-Boot] [PATCH v7 01/19] nand: mxc: Prepare to add support for i.MX5 Benoît Thébaudeau
2013-02-15 20:54 ` [U-Boot] [PATCH v7 02/19] nand: mxc: Add " Benoît Thébaudeau
2013-02-26 15:33   ` Fabio Estevam
2013-02-26 16:08     ` Benoît Thébaudeau
2013-02-26 16:35       ` Fabio Estevam
2013-02-26 16:49         ` Benoît Thébaudeau
2013-02-26 17:03           ` Fabio Estevam
2013-02-26 17:08             ` Benoît Thébaudeau
2013-02-15 20:54 ` [U-Boot] [PATCH v7 03/19] imx: mx5: lowlevel_init: Simplify code Benoît Thébaudeau
2013-02-15 20:54 ` [U-Boot] [PATCH v7 04/19] imx: mx53ard: Add support for NAND Flash Benoît Thébaudeau
2013-02-26 13:22   ` Fabio Estevam
2013-02-26 13:35     ` Fabio Estevam
2013-02-26 14:21       ` Fabio Estevam
2013-02-26 16:53         ` Benoît Thébaudeau
2013-02-26 17:33           ` Fabio Estevam
2013-02-15 20:54 ` [U-Boot] [PATCH v7 05/19] nand: mxc: Fix debug trace in mxc_nand_read_oob_syndrome() Benoît Thébaudeau
2013-02-15 20:54 ` [U-Boot] [PATCH v7 06/19] nand: mxc: Use appropriate page number in syndrome functions Benoît Thébaudeau
2013-02-19  0:30   ` Scott Wood
2013-02-19 11:31     ` Benoît Thébaudeau
2013-02-15 20:54 ` [U-Boot] [PATCH v7 07/19] arm: start.S: Fix _TEXT_BASE for SPL Benoît Thébaudeau
2013-02-15 20:54 ` [U-Boot] [PATCH v7 08/19] arm: relocate_code() is no longer noreturn Benoît Thébaudeau
2013-02-15 20:54 ` [U-Boot] [PATCH v7 09/19] arm1136: Remove redundant relocate_code() return Benoît Thébaudeau
2013-02-15 20:54 ` [U-Boot] [PATCH v7 10/19] arm: relocate_code(): Remove useless relocation offset computation Benoît Thébaudeau
2013-02-15 20:54 ` [U-Boot] [PATCH v7 11/19] arm: relocate_code(): Use __image_copy_end for end of relocation Benoît Thébaudeau
2013-02-16 18:47   ` Albert ARIBAUD
2013-02-16 19:54     ` Benoît Thébaudeau
2013-02-17 14:30       ` Albert ARIBAUD
2013-02-15 20:54 ` [U-Boot] [PATCH v7 12/19] arm: crt0.S: Remove bogus .globl Benoît Thébaudeau
2013-02-15 20:54 ` [U-Boot] [PATCH v7 13/19] Makefile: u-boot-with-spl.bin: Fix SPL padding Benoît Thébaudeau
2013-02-17 16:16   ` Benoît Thébaudeau
2013-02-18 12:28     ` Benoît Thébaudeau
2013-02-18 17:58       ` Scott Wood
2013-02-18 16:50     ` Tom Rini
2013-02-18 17:26       ` Benoît Thébaudeau
2013-02-18 17:27         ` Tom Rini
2013-02-18 18:00           ` Benoît Thébaudeau
2013-02-18 18:02             ` Scott Wood
2013-02-18 18:22               ` Benoît Thébaudeau
2013-02-18 18:24                 ` Scott Wood
2013-02-18 18:52                   ` Benoît Thébaudeau
2013-02-18 19:11                     ` Scott Wood
2013-02-18 19:30                       ` Benoît Thébaudeau [this message]
2013-02-22 17:36                         ` Fabio Estevam
2013-02-22 18:05                           ` Benoît Thébaudeau
2013-02-18 19:37     ` Scott Wood
2013-02-18 19:52       ` Benoît Thébaudeau
2013-02-18 19:47         ` Scott Wood
2013-02-18 20:01           ` Benoît Thébaudeau
2013-02-18 20:06             ` Scott Wood
2013-02-18 20:16               ` Benoît Thébaudeau
2013-02-15 20:54 ` [U-Boot] [PATCH v7 14/19] imx: Fix automatic make targets for imx images Benoît Thébaudeau
2013-02-15 20:54 ` [U-Boot] [PATCH v7 15/19] nand: mxc: Switch NAND SPL to generic SPL Benoît Thébaudeau
2013-02-22 19:14   ` Fabio Estevam
2013-02-22 19:30     ` Fabio Estevam
2013-02-22 20:09       ` Benoît Thébaudeau
2013-02-22 20:55         ` Troy Kisky
2013-02-22 21:07           ` Fabio Estevam
2013-02-22 23:09           ` Marek Vasut
2013-02-22 21:06         ` Fabio Estevam
2013-02-22 21:13           ` Benoît Thébaudeau
2013-02-22 21:26             ` Fabio Estevam
2013-02-22 21:24               ` Benoît Thébaudeau
2013-02-22 21:30             ` Troy Kisky
2013-02-22 21:27               ` Benoît Thébaudeau
2013-02-22 21:31                 ` Benoît Thébaudeau
2013-02-22 21:40                   ` Benoît Thébaudeau
2013-02-22 21:53                   ` Fabio Estevam
2013-02-22 21:51               ` Fabio Estevam
2013-02-22 22:02                 ` Fabio Estevam
2013-02-22 22:03                   ` Fabio Estevam
2013-02-22 22:08                     ` Fabio Estevam
2013-02-22 22:42                       ` Benoît Thébaudeau
2013-02-22 22:56                         ` Fabio Estevam
2013-02-22 23:11                           ` Marek Vasut
2013-02-22 23:12                             ` Benoît Thébaudeau
2013-02-22 23:56                               ` Marek Vasut
2013-02-23  0:55                                 ` Benoît Thébaudeau
2013-02-15 20:54 ` [U-Boot] [PATCH v7 16/19] arm926ejs: Remove deprecated and now unused NAND SPL Benoît Thébaudeau
2013-02-17 15:51   ` Benoît Thébaudeau
2013-02-17 16:04     ` Albert ARIBAUD
2013-02-17 16:08       ` Albert ARIBAUD
2013-02-17 16:25         ` Benoît Thébaudeau
2013-02-18 12:24           ` Benoît Thébaudeau
2013-02-18 16:40     ` Tom Rini
2013-02-18 20:39       ` Benoît Thébaudeau
2013-02-18 20:56         ` Tom Rini
2013-02-15 20:54 ` [U-Boot] [PATCH v7 17/19] arm: Remove unused relocate_code() parameters Benoît Thébaudeau
2013-02-15 20:54 ` [U-Boot] [PATCH v7 18/19] imx: Add u-boot-with-spl.imx make target Benoît Thébaudeau
2013-02-15 20:54 ` [U-Boot] [PATCH v7 19/19] imx: Add u-boot-with-nand-spl.imx " Benoît Thébaudeau

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=567228252.1556679.1361215809621.JavaMail.root@advansee.com \
    --to=benoit.thebaudeau@advansee.com \
    --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