[U-Boot] [PATCH] arm: Allow u-boot to run from offset base address

Wolfgang Denk
2014-06-11T05:02:13Z

Dear Steve,

In message <53979F6A.90607@broadcom.com> you wrote:
>
> Yes - copied from MMC to RAM, but not really necessary to do this at
> "link stage or earlier" (we do it with a post-processing tool to prepend
> a header onto 'u-boot.bin')

What exactly is the fuction of this post-processing tool? Does it
retrieve any data from the previously built image (like size
information), or could the header also be generated before the link
step, so we just include it there?

Also, can we not use the U-Boot build process to generate these 32
bytes of header data?

> > 6. However, because the header is put at the start of the image before
> > the vectors table, the image is still properly aligned but th
> > vectors tabled is not any more, both when the image is loaded from
> > MMC to RAM, and when it is relocated.
>
> Because we set the CONFIG_SYS_TEXT_BASE to 0xXXXX0020, the image is
> properly aligned, if CONFIG_SYS_TEXT_BASE is 0xXXXX0000, then the
> "before" image would not be properly aligned....

...unless your linker script properly aligns all segments.

> We wanted to implement a forward looking solution that worked for any
> size of prepended header, and which removed the constraint for the
> CONFIG_SYS_TEXT_BASE to be an exact multiple of 0x1000 (4096).

The generic approach is to use the linker to define the memory map of
the resulting image, i. e. to create proper alignment of segments
andproper placement of code such that specific address and alignment
requirements are met.

> However, since this solution does not look like it will succeed, in a
> parallel thread, we are pursuing an alternate proposal to conditionally
> reserve space for the header in u-boot.bin (which is "link stage or
> earlier"!!!), which would then be modified by a post-processing tool.

Why would such post-processing be needed? I think you should strive
to get rid of such an additional step, and try to get the header
generation either be done before linking, or even better as integral
part of the build process.

We are talking about 32 bytes of data here, so I speculate it should
not be too difficult to generate these, probably even without theuse
of a special external tool? Can you explain the structure of this 32
byte header?

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
And now remains That we find out the cause of this effect, Or rather
say, the cause of this defect... -- Hamlet, Act II, Scene 2