| 1 | #use wml::emdebian::mainpage title="Cross-development toolchains" |
|---|
| 2 | #use wml::emdebian::recent_list |
|---|
| 3 | # #include "$(ENGLISHDIR)/releases/info" |
|---|
| 4 | |
|---|
| 5 | <h2>Cross Toolchains</h2> |
|---|
| 6 | |
|---|
| 7 | We provide a set of aptable tools built from standard Debian binutils and gcc sources. |
|---|
| 8 | These provide cross-build toolchains from i386 to arm, mips, mipsel and powerpc |
|---|
| 9 | targets currently. Others can easily be built if they are needed - please ask. |
|---|
| 10 | They are maintained by <a href="http://zigzag.lvk.cs.msu.su/~nikita">Nikita |
|---|
| 11 | Youschenko</a>. |
|---|
| 12 | |
|---|
| 13 | <h3>Download</h3> |
|---|
| 14 | <p>Currently binutils 2.15, gcc3.3.5 and 3.4.3 are provided, built for Debian stable.</p> |
|---|
| 15 | |
|---|
| 16 | You just have to add this line to your /etc/apt/sources.list:</p> |
|---|
| 17 | <box> |
|---|
| 18 | \###################################### <br> |
|---|
| 19 | \# Emdebian tools<br> |
|---|
| 20 | \#<br> |
|---|
| 21 | deb http://www.emdebian.org/emdebian-tools/stable ./<br> |
|---|
| 22 | </box> |
|---|
| 23 | <br> |
|---|
| 24 | |
|---|
| 25 | <p>Then do <b>apt-get update</b> to update your local lists. |
|---|
| 26 | |
|---|
| 27 | <p><b><tt>apt-get install gcc-3.3-arm-linux |
|---|
| 28 | libc6-dev-arm-cross</tt></b> will install the gcc3.3 |
|---|
| 29 | toolchain for arm cross-compiling</p> |
|---|
| 30 | |
|---|
| 31 | <p><b><tt>apt-get install gcc-3.4-arm-linux |
|---|
| 32 | libc6-dev-arm-cross</tt></b> for the 3.4 version</p> |
|---|
| 33 | |
|---|
| 34 | <p>Another alternative you have is to use Slind toolchain |
|---|
| 35 | repository. This uses Nikita's patches plus Slind team |
|---|
| 36 | patches, check <a href="./slind.html">Slind webpage</a> for more information about |
|---|
| 37 | it. </p> |
|---|
| 38 | |
|---|
| 39 | <box> |
|---|
| 40 | \#######################<br> |
|---|
| 41 | \# SLIND Toolchain<br> |
|---|
| 42 | deb http://www.emdebian.org/slind/host/ suffolk main<br> |
|---|
| 43 | deb-src http://www.emdebian.org/slind/host/ suffolk main<br> |
|---|
| 44 | </box> |
|---|
| 45 | <br> |
|---|
| 46 | |
|---|
| 47 | <h3>Building your own</h3> |
|---|
| 48 | |
|---|
| 49 | <p>Note that you have an <a |
|---|
| 50 | href="./docs/slind-toolchain.html">alternative |
|---|
| 51 | method</a> described by |
|---|
| 52 | Alexander Shiskin about building cross toolchains.</p> |
|---|
| 53 | |
|---|
| 54 | <p>Below is documented the build process for building cross-toolchains the |
|---|
| 55 | 'Debian Way'. You only need to do this if the above bre-built tools |
|---|
| 56 | do not satisfy your needs for some reason.</p> |
|---|
| 57 | |
|---|
| 58 | <p>We use the <a href="./files/compbuildscript">compbuildscript</a> |
|---|
| 59 | to build the toolchains. |
|---|
| 60 | This takes care of downloading the sources and patches, installing the |
|---|
| 61 | necessary arch-specific packages (glibc, kernel headers), and building |
|---|
| 62 | the compilers. It is essentially a script implmenting what is described below.</p> |
|---|
| 63 | |
|---|
| 64 | <p><a href="http://zigzag.lvk.cs.msu.su/~nikita/debian/cross-patches">These |
|---|
| 65 | patches</a> to the debian sources are used for this build.</p> |
|---|
| 66 | <hr /> |
|---|
| 67 | |
|---|
| 68 | <p>Notation and exactly what things are called is important otherwise |
|---|
| 69 | there can be much confusion, so we will clarify: The building machine |
|---|
| 70 | is called the <b>build host</b> or <b>host</b> and the target device |
|---|
| 71 | is referred toas the <b>target</b>. </p> |
|---|
| 72 | |
|---|
| 73 | <p>Building your own toolchain is not a trivial matter, although this |
|---|
| 74 | method is actually quite strightforward.</p> |
|---|
| 75 | <ul> |
|---|
| 76 | <li><dt><b> Install a binary toolchain </b></dt> |
|---|
| 77 | <dd> |
|---|
| 78 | <br> |
|---|
| 79 | <br> |
|---|
| 80 | </dd> |
|---|
| 81 | </li> |
|---|
| 82 | <li><dt><b> Install a toolchain from sources </b></dt> |
|---|
| 83 | <dd> |
|---|
| 84 | |
|---|
| 85 | <p> |
|---|
| 86 | This one is valid for gcc-3.4 and should work with the following releases too, when the patches |
|---|
| 87 | get accepted in mainstream Debian.</p> |
|---|
| 88 | |
|---|
| 89 | <p>First get all the necessary build dependencies: </p> |
|---|
| 90 | <p>$ apt-get install dpkg-cross fakeroot dpatch autoconf2.13 gawk flex realpath automake1.7 debhelper cdbs <p/> |
|---|
| 91 | <p><h4>This is not a complete list, of course you need gcc, but these are the most often forgotten ones.</h4></p> |
|---|
| 92 | <p>Get the necessary sources :</p> |
|---|
| 93 | <p>$ apt-get source gcc-3.4 binutils libc</p> |
|---|
| 94 | <p>Now you have to get the patch for binutils, which has not yet been accepted in Debian proper, at |
|---|
| 95 | <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=231707">bugs.debian.org.</a>It can be found <a href="http://zigzag.lvk.cs.msu.su/~nikita/debian/cross-patches/binutils-cross-2.15-6.patch.20050707">here</a> |
|---|
| 96 | and it is called binutils-cross-2.15-6.patch. Apply it before building the binutils.</p> |
|---|
| 97 | <p>$ patch -p0 < binutils-cross-2.15-6.patch <br> |
|---|
| 98 | $ cd binutils-2.15 <br> |
|---|
| 99 | $ TARGET=arch-linux fakeroot debian/rules binary-cross (replace arch by arm, alpha,...)</p> |
|---|
| 100 | <p>Once the build is finished you have to install the package that was created with dpkg -i</p> |
|---|
| 101 | <p>For the next step you can use the existing Debian packages for your target architecture, after |
|---|
| 102 | converting them with dpkg-cross, for the kernel-headers, and the related architectures</p> |
|---|
| 103 | <p>Find the packages for libdb1-compat, libc6, libc6-dev and linux-kernel-headers for your target architecture. |
|---|
| 104 | Either through packages.debian.org or a Debian mirror. Then convert and install them.</p> |
|---|
| 105 | <p>$ dpkg-cross -b -a arch package<br> |
|---|
| 106 | $ dpkg -i converted-package<br></p> |
|---|
| 107 | <p>When this process was succesful, we start with the last steps. We have to build |
|---|
| 108 | the actual compiler. (note: gcc-3.3 needs an older flex than gcc-3.4)</p> |
|---|
| 109 | <p> |
|---|
| 110 | $ export GCC_TARGET=arch (replace arch trough arm, alpha,...)<br> |
|---|
| 111 | $ cd gcc-3.4-3.4.2<br> |
|---|
| 112 | $ debian/rules control<br> |
|---|
| 113 | $ dpkg-buildpackage -b -rfakeroot<br> |
|---|
| 114 | </p> |
|---|
| 115 | <p>After a succesful build, install the newly created gcc packages with dpkg -i package-name. |
|---|
| 116 | These are (for arm): <ul> |
|---|
| 117 | <li> libstdc++6-0-arm-cross_3.4.2-3_all.deb |
|---|
| 118 | <li>libstdc++6-0-dev-arm-cross_3.4.2-3_all.deb |
|---|
| 119 | <li>libstdc++6-0-dbg-arm-cross_3.4.2-3_all.deb |
|---|
| 120 | <li>libstdc++6-0-pic-arm-cross_3.4.2-3_all.deb, |
|---|
| 121 | <li>g++-3.4-arm-linux_3.4.2-3_i386.deb |
|---|
| 122 | <li>gcc-3.4-arm-linux_3.4.2-3_i386.deb |
|---|
| 123 | <li>cpp-3.4-arm-linux_3.4.2-3_i386.deb |
|---|
| 124 | <li>libgcc1-arm-cross_3.4.2-3_all.deb. |
|---|
| 125 | </ul><br> |
|---|
| 126 | Now you should have a brand new cross-compiler at your disposition.</p> |
|---|
| 127 | |
|---|
| 128 | </dd> |
|---|
| 129 | </li> |
|---|
| 130 | </ul> |
|---|
| 131 | <p>Once build host is setted up, we've got a target device that is going to be used</p> |
|---|