WD Cloud runs Debian Linux on ARM. When you build applications for other architectures, you need to use cross-building. I have successfully built a package on Ubuntu 14 by following this post with a few notes.
If you see an error message like: {% codeblock lang
%} Err http://ftp.debian.org wheezy-updates Release.gpg Could not resolve āftp.debian.orgā {% endcodeblock %}Then, copy /etc/resolv.conf into build/etc, e.g., {% codeblock lang
%} sudo cp /etc/resolv.conf build/etc {% endcodeblock %}Summary of Cross-Building with Wheezy for WD Cloud Firmware Version 4 or Above
{% codeblock lang
%}required for cross-building
apt-get install qemu-user-static apt-get install binfmt-support
folder for building
mkdir wdmc-build cd wdmc-build
download location can be found in http://support.wdc.com/product/download.asp?groupid=904&lang=en
wget http://download.wdc.com/gpl/gpl-source-wd_my_cloud-04.01.03-421.zip
unzip gpl-source-wd_my_cloud-04.01.03-421.zip packages/build_tools/debian/* mkdir 64k-wheezy cp -R packages/build_tools/debian/* ./64k-wheezy echo ā#!/bin/bashā > 64k-wheezy/build.sh echo ā./build-armhf-package.sh āpagesize=64k $1 wheezyā >> 64k-wheezy/build.sh chmod a+x 64k-wheezy/build.sh
cd 64k-wheezy
the setup script will prompt for root password during chroot
./setup.sh bootstrap/wheezy-bootstrap_1.24.14_armhf.tar.gz build
sudo mv build/usr/bin/qemu-arm-static build/usr/bin/qemu-arm-static_orig sudo cp /usr/bin/qemu-arm-static build/usr/bin/qemu-arm-static
override build/etc/apt/sources.list
sudo echo ādeb http://security.debian.org/ wheezy/updates main contrib non-freeā > build/etc/apt/sources.list sudo echo ādeb-src http://security.debian.org/ wheezy/updates main contrib non-freeā >> build/etc/apt/sources.list sudo echo ādeb http://ftp.debian.org/debian wheezy-updates main contrib non-freeā >> build/etc/apt/sources.list sudo echo ādeb-src http://ftp.debian.org/debian wheezy-updates main contrib non-freeā >> build/etc/apt/sources.list sudo echo ādeb http://ftp.debian.org/debian wheezy main contrib non-freeā >> build/etc/apt/sources.list sudo echo ādeb-src http://ftp.debian.org/debian wheezy main contrib non-freeā >> build/etc/apt/sources.list
optional until you need to use backports packages
sudo echo ādeb http://ftp.debian.org/debian wheezy-backports main contrib non-freeā >> build/etc/apt/sources.list sudo echo ādeb http://ftp.debian.org/debian wheezy-backports main contrib non-freeā >> build/etc/apt/sources.list
sudo cp /etc/resolv.conf build/etc {% endcodeblock %}
Then you can build by running build.sh with the package name, e.g.,
{% codeblock lang
It will download the source package from the repository, cross-compile it, and build a deb file. The process could take over 10 minutes. Once it is successful, you can scp the .deb file to your router and install it with dpkg -i.
Building Node.js Manually
It is a little tricky to build Node.js because the source is not in the repository. I have tried to use a binary from http://nodejs.org/dist/v0.12.0/node-v0.12.0-linux-x86.tar.gz, but it failed with:
cannot execute binary file
You can follow the scripts to build it manually:
{% codeblock lang
setup utils
./setup.sh bootstrap/wheezy-bootstrap_1.24.14_armhf.tar.gz build sudo mkdir -p build/root/binutils sudo tar vfx binutils/binutils-armhf-64k.tar.gz -C build/root/binutils sudo chroot build /bin/bash cd /root/binutils dpkg -i binutils_.deb dpkg -i binutils-multiarch_.deb export DEBIAN_FRONTEND=noninteractive export DEBCONF_NONINTERACTIVE_SEEN=true export LC_ALL=C export LANGUAGE=C export LANG=C export DEB_CFLAGS_APPEND=ā-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCEā export DEB_BUILD_OPTIONS=nocheck cd /root
now the build environment is ready
wget http://nodejs.org/dist/v0.12.0/node-v0.12.0.tar.gz tar vfxz node-v0.12.0.tar.gz cd node-v0.12.0 ./configure make
go back to original environment
exit {% endcodeblock %} The binary is ready in build/root/node-v0.12.0/node for you to upload to the WD Cloud. You can upload to /usr/local/bin in your WD Cloud.
You also need to download npm and other components from http://nodejs.org/dist/v0.12.0/node-v0.12.0-linux-x86.tar.gz. Extract the files and put them in either /usr/local or /usr. {% codeblock lang
%} wget http://nodejs.org/dist/v0.12.0/node-v0.12.0-linux-x86.tar.gz tar vfxz node-v0.12.0-linux-x86.tar.gz cd node-v0.12.0-linux-x86 rm bin/node cp -R include /usr/local cp -R share /usr/local cp -R lib /usr/local cp -R bin /usr/local {% endcodeblock %} Remember not to override the binary you have uploaded.Package List
Below is a list of packages I have successfully built:
- htop
- joe
- unrar
- transmission
- libcurl3-gnutls
- libminiupnpc5
- libnatpmp1
- transmission-common
- transmission-daemon
- Node.js prerequisites
- libc-ares2
- libv8
- python3-pip
- libcurl3-gnutls
- python2.6
- python3
- python3-pkg-resources
- python3-setuptools
- python-pkg-resources
- python-setuptools
- liberror-perl (required for git)
- git
- rrdtool (required for cacti)
- virtual-mysql-client (required for cacti)
- php5-mysql (required for cacti)
- dbconfig-common (required for cacti)
- libphp-adodb (required for cacti)
- snmp (required for cacti)
- php5-snmp (required for cacti)
- cacti
Packages are uploaded to https://app.box.com/wdcloud.
Script to build: {% gist 1629e9a9bf266fb4abfc %}