[Toybox] I merged mkroot.

Rob Landley rob at landley.net
Sat Aug 24 09:57:57 PDT 2019


On 8/24/19 11:56 AM, Rob Landley wrote:
> Right now it's detecting architecture for the kernel build from the cross
> compiler prefix (so it works for the musl-cross-make compiler names), I might
> instead run file against the toybox binary and try to parse the output, but
> that's not in yet.

P.S. the sed expression to parse the output of file isn't _that_ bad if I
implement "file -b"...

$ ./toybox file -b ~/www/toybox/downloads/binaries/0.8.0/* | \
  sed 's/[^,]*, \([^,]*\),.*/\1/'
64-bit LSB arm64
32-bit LSB arm
32-bit LSB arm
32-bit LSB arm
32-bit LSB arm
32-bit LSB arm
32-bit LSB 386
32-bit LSB 386
32-bit MSB m68k
32-bit MSB microblaze
32-bit MSB mips
64-bit MSB mips
32-bit LSB mips
32-bit MSB ppc
64-bit MSB ppc64
64-bit LSB ppc64
64-bit MSB s390
32-bit MSB sh
32-bit LSB sh
32-bit LSB x86-64
64-bit LSB x86-64

But that's not distinguishing between i486 and i686, or between armv5l, armv7l,
and cortex-m. (Seriously, cortex-m is a _thumb_ binary, it's not even the same
instruction set! Why did they give it the same ELF signature?)

Without the sed, those 32 bit arm variants become:

ELF executable, 32-bit LSB arm, static, stripped
ELF executable, 32-bit LSB arm, static, stripped
ELF executable, 32-bit LSB arm, static, stripped
ELF shared object, 32-bit LSB arm, stripped
ELF shared object, 32-bit LSB arm, stripped

So you can at least spot the static PIE binaries (arm fdpic is still out of
tree), but armv7m and armv7r aren't distinguishable here. (m is the thumb-only
processor, r is nommu but conventional arm32 instruction set).

Hmmm...

Rob




More information about the Toybox mailing list