<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Building the GNU toolchain for ARM target</title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="Valentin Pavlov">
<meta name="Keywords" content="gnu,gcc,linux,kernel,arm">
</head>

<body bgcolor="#FFFFFF">
<table width="100%">
<tr width="100%">
        <td valign="center" align="center">
          <font size=+4>Building ProSyst's Linux for ARM target</font>
          <br>By <a href="mailto:v_valchev@prosyst.bg">Valentin Valchev</a>
        </td>
        <td width="120"><img src="../linux.gif" width="120" height="141" border=0 alt="Linux Logo"></td>
</tr>
</table>
<h1>Introduction</h1>
This document describes how to build common tools and prepare the ProSyst's Linux <i>root image</i>. These are general instructions for cross-compiling a small portion of packages that are needed for a small, embedded linux distribution. Before you proceed to the build instructions first create folder <i>distro</i> in your home dir.
<p>

<h1>Busybox</h1>
Busybox is package for embedded linux distrubution that contains replacement for the most common unix tools - such as sh, ls, rm, cat, echo .. etc. The version we use is <i>busybox-0.47</i> and can be downloaded from <a href="http://www.lineo.com/">Lineo's site</a>. To build it unpack it, change to the folder <i>busybox-0.47</i> and then run:
<pre>
  CFLAGS="-DBB_FEATURE_SH_BACKTICKS -DBB_FEATURE_SH_IF_EXPRESSIONS -DBB_FEATURE_SH_ENVIRONMENT" make CROSS=arm-linux-gnu-
  make CROSS=arm-linux-gnu- PREFIX=~/distro install
</pre>
This will build the sources and install everything in ~/distro folder.

<h1>e3 - the editor</h1>
Every os needs an editor - just a simple and easy to use editor. Since we need <font size=-1>small</font> editor the choice is e3. It can be downloaded from <a href="http://www.sax.de/~adlibit/">http://www.sax.de/~adlibit/</a>. The version we use is e3-0.9 which is the latest release at the time of writing this document. Unfortunately the Makefile does not allow cross compilation so we will do it manually. Extract the archive and change to the new dir. Then run:
<pre>
  arm-linux-gnu-gcc -s -Wall -Wno-multichar -g -O2 -fomit-frame-pointer -DLIBDIR=\"/usr/lib\" e3.c -o e3
  install -m 755 e3 ~/distro/usr/bin
  install -m 644 *.hlp *.res ~/distro/usr/lib
</pre>
Now you have an editor! ;)

<h1>Net Tools</h1>
If you plan to use connect the embedded linux distribution to the network then you should have at least net-tools-1.57 which is the latest release regarding to 25.10.2000y. To build them download the sources and extract the archive. Change to the source dir and follow the instructions:
<pre>
  make CC=arm-linux-gnu-gcc BASEDIR=~/distro LOPTS=-s
</pre>
At this point you will see some messages and ERROR! This will stop make process! But don't worry! Continue with this:
<pre>
  arm-linux-gnu-ranlib lib/libnet-tools.a
  make CC=arm-linux-gnu-gcc BASEDIR=~/distro LOPTS=-s install
</pre>
The make process should be resumed and everything will be installed under ~/distro folder

<h1>Java Support</h1>
If you intend to run any java program on this embedded linux we should have java virtual machine. And we choose kaffe - open source JVM which is well tested and already ported to ARM platform. It will not be difficult to compile and install kaffe. Just do this:
<pre>
  CC=arm-linux-gnu-gcc \
  AR=arm-linux-gnu-ar \
  LD=arm-linux-gnu-ld \
  NM=arm-linux-gnu-nm \
  RANLIB=arm-linux-gnu-ranlib \
  KAFFEH=/home/fire/kaffeh \
  CFLAGS=-Os LDFLAGS=-s \
  ./configure \
  --host=arm-linux-gnu \
  --enable-shared \
  --disable-debug \
  --disable-xprofiling \
  --disable-xdebugging \
  --disable-feedback \
  --without-suncompat \
  --without-profiling \
  --without-libffi \
  --without-x \
  --without-stats \
  --disable-gcj \
  --prefix=/usr
  
  make

  make DESTDIR=~/distro install
</pre>
You may notice that many features are disabled but this is not significant loose of features. Most of them are not neccesary and will be only waste of space for embedded targets.

<h1>Conclusion</h1>
Before you have a complete java enabled, embedded linux distribution you should create <i>dev, proc, lib, etc</i> directories in ~distro. Then compy all the libraries from /opt/cross/powerpc/powerpc-linux-gnu/lib to ~disto/lib and create your config files in etc.<br>
There are many many toosl you can build with the ARM Cross Compiler Toolchain. You can try almost everything. Although the tools mentioned here are not enough for serious distribution it is much pretty for embedded java enabled linux distribution which will run over minix filesystem. Using linux kernels 2.4.X will dramaticaly decrease the size of distribution <i>root image</i> if devfs driver is enabled and all other drivers are linked-in kernel so modutils are not neccesary.
<h1>Links</h1>
<a href="http://www.arm.linux.org.uk/">The ARM Linux Project</a><br>
<a href="http://www.kaffe.org/">Kaffe.org</a><br>
<a href="http://www.lineo.com">Lineo - Embedded Linux Solutions</a><br>
<a href="http://www.tazenda.demon.co.uk/phil/armlinux/">Philip Blundell's ARM Linux Site</a><br>
<hr>
Last modified 20.10.2000.<br>
Valentin Valchev &lt;<a href="mailto:v_valchev@prosyst.bg">v_valchev@prosyst.bg</a>&gt;
</body>
</html>