This is an old revision of the document!


Cross Compile Environment for DNS-323

Firmware 1.05

This was done with http://tsd.dlink.com.tw/temp/download/3034/dns323_GPL_v1.05_05052008.tgz . Untar this tarball. You should find another one inside which holds the actual source. Untar that one as well.

Host build environment

This was done with

  • gcc (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu7)
  • bison (GNU Bison) 2.3
  • flex 2.5.34
  • gettext (GNU gettext-runtime) 0.17

To install these using apt do something like

sudo apt-get install gcc-4.2 bison flex gettext

Toolchain

The toolchain didn't quite compile out-of-the-box…

# untar everything
tar xzf uclibc-toolchain-src-20040609.tgz
cd uclibc-toolchain-src-20040609/gcc-3.3.x
 
# fix broken link
sed -i.old -e 's%ftp://ftp.gnu.org/gnu/gcc/releases/gcc-%ftp://ftp.gnu.org/gnu/gcc/gcc-%' -e 's/gdb //' make/gcc-uclibc-3.3.mk
 
# fix linux headers versioning
sed -i.old -e 's/UTS_RELEASE ­­­\\"2\.4\.21\\"/UTS_RELEASE \\"2.6.12.6-arm1\\"/' -e 's/LINUX_VERSION_CODE 132117/LINUX_VERSION_CODE 132620/' make/kernel-headers.mk
 
# do not build gdb.
# building gdb did not work for me. you might want give it a shot, if you really need the debugger..
# to do so just leave out these steps. if it fails, just retry from this point
sed -i.old 's/gdb #ccache$/# gdb #ccache/' Makefile
mv make/gdb-uclibc.mk make/gdb-uclibc.mk.dontinclude
 
# build a clean toolchain
# if some error occurs, try to fix it, drop a note somewhere and redo these two steps
make dirclean
yes "" | make

Voila, you just have built your cross-compiler. Note: this does not compile with gcc-4.2, but works with gcc-3.4

Setting up build environment for cross-compiling

Use crosstools-env.sh, which is in [http://www.inreto.de/dns323/source/funplug-src-0.4-2007-11-21.tar.bz2], and fix the CWD variable to suit your needs.

Now you should be able to compile whatever you need.

Firmware ?.??

Please feel free to update, cleanup or correct this page

What is this? This document shows how to build the D-LINK DNS-323 GPL toolchain, kernel and u-boot loader

Things you will need first

  • Development System x86-based Debian-based Ubuntu Linux "Dapper Drake" (6.06)
  • You will need the following tools: bison flex gcc-3.4 byacc g++-3.4 gettext patch
    • Check your active compiler version with gcc -v
    • If your compiler is newer then gcc-3.4 then change the /usr/bin/gcc symlink to point to /usr/bin/gcc-3.4 for building the toolchain - restore it when you are done
    • If g++ is newer than version 3.4 also change the /usr/bin/g++ symlink accordingly.
  • Make sure libncurses5-dev is installed or you'll get termcap not found error
  • Create a directory to build your source in
mkdir GPL
  • Create a directory to download the sources into
mkdir GPL/zips
  • Change into the GPL directory
cd GPL
tar xzf build_dns323.tgz
  • Download the GPL sources:
./wget_GPL
  • Build the ARM UCLIBC toolchain

Fix the bug in the script build_uclibc: on line 24, replace .tar.gz with .tgz (obviously the extension of the tarballs changed)

The path to the gcc sources has changed, so we need to fix it:

tar xzf zips/uclibc-toolchain-src-20040609.tgz

edit the file: uclibc-toolchain-src-20040609/gcc-3.3.x/make/gcc-uclibc-3.3.mk Change the so that the path defined on line 23 reads:

GCC_SITE:=ftp://ftp.gnu.org/gnu/gcc/gcc-$(GCC_VERSION)

Now, since we have already uncompressed the tar file, we comment out lines 23 and 24 of build_uclibc by adding a # to that start of each line.
Save the modified file, then run the script:

./build_uclibc

And now you must fix your symlinks. cd to $GPL/uclibc-toolchain-src-20040609/gcc-3.3.x/toolchain_arm/arm-linux-uclibc/lib and fix all broken links:

   for lib in crypt dl m nsl pthread resolv rt thread_db util; do ln -sf lib${lib}-* lib${lib}.so; done
   ln -sf libuClibc-0.9.28.so libc.so

Note For each build script below - extract the corresponding file from the zips directory. Example:

   tar xzf zips/linux-2.6.12.6.tgz

This creates a directory called linux-2.6.12.6 that build_kernel knows about.

  • Build the ARM kernel

fix bug in script build_kernel: on line 5, replace linux-2.6.6 by linux-2.6.12.6

./build_kernel
  • Build the u-boot loader. The script defaults to u-boot_1_1_1, but newer boxes use 1.7.3 - If you want to do so, you have to change the directory in the build_u-boot file accordingly and remove all .depend files from the u-boot_1_7_3 directory and its subdirectories.
./build_u-boot
  • Build busybox

The script needs a change; add line export CC=arm-linux-gcc, then execute.

./build_busybox
  • Build at
./build_at

Notes:

The ./build_uclibc script creates a script called setpath that can be used to compile other ARM uclibc programs later on.

Many of the remaining D-LINK sources have not been configured for being cross-compiled. In fact, the “Readme.txt” file they supply with the GPL sources has instruction that are just plain wrong.


Navigation

Personal Tools