在android上使用 standalone 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  share
porting_libevent:
bin  include  lib  share
porting_openssl:
bin  include  lib  ssl
porting_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"

LDFLAGS

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/bin

     dynamically 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.2read-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      556   1     4400   1000  ffffffff 40026c94 S /data/bin/transmission-daemon
              

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

# /data/bin/transmission-remote --auth=root:toor -a /sdcard/Download/9203e0ebf3e5382dce42ca5add007a32bc0d9bcb.torrent
localhost:9091 responded: "success"

 Now , we can see a familar web interface of transmission web UI

 ==========================================

in real arm board instead of emulator, what we need to do :

  1. mkdir /data/transmission/ 
  2. mkdir /data/lib/
  3. copy porting_transmission/install to board /data/transmission and make them executable by 
    running chmod 0777 ./* , in directory /data/transmission
  4. copy 2 .so file to /data/lib/ 
  5. su
  6. #mount -o remount,rw /
  7. #copy files in /data/lib/ to /system/lib/
  8. #edit /init.rc by adding :
    export TRANSMISSION_HOME=/data/transmission
    export TRANSMISSION_WEB_HOME=/data/transmission/share/transmission/web
  9. also we run 2 export command above
  10. start transmission by /data/transmission/bin/transmission-daemon -u root -v toor -w /sdcard/BT
  11. /data/bin/transmission-remote --auth=root:toor -a /sdcard/Download/9203e0ebf3e5382dce42ca5add007a32bc0d9bcb.torrent
    localhost:9091 responded: "success"

Now , transmission begin to download the job task. 

原文地址:https://www.cnblogs.com/no7dw/p/2715424.html