source: rtems/doc/started/buildc.t @ 6e3c36b7

4.104.114.84.95
Last change on this file since 6e3c36b7 was 6e3c36b7, checked in by Joel Sherrill <joel.sherrill@…>, on 04/13/98 at 20:03:57

added ASCII versions of directory tree figures

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