Download Link
You can download a pre-configured, minimal virtual machine image with the cross-compiler ready to use from https://wmtprojectsforum.altervista.org ... NAS%20Box/. You need to extract the archive, and then import the OVA file. The archive is very highly compressed, so this may take a while. Attached is the OVF file containing the machine spec, in case it is used again later when re-compressing this machine. Instructions to re-produce this virtual machine are below.
Documentation link: http://crosstool-ng.github.io/docs/.
For this purpose, I decided to use crosstool-NG: http://crosstool-ng.github.io/. The documentation is a bit light, so I have added some notes here to remind me/anyone else how to set it up if we need an aid memoir.
Environment
The required version of crosstool-ng will not build on anything newer than Ubuntu 14.04. As a result, I have set up an Ubuntu 14.04 Virtual Machine. This was set up using the following instructions.
An internet connection will be required to create the cross-compilation toolchain, as well as plenty of RAM and disk space. I allocated 4GB of RAM and 30GB of disk space to my VM, which seems to be fine.
Create the user "wmt" during the installation. Make sure all available updates are applied after installation.
Dependencies
You need to install the following dependencies:
Code: Select all
sudo apt install -y subversion gcc g++ gcj-4.8 gperf bison cvs flex expat texinfo help2man make libncurses5-dev python3-dev autoconf automake libtool gawk wget bzip2 xz-utils unzip patch libstdc++6
Downloading the cross compiler
The latest version of crosstool-ng does not support the glibc, binutils, and kernel versions the NAS box uses. However, v1.17.0 is fairly recent, and produces a newer version of GCC (4.7.2) than the cross compilation tools provided by D-Link.
These instructions are aimed at configuring crosstool-ng v1.17.0 to build for armv5te.
To start with, download crosstool-ng 1.17.0 from https://wmtprojectsforum.altervista.org ... /NAS%20Box or http://crosstool-ng.org/download/crosstool-ng/ and verify the download with the SHA-512 sum (available from same location):
Code: Select all
sha512sum -c /path/to/checksum-file
Code: Select all
tar -xf /path/to/tarball
I then followed "The Hacker's Way" for the install method, thinking this would be easier. This builds the cross-compiler in the same directory as the source, rather than installing it in your system folders:
Code: Select all
./configure --enable-local
make
Code: Select all
./ct-ng help
Run
Code: Select all
./ct-ng menuconfig
Now you need to load the saved configuration I have found to work:
- Download the latest version of the configuration from the end of this post.
- Run ./ct-ng menuconfig as above.
- Select the "Load an Alternate Configuration File" option.
- Type in the full path to, and name of, the configuration file here, and press ENTER.
- Select the "Save an Alternate Configuration File" option.
- Enter ".config", and press ENTER.
- Press TAB too select the "Exit" option at the bottom of the screen and press ENTER.
- If asked to save configuration, confirm the save operation.
NOTE: I have now also uploaded these files (and all the other dependencies) to https://wmtprojectsforum.altervista.org ... pendencies in case the download locations change again.
In a few places, these build scripts attempt to download tarballs from sources that have moved. The following changes need to be made:
Linux Kernel Download Location
The kernel is no longer available where the script attempts to download it. Open the file
Code: Select all
scripts/build/kernel/linux.sh
Code: Select all
korg_base="http://ftp.kernel.org/pub/linux/kernel/${rel_dir}"
Code: Select all
korg_base="http://mirrors.edge.kernel.org/pub/linux/kernel/${rel_dir}"
MPC is no longer available where the script attempts to download it. Open the file
Code: Select all
scripts/build/companion_libs/mpc.sh
Code: Select all
http://www.multiprecision.org/mpc/download
Code: Select all
http://www.multiprecision.org/downloads
The "duma" package is no longer available where the script is looking for it. Open the file
Code: Select all
scripts/build/debug/200-duma.sh
Code: Select all
dl_base="http://downloads.sourceforge.net/project/duma/duma"
Code: Select all
dl_base="https://sourceforge.net/projects/duma/files/duma"
Starting the build
Run:
Code: Select all
./ct-ng build
After the build has finished
The cross-compiler will be found in ~/x-tools/arm-unknown-linux-gnueabi/bin. In order to make using these tools easier, it is advisable to add them to your PATH variable, by adding the following to the end or your ~/.bashrc file:
Code: Select all
export PATH=$PATH:~/x-tools/arm-unknown-linux-gnueabi/bin
Code: Select all
source ~/.bashrc
This can be done with QEMU. Simple run the command:
Code: Select all
sudo apt install qemu-user-static
Code: Select all
export QEMU_LD_PREFIX=/home/wmt/nas-sysroot
export LD_LIBRARY_PATH="/home/wmt/nas-sysroot/lib:/home/wmt/nas-sysroot/usr/local/lib"
You may need to add the following snippet of code before you run binaries built for the NAS box:
Code: Select all
LD_LIBRARY_PATH="/home/wmt/nas-sysroot/lib:/home/wmt/nas-sysroot/usr/local/lib"