[U-Boot-Users] Changing u-boot relocation scheme

vb vb at vsbe.com
Fri Jul 25 16:51:41 CEST 2008


On Fri, Jul 25, 2008 at 7:33 AM, kenneth johansson <kenneth at southpole.se> wrote:

>
> here is a patch to generate dynamic relocations in the elf file. What is
> the next step? objcopy -j .rela.dyn -O binary  u-boot dyn_reloc_table ??
>
> ----------------
> --- config.mk
> +++ config.mk
> @@ -215,7 +215,8 @@
>
>  AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
>
> -LDFLAGS += -Bstatic -T $(LDSCRIPT) $(PLATFORM_LDFLAGS)
> +#LDFLAGS += -Bstatic -T $(LDSCRIPT) $(PLATFORM_LDFLAGS)
> +LDFLAGS += -Bstatic -shared -T $(LDSCRIPT) $(PLATFORM_LDFLAGS)
>  ifneq ($(TEXT_BASE),)
>  LDFLAGS += -Ttext $(TEXT_BASE)
>  endif
>

Interesting, but after this step we have a file which can't be
converted to a runnable binary without resolving the relocation
information first, right? This is not good then, as we need something
to run from reset.

I think this discussion covers much more ground than needed: certainly
the problem of running the same executable at different addresses has
been solved many times over, for different architectures and file
formats. The thing is that unless we want the loader be part of u-boot
we can not use those standard solutions. And I don't think we want,
because it would be an unnecessary complication.

I still believe that my original suggestion of determining the
addresses of pointers to relocate by comparing to stripped binaries is
the simplest way to do it across architectures. Apparently the same
could be achieved by using -mrelocatable on powerPc, this still
remains to  be seen.

cheers,
/vb

>
>




More information about the U-Boot mailing list