niclet / yi-hack-v2

Xiaomi Yi Ants Camera 2 hack
124 stars 34 forks source link

What is your workflow for compiling binaries for this repo? #24

Open n8henrie opened 6 years ago

n8henrie commented 6 years ago

@niclet has said a few times that he compiles things on the Raspberry Pi:

Can you give us a basic overview of how this is done?

For example, @shadow-1 has given a thorough overview of his workflow for compiling firmware for the v1 cameras -- it would be excellent to have a guide like this for working with the V2 cameras.

EDIT: Removed link to possibly copyright infringing content.

n8henrie commented 6 years ago

Just tried to see if I could compile a Go binary (since they are statically linked and easy to cross-compile for ARM / Raspberry Pi), but I couldn't find any way to get a "hello world" to work compiling from my Mac using GOOS=linux GOARCH=arm GOARM=7 go build, also tried GOARM=6 and 7. Also tried compiling from a Raspberry Pi 3 with those same settings, no luck. Would get "invalid instruction" or a segfault when trying to run the binaries on my yi home 1080 v2.

So then I tried a C++ hello_world compiled on my Raspberry Pi 3: g++ -static hello_world.cpp -o hello_world, it also segfaults.

Any suggestions would be much appreciated.

shadow-1 commented 6 years ago

@n8henrie I suggest biting the bullet and use the cross compiler included with the SDK.

It is a little more difficult to compile applications and libraries compared to compiling natively (usually requires an additional 1 or 2 command line options). However on the positive side, the compiler is specific to the chipset used on the camera and can take advantage of any optimisations specific to the chipset rather than compiling to the lowest common denominator (e.g. armv5).

n8henrie commented 6 years ago

Thanks for the response.

I will report back to this thread if I'm able to find a walkthrough or any more documentation about the Ambarella SDK -- it looks like it is pretty hard to get ahold of. I sent in a info request at their site and the form response basically says "if you're not considering a large order we probably won't get back to you."

n8henrie commented 6 years ago

Possibly helpful for future readers:

https://github.com/hello/kasa https://github.com/hello/kasanojo

n8henrie commented 5 years ago

Walkthrough for extracting the firmware: https://tech.fpt.com.vn/language/en/extracting-firmware-xiaomi-ants-xiaoyi-smart-camera-part-1/