在android上使用 stand-alone toolchains移植 transmission
- we need to port openssl, curl , libevent first then we can port transmission.
- I install projects memtions above in my home directory :
[dengwei@localhost ~]$ pwd/home/dengwei[dengwei@localhost ~]$ ls porting_*porting_curl:bin include lib shareporting_libevent:bin include lib shareporting_openssl:bin include lib sslporting_transmission:install transmission
-
./configure --host=arm-linux --enable-cli --enable-daemon --prefix="/home/dengwei/porting_transmission/install" CXX=arm-linux-androideabi-g++ CC=arm-linux-androideabi-gcc --enable-gtk=no LIBEVENT_CFLAGS="-I /home/dengwei/porting_libevent/include/ -L/home/dengwei/porting_libevent/lib/" LIBCURL_CFLAGS="-I /home/dengwei/porting_curl/include/ -L/home/dengwei/porting_curl/lib/" OPENSSL_CFLAGS="-I /home/dengwei/porting_openssl/include/ -L/home/dengwei/porting_openssl/lib/" LDFLAGS="-L/home/dengwei/porting_libevent/lib/ -levent"
make && make install
- error handling:
-
[dengwei@localhost bin]$ file transmissioncli
transmissioncli: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
[dengwei@localhost bin]$ file transmission-daemon
transmission-daemon: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
[dengwei@localhost bin]$ pwd
/home/dengwei/porting_transmission/install/bindynamically linked, means we need .so file, so:
./adb push ~/porting_transmission/install /data/
in adb shell,use su and cat to copy file to /system/lib which store .so file
# cat /data/lib/libevent-1.4.so.2 > ./libevent-1.4.so.2
cannot create ./libevent-1.4.so.2: read-only file system
# su
# adb remount
* daemon not running. starting it now on port 5038 *
* daemon started successfully *
remount succeeded
#
./adb push ~/porting_libevent/lib/libevent-1.4.so.2 /data/lib/
./adb push ~/porting_curl/lib/libcurl.so.5 /data/lib/in adb shell
# pwd/system/lib
# cat /data/lib/libevent-1.4.so.2 > ./libevent-1.4.so.2
# cat /data/lib/libcurl.so.5 > ./libcurl.so.5
in adb shell
# cat /data/lib/libcurl.so.5 > ./libcurl.so.5
# /data/bin/transmission-daemon
# ps
USER PID PPID VSIZE RSS WCHAN PC NAME
root 530 1 5424 984 ffffffff 40026c94 S /data/bin/transmission-daemon
# /data/bin/transmission-daemon --version
Transmission 2.04 (11151)
Finally, we still need to use a web visit way to confirm that transmission works all right.
first we need to set TRANSMISSION_HOME (in order to find setting.json and locate torrent resume dir )
TRANSMISSION_WEB_HOME (in order to find web files) environment variables, otherwise we will get a 404 error
export TRANSMISSION_HOME=/data/transmission
export TRANSMISSION_WEB_HOME=/data/transmission/share/transmission/web
#ps
root 5724789003480000000040010458 R ps
# kill -9 556
# echo $TRANSMISSION_WEB_HOME
/data/share/transmission/web
# /data/bin/transmission-daemon -u root -v toor -w /sdcard/BT
start a webbrowser:http://127.0.0.1:9091 redirect http://127.0.0.1:9091/transmission/web
Now , we can see a familar web interface of transmission web UI
==========================================
in real arm board instead of emulator, what we need to do :
- mkdir /data/transmission/
- mkdir /data/lib/
- copy porting_transmission/install to board /data/transmission and make them executable by
running chmod 0777 ./* , in directory /data/transmission - copy 2 .so file to /data/lib/
- su
- #mount -o remount,rw /
- #copy files in /data/lib/ to /system/lib/
- #edit /init.rc by adding :
export TRANSMISSION_HOME=/data/transmission
export TRANSMISSION_WEB_HOME=/data/transmission/share/transmission/web - also we run 2 export command above
- start transmission by /data/transmission/bin/transmission-daemon -u root -v toor -w /sdcard/BT
-
/data/bin/transmission-remote --auth=root:toor -a /sdcard/Download/9203e0ebf3e5382dce42ca5add007a32bc0d9bcb.torrentlocalhost:9091 responded: "success"
Now , transmission begin to download the job task.