source: rtems/doc/started/buildc.t @ fffe9266

4.104.114.84.95
Last change on this file since fffe9266 was fffe9266, checked in by Joel Sherrill <joel.sherrill@…>, on 04/14/98 at 13:48:33

Suggestions from Eric Norum

  • Property mode set to 100644
File size: 9.9 KB
Line 
1@c
2@c  COPYRIGHT (c) 1988-1998.
3@c  On-Line Applications Research Corporation (OAR).
4@c  All rights reserved.
5@c
6@c  $Id$
7@c
8
9@chapter Building the GNU C/C++ Cross Compiler Toolset
10
11This chapter describes the steps required to acquire the
12source code for a GNU cross compiler toolset, apply
13any required RTEMS specific patches, compile that
14toolset and install it.
15
16@section Create the Archive and Build Directories
17
18Start by making the @code{archive} directory to contain the downloaded
19source code and the @code{tools} directory to be used as a build
20directory.  The command sequence to do this is shown
21below:
22
23@example
24mkdir arc
25mkdir tools
26@end example
27
28This will result in an initial directory structure similar to the
29one shown in the following figure:
30
31@ifset use-ascii
32@example
33@group
34                parent directory common to the
35               tools and archive subdirectories
36                             |
37      +----------------------+----------------------+
38      |                                             | 
39   tools                                           arc
40@end group
41@end example
42@end ifset
43
44
45@ifset use-tex
46@c for now use the ascii version
47@example
48@group
49                parent directory common to the
50               tools and archive subdirectories
51                             |
52      +----------------------+----------------------+
53      |                                             |
54   tools                                           arc
55@end group
56@end example
57@tex
58@end tex
59@end ifset
60
61
62@ifset use-html
63@html
64<IMG SRC="sfile12c.jpg" WIDTH=417 HEIGHT=178
65    ALT="Starting Directory Organization">
66@end html
67@end ifset
68
69@section Get all the Pieces
70
71This section lists the components of an RTEMS cross development system. 
72Included are the locations of each component as well as any required RTEMS
73specific patches.
74
75@subheading @value{GCC-VERSION}
76@example
77    FTP Site:    @value{GCC-FTPSITE}
78    Directory:   @value{GCC-FTPDIR}
79    File:        @value{GCC-TAR}
80@end example
81
82@subheading @value{BINUTILS-VERSION}
83@example
84    FTP Site:    @value{BINUTILS-FTPSITE}
85    Directory:   @value{BINUTILS-FTPDIR}
86    File:        @value{BINUTILS-TAR}
87@end example
88
89@subheading @value{NEWLIB-VERSION}
90@example
91    FTP Site:    @value{NEWLIB-FTPSITE}
92    Directory:   @value{NEWLIB-FTPDIR}
93    File:        @value{NEWLIB-TAR}
94@end example
95
96@subheading @value{RTEMS-VERSION}
97@example
98    FTP Site:    @value{RTEMS-FTPSITE}
99    Directory:   @value{RTEMS-FTPDIR}
100    File:        @value{RTEMS-TAR}
101    File:        hello_world_c.tgz
102    File:        bit
103@end example
104
105@subheading RTEMS Specific Tool Patches
106@example
107    FTP Site:    @value{RTEMS-FTPSITE}
108    Directory:   @value{RTEMS-FTPDIR}/c_tools
109@ifset BINUTILS-RTEMSPATCH
110    File:        @value{BINUTILS-RTEMSPATCH}
111@end ifset
112@ifset NEWLIB-RTEMSPATCH
113    File:        @value{NEWLIB-RTEMSPATCH}
114@end ifset
115@ifset GCC-RTEMSPATCH
116    File:        @value{GCC-RTEMSPATCH}
117@end ifset
118@c Just in case there are ever no patches
119@ifset BINUTILS-RTEMSPATCH
120@ifset GCC-RTEMSPATCH
121@ifset NEWLIB-RTEMSPATCH
122    No RTEMS specific patches are required.
123@end ifset
124@end ifset
125@end ifset
126
127@end example
128
129@section Unarchiving the Tools
130
131While in the @code{tools} directory, unpack the compressed
132tar files using the following command sequence:
133
134@example
135cd tools
136tar xzf ../arc/@value{GCC-TAR}
137tar xzf ../arc/@value{BINUTILS-TAR}
138tar xzf ../arc/@value{NEWLIB-TAR}
139@end example
140
141After the compressed tar files have been unpacked, the following
142directories will have been created under tools.
143
144@itemize @bullet
145@item @value{BINUTILS-UNTAR}
146@item @value{GCC-UNTAR}
147@item @value{NEWLIB-UNTAR}
148@end itemize
149
150The @code{bit} script will automatically create two other
151subdirectories:
152
153@itemize @bullet
154@item src
155@item build-$@{CPU@}-tools
156@end itemize
157
158Ignoring version numbers, this will look something like the following figure:
159
160@ifset use-ascii
161@example
162@group
163                       tools
164                         |    bit (script)
165                         +
166 +---------+-------------+------------+----------------+
167 |         |             |            |                |
168src   binutils-2.9   egcs-1.0.2  newlib-1.8.0  build-$@{CPU@}-tools
169@end group
170@end example
171@end ifset
172
173
174@ifset use-tex
175@c for now use the ascii version
176@example
177@group
178                       tools
179                         |    bit (script)
180                         +
181 +---------+-------------+------------+----------------+
182 |         |             |            |                |
183src   binutils-2.9   egcs-1.0.2  newlib-1.8.0  build-${CPU}-tools
184@end group
185@end example
186@tex
187@end tex
188@end ifset
189
190@ifset use-html
191@html
192<IMG SRC="bit_c.jpg" WIDTH=816 HEIGHT=267 ALT="Directory Organization">
193@end html
194@end ifset
195
196@c
197@c  EGCS patches
198@c
199
200@section Apply RTEMS Patch to EGCS
201
202@ifclear GCC-RTEMSPATCH
203No RTEMS specific patches are required for @value{GCC-VERSION} to
204support @value{RTEMS-VERSION}.
205@end ifclear
206
207@ifset GCC-RTEMSPATCH
208
209Apply the patch using the following command sequence:
210
211@example
212cd tools/@value{GCC-UNTAR}
213zcat arc/@value{GCC-RTEMSPATCH} | patch -p1
214@end example
215
216Check to see if any of these patches have been rejected using the following
217sequence:
218
219@example
220cd tools/@value{GCC-UNTAR}
221find . -name "*.rej" -print
222@end example
223
224If any files are found with the .rej extension, a patch has been rejected.
225This should not happen with a good patch file.
226
227@end ifset
228
229@c
230@c  BINUTILS patches
231@c
232
233@section Apply RTEMS Patch to binutils
234
235@ifclear BINUTILS-RTEMSPATCH
236No RTEMS specific patches are required for @value{BINUTILS-VERSION} to
237support @value{RTEMS-VERSION}.
238@end ifclear
239
240@ifset BINUTILS-RTEMSPATCH
241Apply the patch using the following command sequence:
242
243@example
244cd tools/@value{BINUTILS-UNTAR}
245zcat arc/@value{BINUTILS-RTEMSPATCH} | patch -p1
246@end example
247
248Check to see if any of these patches have been rejected using the following
249sequence:
250
251@example
252cd tools/@value{BINUTILS-UNTAR}
253find . -name "*.rej" -print
254@end example
255
256If any files are found with the .rej extension, a patch has been rejected.
257This should not happen with a good patch file.
258
259@end ifset
260
261@c
262@c  Newlib patches
263@c
264
265@section Apply RTEMS Patch to newlib
266
267@ifclear NEWLIB-RTEMSPATCH
268No RTEMS specific patches are required for @value{NEWLIB-VERSION} to
269support @value{RTEMS-VERSION}.
270@end ifclear
271
272@ifset NEWLIB-RTEMSPATCH
273
274Apply the patch using the following command sequence:
275
276@example
277cd tools/@value{NEWLIB-UNTAR}
278zcat arc/@value{NEWLIB-RTEMSPATCH} | patch -p1
279@end example
280
281Check to see if any of these patches have been rejected using the following
282sequence:
283
284@example
285cd tools/@value{NEWLIB-UNTAR}
286find . -name "*.rej" -print
287@end example
288
289If any files are found with the .rej extension, a patch has been rejected.
290This should not happen with a good patch file.
291
292@end ifset
293
294@c
295@c  Modify the bit script
296@c
297
298@section Modify the bit Script
299
300Copy the @code{bit} script from arc to the tools directory.
301
302Edit the @code{bit} file to alter the following environmental variables:
303
304@itemize @bullet
305@item INSTALL_POINT
306@item BINUTILS
307@item NEWLIB
308@item GCC
309@item BUILD_DOCS
310@item BUILD_OTHER_LANGUAGES
311@end itemize
312
313These variables are located in the script section that resembles the
314extract below:
315
316
317@example
318# USERCHANGE -- localize these.
319#
320#  INSTALL_POINT: Directory tools are installed into.
321#      Recommended installation point for various OS's:
322#         Linux:    /usr/local/rtems
323#         Solaris:  /opt/gnu/rtems
324#   BINUTILS:     Binutils source directory
325#   NEWLIB:       Newlib source directory
326#   GCC:          Newlib source directory
327#   BUILD_DOCS:   Set to "yes" if you want to install documentation.
328#   BUILD_OTHER_LANGUAGES:
329#                 Set to "yes" if you want to build Fortran and Objective-C
330#
331BINUTILS=@value{BINUTILS-UNTAR}
332GCC=@value{GCC-UNTAR}
333NEWLIB=@value{NEWLIB-UNTAR}
334BUILD_DOCS=yes
335BUILD_OTHER_LANGUAGES=yes
336INSTALL_POINT=/home/joel/$@{GCC@}/$@{target@}
337
338# USERCHANGE - uncomment this if you want to watch the commands.
339@end example
340
341Where each of the variables which may be modified is described below:
342
343@table @code
344@item INSTALL_POINT
345is the location where you wish the GNU C/C++ cross compilation tools for
346RTEMS to be built. It is recommended that the directory chosen to receive
347these tools be named so that it is clear from which egcs distribution it
348was generated and for which target system the tools are to produce code for.
349
350@item BINUTILS
351is the directory under tools that contains @value{BINUTILS-UNTAR}.
352For example:
353
354@example
355BINUTILS=@value{BINUTILS-UNTAR}
356@end example
357
358@item GCC
359is the directory under tools that contains @value{GCC-UNTAR}.
360For example,
361
362@example
363GCC=@value{GCC-UNTAR}
364@end example
365
366@item NEWLIB
367is the directory under tools that contains @value{NEWLIB-UNTAR}.
368For example:
369
370@example
371NEWLIB=@value{NEWLIB-UNTAR}
372@end example
373
374@item BUILD_DOCS
375is set to "yes" if you want to install documentation.
376For example:
377
378@example
379BUILD_DOCS=yes
380@end example
381
382@item BUILD_OTHER_LANGUAGES
383is set to "yes" if you want to build languages other than C and C++.  At
384the current time, this enables Fortan and Objective-C.
385For example:
386
387@example
388BUILD_OTHER_LANGUAGES=yes
389@end example
390
391@end table
392
393@section Running the bit Script
394
395After the @code{bit} script has been modified to reflect the
396local installation, the modified @code{bit} script is run
397using the following sequence:
398
399@example
400cd tools
401./bit <target configuration>
402@end example
403
404Where <target configuration> is one of the following:
405
406@itemize @bullet
407@item hppa1.1
408@item i386
409@item i386-elf
410@item i386-go32
411@item i960
412@item m68k
413@item mips64orion
414@item powerpc
415@item sh
416@item sparc
417@end itemize
418
419If no errors are encountered, the @code{bit} script will conclude by
420printing messages similar to the following:
421
422@example
423
424The src and build-i386-tools subdirectory may now be removed.
425
426Started:  Fri Apr 10 10:14:07 CDT 1998
427Finished: Fri Apr 10 12:01:33 CDT 1998
428@end example
429
430If the @code{bit} script successfully completes, then the
431GNU C/C++ cross compilation tools are installed.
432
433If the @code{bit} script does not successfully complete, then investigation
434will be required to determine the source of the error.
435
Note: See TracBrowser for help on using the repository browser.