emdebian logo
 

About Emdebian
 Emdebian & Debian
 Purpose
 Customisations
 Flavours
 Extending Emdebian
 Localisation support
 Emdebian Tdebs

Cross toolchains
 Toolchain packages

Emdebian Crush
 Packages
 Build Tools
 Repository Key
 Installation Guide

Emdebian Grip
 Packages
 Repository Key
 Update logs
 Installation Guide

Documentation
 Introductory Guide
 Emdebian Wiki
 Emdebian FAQ
 Packaging rules
 Packaging infrastructure
 Packaging guideline
 DebConf paper

Support
 Contact Us
 Mailing List Archives

Help Emdebian
 Developers' Info
 Subversion
 ToDo list

News

History
 Slind
 Stag
 Emdebsys

Links
 Emdebian Bootldr
 Emdebian Kernel
 Emdebian JTAG
 Scratchbox
 QEmu
 CELF

Valid HTML 4.01!

 
   

SLIND Cross Toolchains


This is the home page for the SLIND Cross Toolchains. Thanks to Alexander Shishkin for providing this document.

Slind cross toolchains

Slind toolchains are built from Debian compiler packages, using patches from Emdebian project, together with some additional patches crafted by us, the slind team.

Currently, the following components are used for slind toolchains:

  • GNU binutils (2.16.1)
  • Linux kernel headers (from 2.6.12 linux kernel source tree)
  • GNU C library/glibc (2.3.2)
  • uClibc (0.9.28)
  • GNU Compiler Collection/gcc (3.4.4).

Important note: in order to properly build slind toolchains you should install dpkg, dpkg-dev and dpkg-cross packages from slind/host repository.

Building a toolchain (from slind sources)

This section desctibes in detail the process of building a slind toolchain step-by-step. All the sources mentioned here should be taken from slind package repository. All tools involved in compilation should be taken from Debian ("Sarge" or later) unless otherwise stated. When you succeed with all the steps mentioned below, you should have the following packages (that form a toolchain) at your disposal: binutils, linux-kernel-headers, glibc or uclibc, gcc.

First, you need to know what architecture you wish to build a toolchain for. Architectures supported by slind are somewhat different from those in debian at the moment in that slind allows for uclibc- prefix in architecture names. These uclibc- targets are compiled against uClibc (a small implementation of a C library) instead of glibc. Currently supported uclibc targets are: uclibc-i386, uclibc-arm, uclibc-powerpc. Use these names if you want uclibc, otherwise use standard debian architecture names like i386, arm, powerpc etc. These architecture names are specific to debian and are referred to as 'debian architectures' or <arch> later in the text and examples.

Each debian architecture has a corresponding gnu architecture name. For glibc targets it looks like <cpu>-linux-gnu, for uclibc targets -- <cpu>-linux-uclibc. Here's the example (for a complete list of supported architecture names, please refer to /usr/share/dpkg/archtable file that comes with dpkg package from slind/host repository):

  • <GNU name> <Debian name>
  • arm-linux-gnu arm
  • powerpc-linux-uclibc uclibc-powerpc

These are referred to as GNU target names or <gnuarch> later in the text and examples.

1. Binutils.

Let's assume you have apt'able slind source repository. To obtain binutils sources, issue:

$ apt-get source binutils=2.16.1-2.slind1

and step into binutils source tree:

$ cd binutils-2.16.1

Now, in case you're building for an uclibc target, issue the following command:

$ env TARGET=<cpu>-linux LIBC_TARGET=uclibc fakeroot debian/rules binary-cross

and that will get you a binutils package. If your target of choice is glibc, then instead of the command above, issue:

$ env TARGET=<cpu> fakeroot debian/rules binary-cross

Now that you have a cross binutils package, install it using

$ dpkg -i ../binutils-<gnuarch>_2.16.1-2.slind1_i386.deb

2. Linux kernel headers.

Obtain linux-kernel-headers sources with the following command:

$ apt-get source linux-kernel-headers=2.6.12.0-1.slind1

and step into the source tree

$ cd linux-kernel-headers-2.6.12.0.orig

Build the package with

$ dpkg-buildpackage -uc -us -rfakeroot -a<arch> -b -d

Now you have to cast a dpkg-cross spell upon this package to make it usable in your cross development environment:

$ cd ..

$ dpkg-cross -a<arch> -b linux-kernel-headers_2.6.12.0-1.slind1_<arch>.deb

And install the freshly built cross-package with

$ dpkg -i linux-kernel-headers-<arch>-cross_2.6.12.0-1.slind1_all.deb

3. Libc development headers.

3.1. For a glibc target, get the glibc sources with

$ apt-get source glibc=2.3.2.ds1-22.slind1

$ cd glibc-2.3.2.ds1

To build the libc6-dev-headers package, issue:

$ env DEB_CROSS_BOOTSTRAP=yes dpkg-buildpackage -uc -us -rfakeroot -a<arch> -b -d

$ cd ..

Run dpkg-cross over the resulting package:

$ dpkg-cross -a<arch> -b libc6-dev-headers_2.3.2.ds1-22.slind1_<arch>.deb

And install with:

$ dpkg -i libc6-dev-headers-<arch>-cross_2.3.2.ds1-22.slind1_all.deb

3.2 For uclibc target, get the uclibc sources with

$ apt-get source uclibc=0.9.28-1slind0

$ cd uclibc-0.9.28

Build the package with

$ env DEB_CROSS_BOOTSTRAP=yes dpkg-buildpackage -uc -us -rfakeroot -a<arch> -b -d

$ cd ..

Call dpkg-cross and install the final package:

$ dpkg-cross -a<arch> -b libuclibc-dev-headers_0.9.28-1slind0_<arch>.deb

$ dpkg -i libuclibc-dev-headers-<arch>-cross_0.9.28-1slind0_all.deb

4. Bootstrap compiler.

Get the sources for gcc-3.4:

$ apt-get source gcc-3.4=3.4.4-5.slind1

$ cd gcc-3.4-3.4.4

To build a bootstrap compiler package, issue:

$ env GCC_TARGET=<arch> DEB_CROSS_BOOTSTRAP=yes dpkg-buildpackage -uc -us -rfakeroot -b -d

$ cd ..

Now, install the packages with

$ dpkg -i gcc-3.4-<gnuarch>_3.4.4-5.slind1_i386.deb cpp-3.4-<gnuarch>_3.4.4-5.slind1_i386.deb libgcc1-<arch>-cross_3.4.4-5.slind1_all.deb

Now that you have a bootstrap compiler, it's time to build real libc packages.

5. C library.

First of all, you should remove the package with libc development headers. So, for glibc, do

$ dpkg --remove libc6-dev-headers-<arch>-cross_2.3.2.ds1-22.slind1_all.deb

or, in case of uclibc target:

$ dpkg --remove libuclibc-dev-headers-<arch>-cross_0.9.28-1slind0_all.deb

5.1. For glibc, do the following:

$ cd glibc-2.3.2.ds1

$ dpkg-buildpacakge -uc -us -rfakeroot -a<arch> -b -d

$ cd ..

Run dpkg-cross over the packages:

$ dpkg-cross -a<arch> -b libc6_2.3.2.ds1-22.slind1_<arch>.deb libc6-dev_2.3.2.ds1-22.slind1_<arch>.deb

and install them:

$ dpkg -i libc6-<arch>-cross_2.3.2.ds1-22.slind1_all.deb libc6-dev-<arch>-cross_2.3.2.ds1-22.slind1_all.deb

5.2. For an uclibc target, do the following:

$ cd uclibc-0.9.28

$ dpkg-buildpackage -uc -us -rfakeroot -a<arch> -b -d

$ cd ..

Run dpkg-cross:

$ dpkg-cross -a<arch> -b libuclibc0_0.9.28-1slind0_<arch>.deb libuclibc-dev_0.9.28-1slind0_<arch>.deb

And install the packages:

$ dpkg -i libuclibc0-<arch>-cross_0.9.28-1slind0_all.deb libuclibc-dev-<arch>-cross_0.9.28-1slind0_all.deb

6. Build the final compiler.

This one is quite easy as well:

$ cd gcc-3.4-3.4.4

$ env GCC_TARGET=<arch> DEB_TARGET_LIBCXX=yes dpkg-buildpackage -uc -us -rfakeroot -b -d

Note, that if you don't need c++ development packages, you may omit the DEB_TARGET_LIBCXX=yes part.

Now, install the whole lot of gcc packages:

$ dpkg -i gcc-3.4-<gnuarch>_3.4.4-5.slind1_i386.deb cpp-3.4-<gnuarch>_3.4.4-5.slind1_i386.deb libgcc1-<arch>-cross_3.4.4-5.slind1_all.deb

(and c++ related packages, if any)

$ dpkg -i g++-3.4-<gnuarch>_3.4.4-5.slind1_i386.deb libstdc++6-<arch>-cross_3.4.4-5.slind1_all.deb libstdc++6-dev-<arch>-cross_3.4.4-5.slind1_all.deb

Congratulations!
You managed to build a cross-compilation toolchain for your favourite <arch> architecture.
Have fun!

Sincerely,

Your toolchain master <alexander.shishkin _at_ siemens.com>


See the emdebian contact page for information on contacting us.

Last Modified: Wed, Sep 10 02:31:14 UTC 2008
Copyright © 2000-2008 The Embedded Debian Project;
Emdebian is an offical subproject of Debian.