Project

General

Profile

Android » History » Version 4

Yi Huang, 12/23/2014 01:43 PM

1 1 Yi Huang
Android
2
=======
3
4
To run cross-compiled NFD binary on rooted Android device, there are several steps:
5
6
Preparation:
7
8
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.)
9 3 Yi Huang
10
2. Get cross-compiled NFD binary (there is a prepared package called "nfd-android.tar.gz")
11
12 1 Yi Huang
3. Get Android SDK. (I use adb ```"shell"``` to open up a shell to run NFD) 
13 3 Yi Huang
14 1 Yi Huang
4. Enable development mode on the Android device.
15
16
Steps to run NFD on rooted Android devices:
17
18 3 Yi Huang
1. untar the package. You should get ```nfd-android``` directory from this step.
19 1 Yi Huang
20 3 Yi Huang
2. Copy the directory possible that you have the permission to adb push to ```/data/local/``` already. In this case, go to step 6). To do this, you can:
21
22 1 Yi Huang
    a. Use ```"adb push"``` command; or
23
24
    b. Use other applications like "Android File Transfer" on OS X.
25
26 3 Yi Huang
3. On terminal, type ```"adb shell"``` to get a shell on Android phone.
27 1 Yi Huang
28 3 Yi Huang
4. Type ```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.)
29 1 Yi Huang
30 3 Yi Huang
5. Copy binary from sdcard to ```/data/local/nfd-android```. (You must use ```cp```, ```mv``` won't work for this case.)
31 1 Yi Huang
32 3 Yi Huang
6. cd to ```/data/local/nfd-android```. Use ```"chmod 700 ./bin/*"``` on all binaries to make them executable. (syntax like ```"u+x"``` won't work on Android.)
33 1 Yi Huang
34 3 Yi Huang
7. Create directory ```".ndn"``` under ```/data/local/nfd-android```. And then copy ```./etc/ndn/client.conf``` to ```.ndn``` directory
35 1 Yi Huang
36 3 Yi Huang
8. Run nfd binary with environment variable ```HOME``` pointing to ```/data/local/nfd-android```. For me, I ran ```"HOME=/data/local/nfd-android ./bin/nfd --config ./etc/ndn/nfd.conf"```
37
38
39
Steps to run NRD after NFD is running:
40
41
1. Make sure you did step 7 from the steps to run NFD.
42
43
2. ```"HOME=/data/local/nfd-android ./bin/nrd --config ./etc/ndn/nfd.conf"```
44
45
46
Steps to register prefix using nfdc:
47
48
1. Make sure you did step 7 from the steps to run NFD.
49
50
2. For example, ```"HOME=/data/local/nfd-android ./bin/nfdc register /ndn/edu/arizona tcp4://128.196.203.36:6363"```
51
52
    Note: DNS resolution for android is not working. So please only use IP addresses (i.e. tcp4://hobo.cs.arizona.edu:6363 won't work).
53 4 Yi Huang
54
Running other applications is very similar. Prepare correct configuration file and then run the binary with correct HOME path.