Project

General

Profile

Android » History » Revision 2

Revision 1 (Yi Huang, 12/20/2014 10:45 AM) → Revision 2/6 (Yi Huang, 12/20/2014 01:02 PM)

Android 
 ======= 

 To run cross-compiled NFD binary on rooted Android device, there are several steps: 

 Preparation: 

 1. A rooted Android device. (It has to be rooted or no one can run binaries copied to sdcard from command line. It is possible to use an Android application wrapper to carry and run native binaries on unrooted device. I have not test that yet since we need to do debugging on command line and wrapper is just too complicated for debugging.) 
 2. Get cross-compiled NFD binary 
 3. Get Android SDK. (I use adb ```"shell"``` to open up a shell to run NFD)  
 4. Enable development mode on the Android device. 

 Steps to run NFD on rooted Android devices: 

 1. Copy binaries and configuration file to sdcard of the phone. To do this, you can: 

     a. Use ```"adb push"``` command; or 

     b. Use other applications like "Android File Transfer" on OS X. 

 2. On terminal, type ```"adb shell"``` to get a shell on Android phone. 

 3. Run ```su``` to switch to root user. (You might need to click "allow" on your phone to grant super user privilege if you have never done so.) 

 4. Copy binary from sdcard to ```/data/local/tmp```. (You must use ```cp```, ```mv``` won't work for this case.) 

 5. 4. Use ```"chmod 700"``` on all binaries to make them executable. (syntax like ```"u+x"``` won't work on Android.) 

 6. 5. Modify nfd.conf and comment out websocket section and unix socket section. 

 7. 6. Run nfd binary with environment variable ```HOME``` pointing to a writable place. For example ```"HOME=/data/local/tmp ./nfd --config ./nfd.conf"```