elf2flt questions

Bernd Schmidt bernds_cb1 at t-online.de
Thu Jun 5 00:34:52 UTC 2008


Denys Vlasenko wrote:
> I want to do it in "Linux from scratch" style. This way,
> I will get better understanding of the way it is done,
> and possibly stumble upon rough edges in busybox,
> uclubc, etc. This will lead to "itch scratching"
> and bug fixing.

It will also lead to unnecessary pain.

> elf binaries, it says "BINFMT_FLAT: bad magic/rev (0x1010100, need 0x5)".

One thing I just remembered is that we used to have non-standard flat 
files.  Version 5 doesn't exist in any tools/kernels other than ancient 
Blackfin distributions.  Our tools were fixed long ago to generate 
version 4 flat binaries.  With a modern toolchain you can't actually 
produce binaries that will run on the 2005 kernel you're using (never 
mind that it's totally bug-infested anyway), so please upgrade that 
first.  There's a u-boot installed on your board, surely?

> To be honest, building it was somewhat contrived - I copied the directory
> into binutils' build dir and gave it all necessary configure parameters,
> and it still could not find e.g. elf/bfin.h - had to add some include paths
> by hand. (Do you want a more detailed report about this?)

No.  Use the buildscript or look at how it does things.

> Looking into ld-elf2flt makes me doubtful -
> "LINKER="$0.real" # the original renamed-linker" - really? It will rename
> my linker and replace it by itself?

Yes.  There'll be bfin-uclinux-ld and bfin-uclinux-ld.real, the former 
being the ld-elf2flt script which in turn calls the real ld and the 
elf2flt binary.

> This script looks rather contrived,
> will it really work correctly for all possible invocations of ld which
> don't even want to do any elf2flt-ification?

So far we've not had reports to the contrary.

> Can you write up a small explanation what elf2flt does, how to produce
> a flat executable with it? Let's say in my situation - I seem to have
> correctly built static elf bfin busybox, can I make a flat one out of it?

Nope.  It's lacking the relocs.

> What is this ld-elf2flt wrapper - what is it doing?

Calling ld and elf2flt in a way to generate correct flat binaries.


Bernd
-- 
This footer brought to you by insane German lawmakers.
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft Muenchen, Registergericht Muenchen HRB 40368
Geschaeftsfuehrer Thomas Wessel, William A. Martin, Margaret Seif



More information about the uClibc mailing list