10 Jan, 2014

31 commits


09 Jan, 2014

9 commits

  • Signed-off-by: David Feng

    David Feng
     
  • Signed-off-by: David Feng
    Signed-off-by: Bhupesh Sharma

    David Feng
     
  • Signed-off-by: David Feng

    David Feng
     
  • Relocation code based on a patch by Scott Wood, which is:
    Signed-off-by: Scott Wood

    Signed-off-by: David Feng

    David Feng
     
  • Signed-off-by: Scott Wood
    Signed-off-by: David Feng

    Scott Wood
     
  • While performing relocations on u-boot.bin should be good enough for
    booting on real hardware, some simulators insist on booting an ELF file
    (and yet don't perform ELF relocations), so convert the relocated
    binary back into an ELF file. This can go away in the future if we
    change relocate-rela to operate directly on the ELF file, or if and
    when we stop caring about a simulator with this restriction.

    Signed-off-by: Scott Wood
    Signed-off-by: David Feng

    Scott Wood
     
  • ARM64 uses the newer RELA-style relocations rather than the older REL.
    RELA relocations have an addend in the relocation struct, rather than
    expecting the loader to read a value from the location to be updated.

    While this is beneficial for ordinary program loading, it's problematic
    for U-Boot because the location to be updated starts out with zero,
    rather than a pre-relocation value. Since we need to be able to run C
    code before relocation, we need a tool to apply the relocations at
    build time.

    In theory this tool is applicable to other newer architectures (mainly
    64-bit), but currently the only relocations it supports are for arm64,
    and it assumes a 64-bit little-endian target. If the latter limitation
    is ever to be changed, we'll need a way to tell the tool what format
    the image is in. Eventually this may be replaced by a tool that uses
    libelf or similar and operates directly on the ELF file. I've written
    some code for such an approach but libelf does not make it easy to poke
    addresses by memory address (rather than by section), and I was
    hesitant to write code to manually parse the program headers and do the
    update outside of libelf (or to iterate over sections) -- especially
    since it wouldn't get test coverage on things like binaries with
    multiple PT_LOAD segments. This should be good enough for now to let
    the manual relocation stuff be removed from the arm64 patches.

    Signed-off-by: Scott Wood
    Signed-off-by: David Feng

    Scott Wood
     
  • Signed-off-by: David Feng

    David Feng
     
  • Signed-off-by: David Feng

    David Feng