Sign up here and you can log into the forum!

SMP Cross Compile Help - transmissionbt

Have a question about devices internals, memory layout, reverse engineering, etc---This is the place for anything so technical that it would cause a n00b's head to 'splode

Re: SMP Cross Compile Help - transmissionbt   

Postby KAD » Thu Apr 03, 2014 9:07 pm

success :D

Code: Select all
# file ./transmission-cli
./transmission-cli: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked (uses shared libs), for GNU/Linux 2.6.12, with unknown capability 0xf41 = 0x756e6700, not stripped
# ldd ./transmission-cli
        librt.so.1 => /lib/librt.so.1 (0x2aaaa000)
        libevent-2.0.so.5 => /usr/lib/libevent-2.0.so.5 (0x2aac2000)
        libcurl.so.4 => /lib/libcurl.so.4 (0x2ab16000)
        libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x2ab82000)
        libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x2abe8000)
        libz.so.1 => /lib/libz.so.1 (0x2ad94000)
        libm.so.6 => /lib/libm.so.6 (0x2adba000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x2ae44000)
        libc.so.6 => /lib/libc.so.6 (0x2ae6e000)
        /lib/ld.so.1 (0x55550000)
        libdl.so.2 => /lib/libdl.so.2 (0x2afd0000)
# ./transmission-cli --version
transmission-cli 2.82 (14160)
# ./transmission-cli --help
transmission-cli 2.82 (14160)
A fast and easy BitTorrent client

Usage: transmission-cli [options] <file|url|magnet>

Options:
-h  --help                          Display this help page and exit
-b  --blocklist                     Enable peer blocklists
-B  --no-blocklist                  Disable peer blocklists
-d  --downlimit            <speed>  Set max download speed in kB/s
-D  --no-downlimit                  Don't limit the download speed
-er --encryption-required           Encrypt all peer connections
-ep --encryption-preferred          Prefer encrypted peer connections
-et --encryption-tolerated          Prefer unencrypted peer connections
-f  --finish               <script> Run a script when the torrent finishes
-g  --config-dir           <path>   Where to find configuration files
-m  --portmap                       Enable portmapping via NAT-PMP or UPnP
-M  --no-portmap                    Disable portmapping
-p  --port                 <port>   Port for incoming peers (Default: 51413)
-t  --tos                  <tos>    Peer socket TOS (0 to 255,
                                     default=default)
-u  --uplimit              <speed>  Set max upload speed in kB/s
-U  --no-uplimit                    Don't limit the upload speed
-v  --verify                        Verify the specified torrent
-V  --version                       Show version number and exit
-w  --download-dir         <path>   Where to save downloaded data
#

now just need startup script, daemonize it, integrate with webend

in the end here's what worked for SMP

first apply patch to change string from "transmission 2.82" to "transmission-2.82"

Code: Select all
smp@ubuntu:/opt/mips-4.3$ cat ./toolchain-path.env
# source this script to put your new compiler in the PATH.

PATH=/opt/mips-4.3/bin:$PATH
SMP86XX_TOOLCHAIN_PATH=/opt/mips-4.3
export SMP86XX_TOOLCHAIN_PATH
export COMPILKIND='codesourcery hardfloat glibc release'
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/smp/output/usr/local/lib
export LD_RUN_PATH=$LD_RUN_PATH:/home/smp/output/usr/local/lib
export PKG_CONFIG_PATH="/home/smp/output/usr/local/lib/pkgconfig"
export CPPFLAGS="-I/home/smp/output/usr/local/include"
export CFLAGS="-I/home/smp/output/usr/local/include"
export LDFLAGS="-L/home/smp/output/usr/local/lib"
export CC="/opt/mips-4.3/bin/mipsel-linux-gcc"
export CPP="/opt/mips-4.3/bin/mipsel-linux-cpp"
export CXX="/opt/mips-4.3/bin/mipsel-linux-g++"
export LD="/opt/mips-4.3/bin/mipsel-linux-ld"
export RANLIB="/opt/mips-4.3/bin/mipsel-linux-ranlib"
export AR="/opt/mips-4.3/bin/mipsel-linux-ar"



I tried -liconv, and 0s options in your example, but ./configure fails if either of those were set

Code: Select all

*transmission
source /opt/mips-4.3/toolchain-path.env

./configure --host="mipsel-linux" --prefix="/usr/share/transmission" --without-gtk --disable-mac --enable-utp --disable-nls --with-inotify --enable-lightweight --enable-cli --enable-shared --enable-daemon

make
make install


thanks again for putting up with all my questions
If you like my work please consider a Donation. Donate
Please read the appropriate documentation before posting questions! READ ME FAQ WIKI
PM's are for private matters. Post support questions to the appropriate forum, or they will be ignored.
User avatar
KAD
Global Moderator
 
Posts: 5103
Joined: Mon Apr 12, 2010 4:59 pm
Location: Seattle, WA USA

Re: SMP Cross Compile Help - transmissionbt   

Postby mad_ady » Thu Apr 03, 2014 11:28 pm

make[1]: Betrete Verzeichnis '/opt/src/transmission-2.82'
make[1]: Für das Ziel »all-am« ist nichts zu tun.
make[1]: Verlasse Verzeichnis '/opt/src/transmission-2.82'
root@wdtv-dev:/opt/src/transmission-2.82# make install
Making install in extras
make[1]: Betrete Verzeichnis '/opt/src/transmission-2.82/extras'
make[2]: Betrete Verzeichnis '/opt/src/transmission-2.82/extras'


Make errors and warnings are pretty scary. Make errors and warnings in German are a new level of scary! :lol:
User avatar
mad_ady
Developer
 
Posts: 4553
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: SMP Cross Compile Help - transmissionbt   

Postby KAD » Fri Apr 04, 2014 9:09 am

thought I'd share another tidbit I found, in case anybody else has this issue

I notice working file output shows "not stripped"

ftp same file to WD and is managically now a "stripped" file

for whatever reason this is even happening, just by copy to usb drive on same PC

I also observed this behavior with recliq's transmission.app.bin
when I manually mount that on SMP, binaries somehow, show up as stripped and when you attempt to run you get seg fault

only way I could get these files to keep there "not stripped" bits was to tar.gz the file
copy tar.gz to WD, then untar directly on the internal filesystem

to add some more mystery to this, it does not happen with all binaries, there's been quite a few binaries, like curl as discussed above,
that was updated via ftp, no issues
If you like my work please consider a Donation. Donate
Please read the appropriate documentation before posting questions! READ ME FAQ WIKI
PM's are for private matters. Post support questions to the appropriate forum, or they will be ignored.
User avatar
KAD
Global Moderator
 
Posts: 5103
Joined: Mon Apr 12, 2010 4:59 pm
Location: Seattle, WA USA

Re: SMP Cross Compile Help - transmissionbt   

Postby recliq » Sat Apr 05, 2014 2:58 am

I haven't seen this but I guess I most of the time move my cross-compiled stuff in .tgz...
Normally you would want to strip the binaries for WDTV to save space... try to strip it right after compiling:
Code: Select all
root@wdtv-dev:~# file /apps/transmission/bin/transmission-cli
/apps/transmission/bin/transmission-cli: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked (uses shared libs), for GNU/Linux 2.6.12, with unknown capability 0xf41 = 0x756e6700, not stripped

root@wdtv-dev:~# ls -al /apps/transmission/bin/transmission-cli
-rwxr-xr-x 1 root root 8774061 2014-04-05 12:56 /apps/transmission/bin/transmission-cli

root@wdtv-dev:~# /opt/mips-4.3/bin/mipsel-linux-strip /apps/transmission/bin/transmission-cli

root@wdtv-dev:~# file /apps/transmission/bin/transmission-cli
/apps/transmission/bin/transmission-cli: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.12, with unknown capability 0xf41 = 0x756e6700, stripped

root@wdtv-dev:~# ls -al /apps/transmission/bin/transmission-cli
-rwxr-xr-x 1 root root 729952 2014-04-05 12:57 /apps/transmission/bin/transmission-cli


Btw, -Os tells the compiler to optimize the compile for minimal binary size...
­WDLXTV Project Maintainer
-:] If you like my contributions feel free to donate for a beer or a new flash drive. ...and always remember: RTFM! (README, FAQ, WIKI) [:-
User avatar
recliq
WDLXTV Team
 
Posts: 5513
Joined: Thu Apr 15, 2010 8:09 am
Location: Kiel, Germany

Re: SMP Cross Compile Help - transmissionbt   

Postby KAD » Sat Apr 05, 2014 8:52 pm

well the idea to strip the file using WD toolchain was good, but does not work, even if stripped with toolchain, still result in seg fault
but unstripped works fine

also now that I have a working cross compile env set up, this is nice, just updated bash from 3.0 to 4.3 :)
If you like my work please consider a Donation. Donate
Please read the appropriate documentation before posting questions! READ ME FAQ WIKI
PM's are for private matters. Post support questions to the appropriate forum, or they will be ignored.
User avatar
KAD
Global Moderator
 
Posts: 5103
Joined: Mon Apr 12, 2010 4:59 pm
Location: Seattle, WA USA

Re: SMP Cross Compile Help - transmissionbt   

Postby recliq » Sun Apr 06, 2014 3:02 am

hm odd but at least you got a working version and got working crosscompiler :mrgreen:
­WDLXTV Project Maintainer
-:] If you like my contributions feel free to donate for a beer or a new flash drive. ...and always remember: RTFM! (README, FAQ, WIKI) [:-
User avatar
recliq
WDLXTV Team
 
Posts: 5513
Joined: Thu Apr 15, 2010 8:09 am
Location: Kiel, Germany

Re: SMP Cross Compile Help - transmissionbt   

Postby mad_ady » Sun Apr 06, 2014 10:28 pm

Hmm - did you also notice small size differences between the original non-stripped binary and the destination? If so, it may be that there's a problem with ftp when you move the file and it assumes it is an ASCII file and converst line-ends for you. That would corrupt the binary (and show you a different size as well). It's possible that the ftp client recognizes the gz file as a binary file and transfers it correctly. You can try to manually force transfer mode to "binary" by running the "bin" ftp command before the file transfer.

Edit: I noticed the file sizes and the difference is huge. Probably it's not what I've suggested.
User avatar
mad_ady
Developer
 
Posts: 4553
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: SMP Cross Compile Help - transmissionbt   

Postby recliq » Sun Apr 06, 2014 11:52 pm

I don't think KAD gave his differences, in my example it's the difference between stripped and not stripped binary
­WDLXTV Project Maintainer
-:] If you like my contributions feel free to donate for a beer or a new flash drive. ...and always remember: RTFM! (README, FAQ, WIKI) [:-
User avatar
recliq
WDLXTV Team
 
Posts: 5513
Joined: Thu Apr 15, 2010 8:09 am
Location: Kiel, Germany

Re: SMP Cross Compile Help - transmissionbt   

Postby mad_ady » Mon Apr 07, 2014 5:22 am

Nope, it appears to be after running the strip command:
Code: Select all
root@wdtv-dev:~# /opt/mips-4.3/bin/mipsel-linux-strip /apps/transmission/bin/transmission-cli
User avatar
mad_ady
Developer
 
Posts: 4553
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: SMP Cross Compile Help - transmissionbt   

Postby KAD » Mon Apr 07, 2014 10:19 am

well, I didn't look at size differences, but stripped will certainly be smaller

but I stripped the file using WD toolchain, then tar.gz before moving it to WD
and result was still seg fault

so yeah, it's not the ftp transfer corrupting the binary
If you like my work please consider a Donation. Donate
Please read the appropriate documentation before posting questions! READ ME FAQ WIKI
PM's are for private matters. Post support questions to the appropriate forum, or they will be ignored.
User avatar
KAD
Global Moderator
 
Posts: 5103
Joined: Mon Apr 12, 2010 4:59 pm
Location: Seattle, WA USA

PreviousNext

Return to WDTV Live

Who is online

Users browsing this forum: No registered users and 1 guest

cron