public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Changing u-boot relocation scheme
Date: Thu, 24 Jul 2008 05:18:26 +0200	[thread overview]
Message-ID: <20080724031826.CA044248B9@gemini.denx.de> (raw)
In-Reply-To: Your message of "Wed, 23 Jul 2008 10:39:00 PDT." <f608b67d0807231039i434e96dbvda86590776db2cb0@mail.gmail.com>

In message <f608b67d0807231039i434e96dbvda86590776db2cb0@mail.gmail.com> you wrote:
> 
> I wonder if you would consider (and accept a patch) changing the
> u-boot architecture as described below.

Consider: always. Accept: if it makes more sense than the current
implementation.

> As we all are well aware u-boot is a great software package which
> speeds up bringing up new hardware immensely, its popularity is
> obviously growing very fast. One thing which (IMO anyway) slows down
> its acceptance is the way it handles relocating of itself into an
> arbitrary DRAM area. (Arbitrary meaning that it depends on many
> factors and the exact address can't be assigned ahead of time).

The address is not arbitrary, and in fact it CANNOT be determined in
advance, especially on boards with varying RAM sized (for example
using standard DIMMs). Since U-Boot will relocate itself normally to
the end of the available RAM, you cannot know the relocation address
in advance. Also, for example things like the PRAM size can be set by
the user through environment variables - again this will cause the
relocation address to become variable.

> While this relocation is seamless for u-boot in its released form, it
> becomes a pain each time a module needs to be added (not necessarily
> for following release to the Open Source community, for instance used
> for inhouse installations which include tens of thousand units for
> some companies). If these added modules were not written in position
> independent manner (namely, using structures with multiple stage
> indirect pointers interleaved with data), the effort to make these
> modules work in u-boot is very exhausting.

I don't understand what you mean. Either you link statically with the
U-Boot image, or you use standalone programs. In both situations no
such problem as described by you exists.

> Here is the suggested alternative. I will talk about recent PPC
> platforms, but it could be done very similar for most of the other
> platforms I believe.

I don't think so.

> In general the PPC u-boot image consists of three parts: the bulk of

No, this is by far not general, not even for PPC.

> Now, let's say we link and purge the bulk section twice, once locating
> it at offset 0 and once at the normal u-boot TEXT_BASE, building two
> binary images (not including the top 4k in both cases).
> 
> Then we compare the two images and identify all locations which are
> different. All these locations are 4 byte aligned, and all differ by
> the same amount - equal TEXT_BASE. Now we can build a table of offsets
> which need to be changed when the program is moved into a different
> location, include this table in the resulting image between the bulk
> and the startup page, and use this table when relocating code.

Why would we do that? The compiler already generates such a table for
free - the GOT.

> Basically, this implements a poor man's loader, and it will be
> sufficient in case the image we are dealing with is a flat binary
> (which is of course the case with u-boot). This will allow to add any
> code to u-boot without much worries about being able to relocate it
> properly. We would do away with storing certain structures in certain
> sections, dealing with GOT, etc.

I don't see how your "poor man's" GOT would be any better than the
compiler generated one - except that it's horribly non-standard and
glumpsy?

> I made some experiments, and this seems feasible, this could be done
> as a local customization, but I would much prefer to release it to the
> u-boot community and make it part of mainline - will you consider such
> a patch?

I don't understand which problem you're trying to fix, and I don't see
that your solution would be any better than what we have now.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I object to intellect without discipline;  I object to power without
constructive purpose.
	-- Spock, "The Squire of Gothos", stardate 2124.5

  parent reply	other threads:[~2008-07-24  3:18 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-23 17:39 [U-Boot-Users] Changing u-boot relocation scheme vb
2008-07-23 21:46 ` Jerry Van Baren
2008-07-23 22:46   ` vb
2008-07-24  3:18     ` Wolfgang Denk
2008-07-24  6:45       ` vb
2008-07-24  9:58         ` Haavard Skinnemoen
2008-07-24 13:47           ` vb
2008-07-24 12:23         ` Jerry Van Baren
2008-07-24 12:47         ` Kenneth Johansson
2008-07-24 13:50           ` vb
2008-07-24 13:01         ` Wolfgang Denk
2008-07-24 13:17           ` Kenneth Johansson
2008-07-24 16:57             ` Haavard Skinnemoen
2008-07-24 17:12               ` Kenneth Johansson
2008-07-25  9:16                 ` Haavard Skinnemoen
2008-07-24 17:37               ` vb
2008-07-24 18:09                 ` Kenneth Johansson
2008-07-24 18:26                   ` vb
2008-07-24 18:32                     ` Joakim Tjernlund
2008-07-24 18:41                     ` Kenneth Johansson
2008-07-25  4:28                   ` Wolfgang Denk
2008-07-26  5:48                   ` Grant Likely
2008-07-26  7:53                     ` kenneth johansson
2008-07-26 12:48                       ` Grant Likely
2008-07-25  4:28               ` Wolfgang Denk
2008-07-25  9:10                 ` Haavard Skinnemoen
2008-07-25 11:55                   ` kenneth johansson
2008-07-25 12:19                     ` Haavard Skinnemoen
2008-07-25 13:30                       ` Joakim Tjernlund
2008-07-26  5:36                         ` Wolfgang Denk
2008-07-25 14:33                       ` kenneth johansson
2008-07-25 14:51                         ` vb
2008-07-25 15:21                           ` Jerry Van Baren
2008-07-25 18:50                             ` Haavard Skinnemoen
2008-07-25 19:03                               ` Jerry Van Baren
2008-07-26  5:36                               ` Wolfgang Denk
2008-07-26 16:09                                 ` Haavard Skinnemoen
2008-07-26  6:06                               ` Grant Likely
2008-07-26  6:11                                 ` Grant Likely
2008-07-26 12:49                                 ` Wolfgang Denk
2008-07-26  5:36                           ` Wolfgang Denk
2008-07-26  5:51                             ` vb
2008-07-25 15:23                         ` Haavard Skinnemoen
2008-07-25 16:31                           ` kenneth johansson
2008-07-25 17:02                             ` Jerry Van Baren
2008-07-25 17:28                               ` kenneth johansson
2008-07-25 18:35                                 ` Haavard Skinnemoen
2008-07-25 19:57                                   ` J. William Campbell
2008-07-25 20:51                                   ` kenneth johansson
2008-07-26 15:54                                     ` Haavard Skinnemoen
2008-07-26 21:29                                       ` J. William Campbell
2008-07-26 21:58                                         ` Haavard Skinnemoen
2008-07-27  0:15                                           ` J. William Campbell
2008-07-26  5:36                                 ` Wolfgang Denk
2008-07-26  7:41                                   ` kenneth johansson
2008-07-26 12:49                                     ` Wolfgang Denk
2008-07-26  5:57                                 ` Grant Likely
2008-07-26 14:03                                   ` Jean-Christophe PLAGNIOL-VILLARD
2008-07-26 14:29                                     ` Joakim Tjernlund
2008-07-25 16:48                           ` J. William Campbell
2008-07-25  4:28             ` Wolfgang Denk
2008-07-24 13:45         ` Jon Loeliger
2008-07-24 13:52           ` vb
2008-07-26  5:43         ` Grant Likely
2008-07-26  5:54           ` vb
2008-07-26  6:20             ` Grant Likely
2008-07-24  3:18 ` Wolfgang Denk [this message]
2008-07-24  6:20 ` Robert Schwebel
2008-09-15 14:56 ` [U-Boot] " vb

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=20080724031826.CA044248B9@gemini.denx.de \
    --to=wd@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