public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] Separately compile Master boot loader
Date: Wed, 10 Jul 2013 14:23:01 +0200	[thread overview]
Message-ID: <20130710142301.666459d8@lilith> (raw)
In-Reply-To: <CAONsvZXoceB7NLSd7xUCqQmhAquXSX-Wdpgb3iUcLdWra5jAXQ@mail.gmail.com>

Hi Rajdeep,

On Wed, 10 Jul 2013 15:04:12 +0530, Rajdeep Vaghasia
<rajdeep.vaghasia@gmail.com> wrote:

> Waiting for a reply.

Well, maybe if you had not e-mailed your 8:32 AM answer to me but to
the list... :)

Here it is, with my comments.

> On Tue, Jul 9, 2013 at 5:31 PM, Albert ARIBAUD <albert.u.boot@aribaud.net>wrote:
> 
> > Hi Rajdeep,
> >
> > On Tue, 9 Jul 2013 16:12:14 +0530, Rajdeep Vaghasia
> > <rajdeep.vaghasia@gmail.com> wrote:
> >
> > > Hi
> > > I am working on one board with an arm11 based cpu, NOR flash and DDR2
> > SDRAM.
> > > When I compile u-boot source code, I get u-boot.bin image generated.
> > > This image has primary(second stage) and secondary(third stage)
> > bootloader
> > > combined.
> > >
> > > I have following queries:
> > > 1) The question that still eats me everyday is, How can I compile
> > > primary(Master) boot loader and secondary boot loader separately?
> > > 2) I want to Flash only initial 4kb of code (Master boot loader or second
> > > stage). The remaining code I want to keep at another partition in the
> > > Flash. How can I achieve this?
> > > 3) Is there any separate code available for Master boot loader, which
> > > copies the third stage bootloader to SDRAM and then transfers control to
> > > that third stage boot loader(u-boot)?
> > >
> > > I am unable to find a way to do this.
> > >
> > > Can anyone help me please?
> >
> > Since you do not indicate exactly which target you're building, I'll
> > assume it is one with SPL (what you describe as master or second stage,
> > with third stage being u-boot itself).
> >
> > I don't know of a way to build SPL alone.
> >
> > As for building separate U-Boot and SPL, you'll find them in ELF format
> > in file ./u-boot and ./spl/u-boot-spl. You can then use
> > $(CROSS_COMPILE)objcopy to convert from ELF to .bin.
> >
> > Note that your target may need a specific format different from the
> > pure binary that objcopy can produce.
> >
> > Can you tell us more about your target?
> >
> > Amicalement,
> > --
> > Albert.
> >
> 
> Sorry, My target board is not with SPL.

Then your question does not make sense, since a target without SPL has
no "second" and "third" stage, only a single standalone U-Boot stage.

> According to my understanding, SPL is required when we want to use NAND or
> oneNAND flash. And even in that case, the image generated, is combined of
> u-boot.bin+nand_driver.

This is quite reductive and partly wrong. 

SPL is required when you cannot directly boot into U-boot, one of the
cases being when you boot from NAND as it usually only allows very small
binaries; but NAND is far from the only case where SPL is needed or
useful.

Also, as I said, the image generated in the SPL case is not "u-boot +
NAND driver", it is "complete SPL + complete U-Boot" (although you can
have them separate as I explained), and the "complete SPL" part is not
itself an "U-Boot plus NAND driver".

> I am using NOR flash.

Ok.

> Actually, I am building firmware upgrade procedure.
> For that I need 3 partitions for u-boot.
> One with master u-boot.
> Other two with u-boot-1 and u-boot-2. (One contains current working u-boot,
> whereas another is with upgraded u-boot code).
> For that I need one Master uboot which contains code that initializes the
> SDRAM, choses one of the 2 secondary u-boot with the help of an environment
> variable (Or fixed jump to the start address of u-boot-1 or u-boot-2) and
> then copies u-boot(Secondary boot loader) to SDRAM and executes it from
> there.

Ok, so "secondary" is a concept specific to your design. No wonder I
could not understand it properly until you explained.

> These steps of initializing SDRAM and copying of u-boot code there, are
> already implemented in u-boot code. I just want to separate it from the
> main source code and want to generate binary of that much code only.
> 
> Is there any way to achieve this?

Several; and then there is an infinity of other possible approaches,
depending, not on *what* you want to do, but on *why* you want to do
it. Can you give more details on why your firmware upgrade procedure
needs to boot two different U-Boots  ?

> or
> Is there any resource of information available which can help me to
> understand this?

The source code and the Denx website, at this point; once you explain
the goal you are trying to reach, people on the list might point you
to more specific resources.

> Rajdeep.

Amicalement,
-- 
Albert.

  reply	other threads:[~2013-07-10 12:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-09 10:42 [U-Boot] Separately compile Master boot loader Rajdeep Vaghasia
2013-07-09 12:01 ` Albert ARIBAUD
2013-07-10  9:34 ` Rajdeep Vaghasia
2013-07-10 12:23   ` Albert ARIBAUD [this message]
2013-07-11  5:27     ` Rajdeep Vaghasia
2013-07-11  8:35       ` Albert ARIBAUD
2013-07-11  9:11         ` [U-Boot] [RFC] Multiple binaries per U-Boot target (was: Separately compile Master boot loader) Albert ARIBAUD
2013-07-19 15:27           ` [U-Boot] [RFC] Multiple binaries per U-Boot target Sascha Silbe
2013-07-19 16:53             ` Simon Glass
2013-07-19 18:12               ` Albert ARIBAUD
2013-07-19 18:14                 ` Simon Glass
2013-07-19 19:27                 ` Wolfgang Denk
2013-07-19 21:09                   ` Albert ARIBAUD
2013-07-19 22:32                     ` Wolfgang Denk
2013-07-20  7:15                       ` Albert ARIBAUD
2013-07-19 19:26             ` Wolfgang Denk
2013-07-11 10:08         ` [U-Boot] Separately compile Master boot loader Wolfgang Denk
2013-07-11 10:25           ` Albert ARIBAUD
2013-07-11  9:58       ` Wolfgang Denk

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=20130710142301.666459d8@lilith \
    --to=albert.u.boot@aribaud.net \
    --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