summaryrefslogtreecommitdiff
path: root/www/cross-gcc.t
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-03-27 09:25:09 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-03-27 09:25:09 +0000
commit554b95aad3189b07d69f0b8fb59fda1932e0ac68 (patch)
tree00a02629ebb27e5b3db46914bad38e105d20972b /www/cross-gcc.t
parentf883986dd1f89d47c796dc0c1e8e5edf5d9fb16f (diff)
downloadrockbox-554b95aad3189b07d69f0b8fb59fda1932e0ac68.tar.gz
rockbox-554b95aad3189b07d69f0b8fb59fda1932e0ac68.zip
Initial revision
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'www/cross-gcc.t')
-rw-r--r--www/cross-gcc.t92
1 files changed, 92 insertions, 0 deletions
diff --git a/www/cross-gcc.t b/www/cross-gcc.t
new file mode 100644
index 0000000000..8e6b72a66c
--- /dev/null
+++ b/www/cross-gcc.t
@@ -0,0 +1,92 @@
1#define _PAGE_ Building the SH1 cross compiler
2#include "head.t"
3
4<p>
5In this example I will assume that you are running Linux with the bash shell.
6We will only build the C compiler along with the assembler, linker and stuff.
7<h2>Download the source code</h2>
8<p>
9You will need the following archives:
10<ul>
11<li>binutils-2.11.tar.gz (find it at your closest GNU FTP site)
12<li>gcc-3.0.3.tar.gz (find it at your closest GNU FTP site)
13<li>newlib-1.10.0.tar.gz (go to <a href="http://sources.redhat.com/newlib/">the newlib home page</a> for information)
14<li>(optional) gdb-5.1.1.tar.gz (find it at your closest GNU FTP site)
15</ul>
16<h2>Unpack the archives</h2>
17<p>
18<pre>
19 /home/linus> tar zxf binutils-2.11.tar.gz
20 /home/linus> tar zxf gcc-3.0.3.tar.gz
21 /home/linus> tar zxf newlib-1.10.0.tar.gz
22 /home/linus> tar zxf gdb-5.1.1.tar.gz
23</pre>
24<h2>Create the directory tree</h2>
25<p>
26<pre>
27 /home/linus> mkdir build
28 /home/linus> cd build
29 /home/linus/build> mkdir binutils
30 /home/linus/build> mkdir gcc
31 /home/linus/build> mkdir gdb
32</pre>
33<h2>Create the newlib and libgloss links</h2>
34<p>
35The GCC configuration script finds the newlib and libgloss files if they are in the GCC tree. Let's create two soft links.
36<pre>
37 /home/linus> cd gcc-3.0.3
38 /home/linus/gcc-3.0.3> ln -s ../newlib-1.10.0/newlib .
39 /home/linus/gcc-3.0.3> ln -s ../newlib-1.10.0/libgloss .
40</pre>
41<h2>Make up your mind</h2>
42<p>
43Now is the time to decide where you want the tools to be installed. This is
44the directory where all binaries, libraries, man pages and stuff end up when
45you do "make install".
46<p>
47In this example I have chosen "/home/linus/sh1" as my installation directory, or <i>prefix</i> as it is called. Feel free to use any prefix, like
48/usr/local/sh1 for example.
49<h2>Build binutils</h2>
50<p>
51We will start with building the binutils (the assembler, linker and stuff).
52This is pretty straightforward. We will be installing the whole tool chain
53in the /home/linus/sh1 directory.
54<pre>
55 /home/linus> cd build/binutils
56 /home/linus/build/binutils> ../../binutils-2.11/configure --target=sh-elf --prefix=/home/linus/sh1
57 /home/linus/build/binutils> make
58 /home/linus/build/binutils> make install
59</pre>
60<h2>Build GCC</h2>
61<p>
62Now you are ready to build GCC. To do this, you must have the newly built
63binutils in the PATH.
64<pre>
65 /home/linus> export PATH=/home/linus/sh1/bin:$PATH
66 /home/linus> cd build/gcc
67 /home/linus/gcc> ../../gcc-3.0.3/configure --target=sh-elf --prefix=/home/linus/sh1 --with-newlib --enable-languages=c
68 /home/linus/build/binutils> make
69 /home/linus/build/binutils> make install
70</pre>
71<h2>Build GDB</h2>
72<p>
73If you are planning to debug your code with GDB, you have to build it as well.
74<pre>
75 /home/linus> export PATH=/home/linus/sh1/bin:$PATH
76 /home/linus> cd build/gdb
77 /home/linus/gdb> ../../gdb-5.1.1/configure --target=sh-elf --prefix=/home/linus/sh1
78 /home/linus/build/binutils> make
79 /home/linus/build/binutils> make install
80</pre>
81<h2>Done</h2>
82<p>
83If someone up there likes you, you now have a working tool chain for SH1.
84To compile a file with gcc:
85<pre>
86 /home/linus> sh-elf-gcc -c main.o main.c
87</pre>
88Good luck!
89<p>
90<i>Linus</i>
91
92#include "foot.t"