Toolchain to develop software for DNS-300

Toolchain is set of tools to compile software for some device/platform.
Two types of toolchains are possible:

  • toolchain for crosscompile - to compile software on PC compatible computer
  • native toolchain - to compile software directly on DNS-300

I've created my toolchains using following software:

  • binutils-2.17
  • gcc-4.1.1
  • glibc-2.2.5 (binaries from OpenRG toolchain)
  • header files for glibc-2.2.5 from OpenRG toolchain
  • Linux kernel header files from DLink's Linux kernel for DNS-312H
I've created this manual some time later after successful creating of toolchain, so I can forget something…

Toolchain for crosscompile

How to create Crosscompile toolchain

Prepare directories structure

mkdir -p /opt/src
mkdir -p /opt/build
mkdir -p /opt/toolchain
mkdir -p /opt/toolchain-native
cd /usr/bin/
ln -s ar i686-pc-linux-gnu-ar
ln -s as i686-pc-linux-gnu-as
ln -s cpp i686-pc-linux-gnu-cpp
ln -s gcc i686-pc-linux-gnu-gcc
ln -s gcov i686-pc-linux-gnu-gcov
ln -s ld i686-pc-linux-gnu-ld
ln -s ldd i686-pc-linux-gnu-ldd
ln -s nm i686-pc-linux-gnu-nm
ln -s objcopy i686-pc-linux-gnu-objcopy
ln -s objdump i686-pc-linux-gnu-objdump
ln -s ranlib i686-pc-linux-gnu-ranlib

Configure and make binutils

cd /opt/src
tar -xzf ./binutils-2.17.tar.gz
mkdir -p /opt/build/bilutils-2.17
cd /opt/build/binutils-2.17/

../../src/binutils-2.17/configure \
  --prefix=/opt/toolchain \
  --target=armv4lt-dns300-linux \

make install

Configure GCC

cd /opt/src
tar -xzf ./gcc-4.1.1.tar.gz
mkdir -p /opt/build/gcc-4.1.1-cross
cd /opt/build/gcc-4.1.1-cross/
PATH=/opt/toolchain/bin:$PATH \
../../src/gcc-4.1.1/configure --prefix=/opt/toolchain \
  --build=i686-pc-linux-gnu \
  --host=i686-pc-linux-gnu \
  --srcdir=../../src/gcc-4.1.1 \
  --with-sysroot=/opt/toolchain/armv4lt-dns300-linux \
  --with-as=/opt/toolchain/bin/armv4lt-dns300-linux-as \
  --with-ld=/opt/toolchain/bin/armv4lt-dns300-linux-ld \
  --enable-languages=c \
  --target=armv4lt-dns300-linux \
  --with-build-time-tools=/opt/toolchain/armv4lt-dns300-linux/bin \
  --with-float=soft \

To be continued…

Native toolchain for DNS-300

I've compiled native toolchain by my crosscompile toolchain. Maybe sometime, I'll describe compilation procedure, but now you can just download my native toolchain and use it.

How to install native toolchain

  1. First you should have installed IPKG package libfloat, because it's necessary for my toolchain
  2. Copy archive to DNS-300.
  3. Unpack this to somewhere. For example I have it in /home/sergey/toolchain/.
    cd /home/sergey/toolchain ; tar -xzf dns300-toolchain-1.1.tar.gz
  4. Create symbolic link /opt/toolchan-native/ pointing to your unpacked toolchain.
    For my system it is command: ln -s /home/sergey/toolchain /opt/toolchain-native

How to use native toolchain

Note: my toolchain contains only compiler + gcc libraries from OpenRG. To compile most programs you should compile and install additional binaries like: awk, automake, findutils, etc…

  1. Add path to toolchain to PATH. export PATH=/opt/toolchain-native/usr/local/bin:$PATH
  2. Run gcc. You should see message:
root@DNS-300:/# gcc
gcc: no input files

So now you can use GCC to compile very simple programs, like hello-world.c. To compile complex project you should compile additional binaries. First try to compile sed to test.

How to compile sed for Toolchain

  1. Download sed archive from GNU FTP.
  2. Unpack it somewhere. For example: /home/sergey/src/sed/
  3. Configure this with your toolchain.
./configure --prefix=/opt/toolchain-native/usr/local/
  1. Compile this: make
  2. Install this: make install. This step is unecessary, because toolchain contains sed already, but you can test how 'install' works.

How to compile something to use with IPKG system

  1. Configure source with –prefix=/home/root/opt/usr , because other programs in IPKG for DNS-300 are compiled with the same prefix.
  2. Install your program into /home/root/…, by make install
  3. Test your program.
  4. Create IPKG module for this. :-)
software/toolchain.txt · Last modified: 2007/02/03 13:31 by sergeyzh
CC Attribution-Noncommercial-Share Alike 3.0 Unported Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0