Emdebian Cross Development Environment
Emdebian toolchain building Howto
Below is documented the build process for building cross-toolchains the 'Debian Way'. You only need to do this if the pre-built binary toolchains do not satisfy your needs for some reason.
A more up to date document can be found at Debian wiki.
Notation and exactly what things are called is important otherwise there can be much confusion, so we will clarify:
When building toolchains:
build == host
Build machine installing the cross compiler build Host machine running the cross compiler host Target machine for which the compiler builds code target
When building packages:
build != host
build machine running the cross compiler build host machine running the built package handheld device there is no particular meaning for 'target'.
Building your own toolchain is not a trivial matter, although this method is actually quite strightforward.
- gcc-4.0 or later
First get all the necessary build dependencies:
$ apt-get install dpkg-cross apt-cross fakeroot dpatch gawk flex realpath automake1.7 debhelper cdbs
This is not a complete list, of course you need gcc, but these are the most often forgotten ones.
Get the necessary sources :
$ apt-get source gcc-4.4 binutils
$ cd binutils-2.x
$ TARGET=$linux-architecture fakeroot debian/rules binary-cross (replace arch by arm, alpha,...)
Note that binutils versions above 2.20.51, have changed syntax to support TARGET=$linux-architecture dpkg-buildpackage -b -uc -us
Once the build is finished you have to install the package that was created with dpkg -i
For the next step you can use the existing Debian packages for your target architecture, after converting them with dpkg-cross, for the kernel-headers, and the related architectures
Download, convert and install the packages for libc6, libc6-dev and linux-libc-dev for your target architecture.
$ dpkg-cross -a $architecture -b $package
$ xapt -a arch package
When this process was succesful, we start with the last steps. We have to build the actual compiler.
$ export GCC_TARGET=arch (replace arch through arm, alpha,...)
$ cd gcc-4.4-x
$ fakeroot debian/rules control
$ dpkg-buildpackage -b -rfakeroot
After a succesful build, install the newly created gcc packages with dpkg -i package-name. These are (for arm):
Now you should have a brand new cross-compiler at your disposal.
Back to the Emdebian Project homepage.