Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jeffpamer
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffpamer/9731432 to your computer and use it in GitHub Desktop.
Save jeffpamer/9731432 to your computer and use it in GitHub Desktop.
#######################################################
## CROSS COMPILING TRANSMISSION 2.82 FOR WD MY CLOUD ##
## MODIFIED FOR OS X HOST MACHINE ##
#######################################################
This is a guide to compile transmission 2.82 for the WD MyCloud 2/3/4 TB.
Because I didn't want to install the build tools and dependencies on my NAS I chose to
setup a cross-compiler toolchain on my x86_64 Ubuntu 12.04 machine and create a .deb package
that can be installed on the NAS. Furthermore the cross compiler can be used to compile anything for the My Cloud (printer drivers, etc.)
However you need to turn on SSH on your NAS and accept the possibility that you might void your
warranty by installing transmission on your NAS. I don't take any responsibility for anything
you do with this guide, your NAS and/or transmission ;)
Host System: Ubuntu 12.04 LTS
Target System: Western Digital MyCloud, Concerto 2000 (ARMv7l, Cortex-A9)
Shell Commands are lines marked by a leading #
Install Dependencies for crosstool-ng
=====================================
NOTE: I already had the build-essential package and everything else installed therefore I didn't need to install any dependencies.
I took the depency list from http://smdaudhilbe.wordpress.com/2013/04/26/steps-to-create-cross-compiling-toolchain-using-crosstool-ng/
However, there are many guides available about how to install crosstool-ng on ubuntu.
# sudo apt-get install autoconf automake libtool libexpat1-dev ncurses-dev bison flex patch curl cvs texinfo build-essential subversion gawk python-dev gperf g++
Create a Working Directory
==========================
Note: Replace with sled with your username
# mkdir /home/sled/ARM
# cd /home/sled/ARM
Install crosstool-ng
====================
# cd /home/sled/ARM
# wget http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.19.0.tar.bz2
Extract:
# tar xjvf crosstool-ng-1.19.0.tar.bz2
Remove downloaded file to keep everything tidy:
# rm crosstool-ng-1.19.0.tar.bz2
Go into crosstool-ng folder:
# cd crosstool-ng-1.19.0
Configure and Make:
# ./configure --prefix=/usr/local
# make
# sudo make install
Tidy up:
# cd /home/sled/ARM
# rm -R crosstool-ng-1.19.0
Creating a cross-compiler
=========================
# cd /home/sled/ARM
# mkdir toolchain
# cd toolchain
Option A: Use my config file:
------------------------------
Setup a basic config file by running `ct-ng menuconfig` and exit directly with saving.
Now download my .config file and replace the hidden .config file (/home/sled/ARM/toolchain/.config)
https://gist.github.com/sled/7736747
Important: Adjust the paths beginning with /home/sled accordingly with a simple text editor.
Option B: Configure manually:
-----------------------------
# ct-ng menuconfig
Leave everything as is and configure as follows:
Paths and misc options --->
[*] Try features marked as EXPERIMENTAL
( ) Local tarballs directory
-> set to /home/sled/ARM/toolchain/src
( ) Working directory
-> set to /home/sled/ARM/toolchain/.build
( ) Prefix directory
-> set to /home/sled/ARM/toolchain/x-tools/${CT_TARGET}
Target options --->
( ) Target Architecture
-> choose "arm"
( ) Endianness
-> make sure it's little endian
( ) Bitness
-> make sure it's 32-bit
( ) Architecture Level
-> set to armv7-a
( ) Tune for CPU
-> set to cortex-a9
( ) Use specific FPU
-> set to neon
( ) Floating point:
-> choose hardware (FPU)
( ) Target CFLAGS:
-> set to -mfpu=neon -mfloat-abi=hard
( ) Default instruction set mode
-> set to thumb
-*- Use EABI
[*] append 'hf' to the tuple (EXPERIMENTAL) (NEW)
-> choose it
Operating System --->
Target OS
-> choose linux
C-Compiler --->
C compiler (gcc) -->
[*] Show Linaro versions
gcc version (linaro-4.8-2013.06-1) -->
[*] C++
C-library --->
C library (eglibc) --->
eglibc version (2_17)
Exit and Save config file (it's hidden and called .config)
Build the cross compiler:
# ct-ng build
Take a break and have a coffee, it will take about 45 minutes
If anything fails, try to fix it and run `ct-ng clean` before you try to build it again
The output from the build process:
sled@sled-MacBookPro:~/ARM/toolchain$ ct-ng build
[INFO ] Performing some trivial sanity checks
[INFO ] Build started 20131201.171932
[INFO ] Building environment variables
[INFO ] =================================================================
[INFO ] Retrieving needed toolchain components' tarballs
[INFO ] Retrieving needed toolchain components' tarballs: done in 0.06s (at 00:01)
[INFO ] =================================================================
[INFO ] Extracting and patching toolchain components
[INFO ] Extracting and patching toolchain components: done in 0.14s (at 00:02)
[INFO ] =================================================================
[INFO ] Installing GMP for host
[INFO ] Installing GMP for host: done in 46.41s (at 00:48)
[INFO ] =================================================================
[INFO ] Installing MPFR for host
[INFO ] Installing MPFR for host: done in 22.68s (at 01:11)
[INFO ] =================================================================
[INFO ] Installing ISL for host
[INFO ] Installing ISL for host: done in 23.08s (at 01:34)
[INFO ] =================================================================
[INFO ] Installing CLooG for host
[INFO ] Installing CLooG for host: done in 7.89s (at 01:42)
[INFO ] =================================================================
[INFO ] Installing MPC for host
[INFO ] Installing MPC for host: done in 9.45s (at 01:51)
[INFO ] =================================================================
[INFO ] Installing binutils for host
[INFO ] Installing binutils for host: done in 71.76s (at 03:03)
[INFO ] =================================================================
[INFO ] Installing pass-1 core C compiler
[INFO ] Installing pass-1 core C compiler: done in 355.79s (at 08:59)
[INFO ] =================================================================
[INFO ] Installing kernel headers
[INFO ] Installing kernel headers: done in 9.18s (at 09:08)
[INFO ] =================================================================
[INFO ] Installing C library headers & start files
[INFO ] Installing C library headers & start files: done in 24.26s (at 09:32)
[INFO ] =================================================================
[INFO ] Installing pass-2 core C compiler
[INFO ] Installing pass-2 core C compiler: done in 528.41s (at 18:21)
[INFO ] =================================================================
[INFO ] Installing C library
[INFO ] Installing C library: done in 396.35s (at 24:57)
[INFO ] =================================================================
[INFO ] Installing final compiler
[INFO ] Installing final compiler: done in 695.28s (at 36:32)
[INFO ] =================================================================
[INFO ] Cleaning-up the toolchain's directory
[INFO ] Stripping all toolchain executables
[INFO ] Cleaning-up the toolchain's directory: done in 4.41s (at 36:37)
[INFO ] Build completed at 20131201.175609
[INFO ] (elapsed: 36:36.90)
[INFO ] Finishing installation (may take a few seconds)...
Once you are complete you will find the complete toolchain under /home/sled/ARM/toolchain/x-tools/arm-unknown-linux-gnueabihf, there's also a version for the target system so you could copy it to your my cloud and compile stuff directly on my cloud without installing any build tools, but we won't do this for transmission. Also this toolchain can be used to compile other stuff than transmission.
Preparing to compile transmission
==================================
We emulate the root folder / on the my cloud by creating a new folder called mycloud
# mkdir /home/sled/ARM/mycloud
This means we get a folder structure like /home/sled/ARM/mycloud/usr/local/bin etc.
We create a folder to hold the source code for transmission and its dependencies
# mkdir /home/sled/ARM/src
Compiling dependencies for transmission
=======================================
We need a handful of dependencies for transmission:
- libevent
- zlib
- openssl
- libcurl
The order is important because cURL depends on OpenSSL etc..
Compiling libevent
==================
Download and extract:
# cd /home/sled/ARM/src
# wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
# tar xvfz libevent-2.0.21-stable.tar.gz
Go into libevent source folder:
# cd libevent-2.0.21-stable
Setup Environment Variables:
# export PATH="/home/sled/ARM/toolchain/x-tools/arm-unknown-linux-gnueabihf/bin:$PATH"
# export cross=arm-unknown-linux-gnueabihf-
# export CC="${cross}gcc"
# ./configure --host="arm-unknown-linux-gnueabihf" --prefix="/home/sled/ARM/mycloud/usr/local"
# make
NOTE: You should see "arm-unknown-linux-gnueabihf-gcc" several times in the output if you only see "gcc" then it didn't use the cross-compiler, make sure the environment variables are set properly.
# make install
Compiling zlib
==============
IMPORTANT: Close your old terminal tab and open a new one and set the environment variables again to make sure the correct ones are being used...
Download and extract:
# cd /home/sled/ARM/src
# wget http://zlib.net/zlib-1.2.8.tar.gz
# tar xvfz zlib-1.2.8.tar.gz
Go into zlib source folder:
# cd zlib-1.2.8
Setup Environment Variables:
# export PATH="/home/sled/ARM/toolchain/x-tools/arm-unknown-linux-gnueabihf/bin:$PATH"
# export cross=arm-unknown-linux-gnueabihf-
# export CC="${cross}gcc"
# export AR="${cross}ar"
# export RANLIB="${cross}ranlib"
# ./configure --prefix="/home/sled/ARM/mycloud/usr/local"
Edit Makefile and append -fPIC to CFLAGS
# make
NOTE: You should see "arm-unknown-linux-gnueabihf-gcc" several times in the output if you only see "gcc" then it didn't use the cross-compiler, make sure the environment variables are set properly.
# make install
Compiling OpenSSL
=================
IMPORTANT: Close your old terminal tab and open a new one and set the environment variables again to make sure the correct ones are being used...
Download and extract:
# cd /home/sled/ARM/src
# wget http://www.openssl.org/source/openssl-1.0.0k.tar.gz
# tar xvfz openssl-1.0.0k.tar.gz
Go into OpenSSL source folder
# cd openssl-1.0.0k
Setup Environment Variables:
# export PATH="/home/sled/ARM/toolchain/x-tools/arm-unknown-linux-gnueabihf/bin:$PATH"
# export cross=arm-unknown-linux-gnueabihf-
# export CC="${cross}gcc"
# export AR="${cross}ar"
# export RANLIB="${cross}ranlib"
# ./Configure linux-generic32 --prefix=/home/sled/ARM/mycloud/usr/local shared zlib-dynamic -I"/home/sled/ARM/mycloud/usr/local/include"
IMPORTANT: Configure begins with capital letter here!
# make
NOTE: You should see "arm-unknown-linux-gnueabihf-gcc" several times in the output if you only see "gcc" then it didn't use the cross-compiler, make sure the environment variables are set properly.
# make install
Compiling cURL
==============
IMPORTANT: Close your old terminal tab and open a new one and set the environment variables again to make sure the correct ones are being used...
Download and extract:
# cd /home/sled/ARM/src
# wget http://curl.haxx.se/download/curl-7.33.0.tar.gz
# tar xvfz curl-7.33.0.tar.gz
Go into cURL source folder:
# cd curl-7.33.0
Setup Environment Variables:
# export PATH="/home/sled/ARM/toolchain/x-tools/arm-unknown-linux-gnueabihf/bin:$PATH"
# export cross=arm-unknown-linux-gnueabihf-
# export CC="${cross}gcc"
./configure --prefix="/home/sled/ARM/mycloud/usr/local" --target=arm-unknown-linux-gnueabihf --host=arm-unknown-linux-gnueabihf --with-zlib="/home/sled/ARM/mycloud/usr/local" --with-ssl="/home/sled/ARM/mycloud/usr/local"
Make sure its configured with the following options:
curl version: 7.33.0
Host setup: arm-unknown-linux-gnueabihf
Install prefix: /home/sled/ARM/mycloud/usr/local
Compiler: arm-unknown-linux-gnueabihf-gcc
SSL support: enabled (OpenSSL)
SSH support: no (--with-libssh2)
zlib support: enabled
Now make it:
# make
NOTE: You should see "arm-unknown-linux-gnueabihf-gcc" several times in the output if you only see "gcc" then it didn't use the cross-compiler, make sure the environment variables are set properly.
# make install
Compiling Transmission (finally :P)
====================================
IMPORTANT: Close your old terminal tab and open a new one and set the environment variables again to make sure the correct ones are being used...
Download and extract:
# cd /home/sled/ARM/src
# wget http://download.transmissionbt.com/files/transmission-2.82.tar.xz
# tar xvfJ transmission-2.82.tar.xz
Go into transmission source folder:
# cd transmission-2.82
Setup Environment Variables:
# export PATH="/home/sled/ARM/toolchain/x-tools/arm-unknown-linux-gnueabihf/bin:$PATH"
# export cross=arm-unknown-linux-gnueabihf-
# ./configure --host="arm-unknown-linux-gnueabihf" --prefix="/Volumes/ct-ng/ARM/mycloud/usr/local" --without-gtk --disable-libnotify --disable-mac --disable-wx --disable-beos --enable-utp --disable-nls --enable-inotify --enable-utp --enable-lightweight --enable-cli --enable-daemon --with-zlib="/Volumes/ct-ng/ARM/mycloud/usr/local" PKG_CONFIG_PATH="/Volumes/ct-ng/ARM/mycloud/usr/local/lib/pkgconfig" CPPFLAGS=-DTR_EMBEDDED
# make CC="${cross}gcc" AR="${cross}ar" RANLIB="${cross}ranlib"
Now we create a nice little .deb package using checkinstall
(If you don't have checkinstall, install it using `apt-get install checkinstall`)
# sudo checkinstall --install=no
Checkinstall will ask you a few questions that I filled in as follows:
--- SNIP START ---
The package documentation directory ./doc-pak does not exist.
Should I create a default set of package docs? [y]: n
Please write a description for the package.
End your description with an empty line or EOF.
>> Transmission
>> a lightweight BitTorrent client
>>
This package will be built according to these values (most important is to set the Architecture to armhf, otherwise it won't install):
0 - Maintainer: [ Simon - <schmsimo@gmail.com> ]
1 - Summary: [ Transmission ]
2 - Name: [ transmission ]
3 - Version: [ 2.82 ]
4 - Release: [ 1 ]
5 - License: [ GPL ]
6 - Group: [ checkinstall ]
7 - Architecture: [ armhf ]
8 - Source location: [ transmission-2.82 ]
9 - Alternate source location: [ ]
10 - Requires: [ ]
11 - Provides: [ transmission ]
12 - Conflicts: [ ]
13 - Replaces: [ ]
--- SNIP END --
When you are done the output should be:
--- SNIP START ---
**********************************************************************
Done. The new package has been saved to
/home/sled/ARM/src/transmission-2.82/transmission_2.82-1_armhf.deb
You can install it in your system anytime using:
dpkg -i transmission_2.82-1_armhf.deb
**********************************************************************
--- SNIP END ---
Installing Transmission on WD My Cloud
======================================
1. Transfer the .deb package to your NAS via scp:
# scp transmission_2.82-1_armhf.deb root@<IP OF YOUR MY CLOUD>:/tmp
2. Open a remote shell to your My Cloud
# ssh root@<IP OF YOUR MY CLOUD>
3. All commands that follow are to be executed on the remote shell!
4. Install transmission
# dpkg -i /tmp/transmission_2.82-1_armhf.deb
Configuring Transmission on WD My Cloud
=======================================
1. Add a user for transmission:
# adduser --disabled-password transmission
# usermod -a -G share transmission
# usermod -a -G www-data transmission
2. Get start-/stop script from https://trac.transmissionbt.com/wiki/Scripts/initd and save it to /etc/init.d/transmission-daemon
3. Set permissions and flags:
# chmod +x /etc/init.d/transmission-daemon
# chown root:root /etc/init.d/transmission-daemon
4. Start Transmission Daemon:
# /etc/init.d/transmission-daemon start
The output should be:
WDMyCloud:/tmp# /etc/init.d/transmission-daemon start
Starting bittorrent client transmission-daemon...
Starting bittorrent client transmission-daemon succeeded
5. Go to http://<YOUR WD MY CLOUD IP>:9091
-> You should get a "403: Forbidden" Message, which is good as it proofs that the transmission-daemon is running :)
6. Customize the config file which can be found under /home/transmission/.config/transmission-daemon/settings.json
-> All possible configuration options can be found on https://trac.transmissionbt.com/wiki/EditConfigFiles
Example Configuration for transmission-daemon on WD My Cloud
============================================================
Here I will cover some basic configuration options to get transmission up and running.
0. Stop Transmission
# /etc/init.d/transmission-daemon stop
1. Go to your WD My Cloud Web Interface and create a new share, I called it "Transmission". This is the place where your downloads will be placed.
3. Create the following folders (assuming your share is called Transmission, case-sensitive!):
# mkdir /DataVolume/shares/Transmission/Complete
# mkdir /DataVolume/shares/Transmission/Incomplete
# mkdir /DataVolume/shares/Transmission/Watch
2. Open "/home/transmission/.config/transmission-daemon/settings.json" with a text editor and adapt it accordingly (an example: https://gist.github.com/sled/7743612 )
The key settings are:
download-dir
-> make sure download-dir lies on a share (e.g. /DataVolume/shares/Transmission/Complete)
incomplete-dir
-> make sure incomplete-dir lies on a share (e.g. /DataVolume/shares/Transmission/Incomplete)
watch-dir
-> make sure watch-dir lies on a share (e.g. /DataVolume/shares/Transmission/Watch)
rpc-username
-> choose an arbitrary username
rpc-password
-> choose an arbitrary password (will be hashed afterwards)
rpc-whitelist
-> MAKE SURE YOUR HOME NETWORK IP RANGE IS DEFINED! YOU CAN USE WILDCARDS!
MY HOME NETWORK USES AN IP RANGE THAT STARTS WITH 192.168.*.*
SO THE VALUE I CHOSE IS: "127.0.0.1,192.168.*.*"
umask
-> set to 0 so that all clients can read/write the downloaded files
3. Start transmission:
# /etc/init.d/transmission-daemon start
4. Go to http://<YOUR WD MY CLOUD IP>:9091 and ENJOY your torrent box!! :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment