ottokiksmaler / gear360_modding

Repository for Samsung Gear 360 (2017) modding
59 stars 12 forks source link

Unable to compile to valid binary #11

Closed nhhollander closed 3 years ago

nhhollander commented 3 years ago

I'm trying to compile code for the camera, starting with the keyscan360.c provided in this repository, however I can not for the life of me get it to produce a valid binary. Compiliing with arm-linux-gnueabihf-gcc produces a binary which instantly powers down the camera when run.

While testing I discovered that any application compiled with arm-linux-gnueabihf-gcc, even one that contains only return 0; results in the same behavior.

Is there a particular version of gcc that needs to be used for cross compilation?

nhhollander commented 3 years ago

For reference I am compiling using gcc 9.3.0 on Ubuntu 20.04

ottokiksmaler commented 3 years ago

Try gnueabi (without hf), this is the line I use, for example, for keyscan.c:

arm-linux-gnueabi-gcc -o keyscan keyscan.c -lpthread -s --sysroot=../arm/ -Wl,-dynamic-linker,/lib/ld-2.13.so

../arm/ contains usr and lib directories needed for compiling.

nhhollander commented 3 years ago

Where do you get the contents of the ../arm directory? Using arm-linux-gnueabi-gcc produces a binary which crashes with Invalid Instruction instead of instantly powering down.

nhhollander commented 3 years ago

Aha! It turns out I was running into the same issue described in https://github.com/ottokiksmaler/nx500_nx1_modding/issues/76

In FileZilla's settings I unchecked "Treat files without extension as ASCII file" and set the default transfer type to Binary under Connection→Transfers→FTP: File Transfers.