New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build target armel (not armhf), for legacy armv5-like devices (i.e: parrot airdrone) #5060

Merged
merged 1 commit into from Jun 1, 2016

Conversation

Projects
None yet
4 participants
@brainstorm
Contributor

brainstorm commented Jun 1, 2016

Built with https://github.com/thewtex/cross-compilers, this way:

docker run thewtex/cross-compiler-linux-armv5 > ~/bin/dockcross && chmod +x ~/bin/dockcross
dockcross --image thewtex/cross-compiler-linux-armv5 ./configure --with-compiler=armel --host=armel
dockcross make

Then it compiles ARMv5 binaries in my Macbook Air:

mba-3:radare2 romanvg$ uname -a
Darwin mba-3.local 14.5.0 Darwin Kernel Version 14.5.0: Mon Jan 11 18:48:35 PST 2016; root:xnu-2782.50.2~1/RELEASE_X86_64 x86_64
mba-3:radare2 romanvg$ which rabin2
/usr/local/bin/rabin2

mba-3:radare2 romanvg$ rabin2 -I ./binr/rabin2/rabin2
havecode true
pic      true
canary   false
nx       true
crypto   false
va       true
intrp    /lib/ld-linux.so.3
bintype  elf
class    ELF32
lang     c
arch     arm
bits     32
machine  ARM
os       linux
minopsz  1
maxopsz  16
pcalign  0
subsys   linux
endian   little
stripped false
static   false
linenum  true
lsyms    true
relocs   true
rpath    NONE
binsz    96280

Thanks for @radare for the guidance on mk/armel.mk ;)

@radare radare merged commit 7c7d75b into radare:master Jun 1, 2016

1 of 2 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@radare

This comment has been minimized.

Show comment
Hide comment
@radare

radare Jun 1, 2016

Owner

Maybe we should copypaste this into the radare2book cc @Maijin

Owner

radare commented Jun 1, 2016

Maybe we should copypaste this into the radare2book cc @Maijin

@Maijin

This comment has been minimized.

Show comment
Hide comment
@Maijin

Maijin Jun 1, 2016

Collaborator

Hum for now I would go for doc/

Collaborator

Maijin commented Jun 1, 2016

Hum for now I would go for doc/

@brainstorm brainstorm deleted the brainstorm:armel_nohf_xbuild branch Jun 1, 2016

@radare

This comment has been minimized.

Show comment
Hide comment
@radare

radare Jun 2, 2016

Owner

thats good too. what about doc/crosscompile?

@braincode, mind to write some words on this?

On 01 Jun 2016, at 23:11, Maijin notifications@github.com wrote:

Hum for now I would go for doc/


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub #5060 (comment), or mute the thread https://github.com/notifications/unsubscribe/AA3-luogzfnEfFcOArXIT74CDhMpal-6ks5qHfWMgaJpZM4IryFn.

Owner

radare commented Jun 2, 2016

thats good too. what about doc/crosscompile?

@braincode, mind to write some words on this?

On 01 Jun 2016, at 23:11, Maijin notifications@github.com wrote:

Hum for now I would go for doc/


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub #5060 (comment), or mute the thread https://github.com/notifications/unsubscribe/AA3-luogzfnEfFcOArXIT74CDhMpal-6ks5qHfWMgaJpZM4IryFn.

@brainstorm

This comment has been minimized.

Show comment
Hide comment
@brainstorm

brainstorm Jun 2, 2016

Contributor

Sure, would like to write a small blogpost first, can c&p and/or link to that. Will do!

Contributor

brainstorm commented Jun 2, 2016

Sure, would like to write a small blogpost first, can c&p and/or link to that. Will do!

chinmaydd added a commit to chinmaydd/radare2 that referenced this pull request Jun 3, 2016

radare added a commit that referenced this pull request Aug 4, 2016

PankajKataria pushed a commit to PankajKataria/radare2 that referenced this pull request Aug 13, 2016

PankajKataria pushed a commit to PankajKataria/radare2 that referenced this pull request Aug 13, 2016

@Maijin

This comment has been minimized.

Show comment
Hide comment
@Maijin

Maijin Aug 14, 2016

Collaborator

@brainstorm so basically I can run r2 on parrot ?

Collaborator

Maijin commented Aug 14, 2016

@brainstorm so basically I can run r2 on parrot ?

@radare

This comment has been minimized.

Show comment
Hide comment
@radare

radare Aug 14, 2016

Owner

Yep

On 14 Aug 2016, at 05:14, Maijin notifications@github.com wrote:

@brainstorm so basically I can run r2 on parrot ?


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.

Owner

radare commented Aug 14, 2016

Yep

On 14 Aug 2016, at 05:14, Maijin notifications@github.com wrote:

@brainstorm so basically I can run r2 on parrot ?


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.

@Maijin

This comment has been minimized.

Show comment
Hide comment
@Maijin

Maijin Aug 14, 2016

Collaborator

This seems like a nice tweet to do :D

Collaborator

Maijin commented Aug 14, 2016

This seems like a nice tweet to do :D

@brainstorm

This comment has been minimized.

Show comment
Hide comment
@brainstorm

brainstorm Aug 14, 2016

Contributor

Hold on guys, TL;DR: in theory is possible but not in (my own) practice.

The libraries and kernel in the Parrot Airdone v1.0 are too old to have radare running there (I tried). Also, for some obscure reason I forgot about, r2 cannot be compiled statically for ARMv5, so out of luck too.

I basically used the trick in this PR to cross-compile AVRdude instead.

Contributor

brainstorm commented Aug 14, 2016

Hold on guys, TL;DR: in theory is possible but not in (my own) practice.

The libraries and kernel in the Parrot Airdone v1.0 are too old to have radare running there (I tried). Also, for some obscure reason I forgot about, r2 cannot be compiled statically for ARMv5, so out of luck too.

I basically used the trick in this PR to cross-compile AVRdude instead.

@radare

This comment has been minimized.

Show comment
Hide comment
@radare

radare Aug 14, 2016

Owner

If you ever try again please paste the error

On 14 Aug 2016, at 21:06, Roman Valls Guimerà notifications@github.com wrote:

Hold on guys, TL;DR: in theory is possible but not in (my own) practice.

The libraries and kernel in the Parrot Airdone v1.0 are too old to have radare running there (I tried). Also, for some obscure reason I forgot about, r2 cannot be compiled statically for ARMv5, so out of luck too.

I basically used the trick in this PR to cross-compile AVRdude instead.


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.

Owner

radare commented Aug 14, 2016

If you ever try again please paste the error

On 14 Aug 2016, at 21:06, Roman Valls Guimerà notifications@github.com wrote:

Hold on guys, TL;DR: in theory is possible but not in (my own) practice.

The libraries and kernel in the Parrot Airdone v1.0 are too old to have radare running there (I tried). Also, for some obscure reason I forgot about, r2 cannot be compiled statically for ARMv5, so out of luck too.

I basically used the trick in this PR to cross-compile AVRdude instead.


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.

leberus added a commit to leberus/radare2 that referenced this pull request Aug 17, 2016

@brainstorm

This comment has been minimized.

Show comment
Hide comment
@brainstorm

brainstorm Aug 23, 2016

Contributor

Sth like this in the drone:

# ./radare2
./radare2: error while loading shared libraries: libutil.so.1: cannot open shared object file: No such file or directory

And this happened when trying to compile radare in static for ARMv5 to get rid of lib deps:

make[2]: Entering directory '/build/shlr/zip/zlib'
/usr/bin/arm-linux-gnueabi-gcc   -static -static   -fPIC -g -Wall -D__UNIX__=1 -static -fPIC -Wall -I../../libr/include -I../include/   -ldl -pthread -lutil -ldl -pthread -lutil -ldl -pthread -lutil -shared -Wl,-soname,libr_z.so -fPIC -o libr_z.so adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
/usr/lib/gcc-cross/arm-linux-gnueabi/5/../../../../arm-linux-gnueabi/bin/ld: /usr/lib/gcc-cross/arm-linux-gnueabi/5/../../../../arm-linux-gnueabi/lib/libc.a(dl-tsd.o)(.text+0x18): R_ARM_TLS_LE32 relocation not permitted in shared object
/usr/lib/gcc-cross/arm-linux-gnueabi/5/../../../../arm-linux-gnueabi/lib/libc.a(dl-tsd.o): In function `_dl_initial_error_catch_tsd':
(.text+0x18): dangerous relocation: unsupported relocation
collect2: error: ld returned 1 exit status
Makefile:70: recipe for target 'libr_z.so' failed

Then fiddling further with this:

https://keviniwu.blogspot.se/2010/11/rarmtlsle32-relocation-not-permitted-in.html

Then ./r2 failing in the parrot with a "FATAL: Kernel too old", IIRC (c&p'd from chat logs with @radare).

Contributor

brainstorm commented Aug 23, 2016

Sth like this in the drone:

# ./radare2
./radare2: error while loading shared libraries: libutil.so.1: cannot open shared object file: No such file or directory

And this happened when trying to compile radare in static for ARMv5 to get rid of lib deps:

make[2]: Entering directory '/build/shlr/zip/zlib'
/usr/bin/arm-linux-gnueabi-gcc   -static -static   -fPIC -g -Wall -D__UNIX__=1 -static -fPIC -Wall -I../../libr/include -I../include/   -ldl -pthread -lutil -ldl -pthread -lutil -ldl -pthread -lutil -shared -Wl,-soname,libr_z.so -fPIC -o libr_z.so adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
/usr/lib/gcc-cross/arm-linux-gnueabi/5/../../../../arm-linux-gnueabi/bin/ld: /usr/lib/gcc-cross/arm-linux-gnueabi/5/../../../../arm-linux-gnueabi/lib/libc.a(dl-tsd.o)(.text+0x18): R_ARM_TLS_LE32 relocation not permitted in shared object
/usr/lib/gcc-cross/arm-linux-gnueabi/5/../../../../arm-linux-gnueabi/lib/libc.a(dl-tsd.o): In function `_dl_initial_error_catch_tsd':
(.text+0x18): dangerous relocation: unsupported relocation
collect2: error: ld returned 1 exit status
Makefile:70: recipe for target 'libr_z.so' failed

Then fiddling further with this:

https://keviniwu.blogspot.se/2010/11/rarmtlsle32-relocation-not-permitted-in.html

Then ./r2 failing in the parrot with a "FATAL: Kernel too old", IIRC (c&p'd from chat logs with @radare).

@ril3y

This comment has been minimized.

Show comment
Hide comment
@ril3y

ril3y Nov 18, 2017

So radare2 cannot be statically compiled to run on armv5 arch? Sorry for bringing up and old thread but I have a IoT device that I am working on that I would love to use r2 vs GDB on.

ril3y commented Nov 18, 2017

So radare2 cannot be statically compiled to run on armv5 arch? Sorry for bringing up and old thread but I have a IoT device that I am working on that I would love to use r2 vs GDB on.

@brainstorm

This comment has been minimized.

Show comment
Hide comment
@brainstorm

brainstorm Nov 18, 2017

Contributor

It should be possible, I just was poking at relatively old libs back then, you might have better luck with this ;)

Contributor

brainstorm commented Nov 18, 2017

It should be possible, I just was poking at relatively old libs back then, you might have better luck with this ;)

@ril3y

This comment has been minimized.

Show comment
Hide comment
@ril3y

ril3y Dec 1, 2017

@brainstorm Looks like building using uclibc toolchains is a no go since it does not come with the backtrace() function inside of execinfo.h. Rebuilding a toolchain tonight to test musl see how that goes.

ril3y commented Dec 1, 2017

@brainstorm Looks like building using uclibc toolchains is a no go since it does not come with the backtrace() function inside of execinfo.h. Rebuilding a toolchain tonight to test musl see how that goes.

@radare

This comment has been minimized.

Show comment
Hide comment
@radare

radare Dec 1, 2017

Owner
Owner

radare commented Dec 1, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment