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 | |
---|
11 | This chapter describes the steps required to acquire the |
---|
12 | source code for a GNU cross compiler toolset, apply |
---|
13 | any required RTEMS specific patches, compile that |
---|
14 | toolset and install it. |
---|
15 | |
---|
16 | @section Create the Archive and Build Directories |
---|
17 | |
---|
18 | Start by making the @code{archive} directory to contain the downloaded |
---|
19 | source code and the @code{tools} directory to be used as a build |
---|
20 | directory. The command sequence to do this is shown |
---|
21 | below: |
---|
22 | |
---|
23 | @example |
---|
24 | mkdir arc |
---|
25 | mkdir tools |
---|
26 | @end example |
---|
27 | |
---|
28 | This will result in an initial directory structure similar to the |
---|
29 | one 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 | |
---|
71 | This section lists the components of an RTEMS cross development system. |
---|
72 | Included are the locations of each component as well as any required RTEMS |
---|
73 | specific 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 | |
---|
131 | While in the @code{tools} directory, unpack the compressed |
---|
132 | tar files using the following command sequence: |
---|
133 | |
---|
134 | @example |
---|
135 | cd tools |
---|
136 | tar xzf ../arc/@value{GCC-TAR} |
---|
137 | tar xzf ../arc/@value{BINUTILS-TAR} |
---|
138 | tar xzf ../arc/@value{NEWLIB-TAR} |
---|
139 | @end example |
---|
140 | |
---|
141 | After the compressed tar files have been unpacked, the following |
---|
142 | directories 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 | |
---|
150 | The @code{bit} script will automatically create two other |
---|
151 | subdirectories: |
---|
152 | |
---|
153 | @itemize @bullet |
---|
154 | @item src |
---|
155 | @item build-$@{CPU@}-tools |
---|
156 | @end itemize |
---|
157 | |
---|
158 | Ignoring 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 | | | | | | |
---|
168 | src 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 | | | | | | |
---|
183 | src 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 Reading the Documentation |
---|
198 | @c |
---|
199 | |
---|
200 | @section Reading the Tools Documentation |
---|
201 | |
---|
202 | Each of the tools in the GNU development suite comes with documentation. |
---|
203 | It is in the reader's and tool maintainers' interest that one read the |
---|
204 | documentation before posting a problem to a mailing list or news group. |
---|
205 | |
---|
206 | @c |
---|
207 | @c EGCS patches |
---|
208 | @c |
---|
209 | |
---|
210 | @section Apply RTEMS Patch to EGCS |
---|
211 | |
---|
212 | @ifclear GCC-RTEMSPATCH |
---|
213 | No RTEMS specific patches are required for @value{GCC-VERSION} to |
---|
214 | support @value{RTEMS-VERSION}. |
---|
215 | @end ifclear |
---|
216 | |
---|
217 | @ifset GCC-RTEMSPATCH |
---|
218 | |
---|
219 | Apply the patch using the following command sequence: |
---|
220 | |
---|
221 | @example |
---|
222 | cd tools/@value{GCC-UNTAR} |
---|
223 | zcat arc/@value{GCC-RTEMSPATCH} | patch -p1 |
---|
224 | @end example |
---|
225 | |
---|
226 | Check to see if any of these patches have been rejected using the following |
---|
227 | sequence: |
---|
228 | |
---|
229 | @example |
---|
230 | cd tools/@value{GCC-UNTAR} |
---|
231 | find . -name "*.rej" -print |
---|
232 | @end example |
---|
233 | |
---|
234 | If any files are found with the .rej extension, a patch has been rejected. |
---|
235 | This should not happen with a good patch file. |
---|
236 | |
---|
237 | @end ifset |
---|
238 | |
---|
239 | @c |
---|
240 | @c BINUTILS patches |
---|
241 | @c |
---|
242 | |
---|
243 | @section Apply RTEMS Patch to binutils |
---|
244 | |
---|
245 | @ifclear BINUTILS-RTEMSPATCH |
---|
246 | No RTEMS specific patches are required for @value{BINUTILS-VERSION} to |
---|
247 | support @value{RTEMS-VERSION}. |
---|
248 | @end ifclear |
---|
249 | |
---|
250 | @ifset BINUTILS-RTEMSPATCH |
---|
251 | Apply the patch using the following command sequence: |
---|
252 | |
---|
253 | @example |
---|
254 | cd tools/@value{BINUTILS-UNTAR} |
---|
255 | zcat arc/@value{BINUTILS-RTEMSPATCH} | patch -p1 |
---|
256 | @end example |
---|
257 | |
---|
258 | Check to see if any of these patches have been rejected using the following |
---|
259 | sequence: |
---|
260 | |
---|
261 | @example |
---|
262 | cd tools/@value{BINUTILS-UNTAR} |
---|
263 | find . -name "*.rej" -print |
---|
264 | @end example |
---|
265 | |
---|
266 | If any files are found with the .rej extension, a patch has been rejected. |
---|
267 | This should not happen with a good patch file. |
---|
268 | |
---|
269 | @end ifset |
---|
270 | |
---|
271 | @c |
---|
272 | @c Newlib patches |
---|
273 | @c |
---|
274 | |
---|
275 | @section Apply RTEMS Patch to newlib |
---|
276 | |
---|
277 | @ifclear NEWLIB-RTEMSPATCH |
---|
278 | No RTEMS specific patches are required for @value{NEWLIB-VERSION} to |
---|
279 | support @value{RTEMS-VERSION}. |
---|
280 | @end ifclear |
---|
281 | |
---|
282 | @ifset NEWLIB-RTEMSPATCH |
---|
283 | |
---|
284 | Apply the patch using the following command sequence: |
---|
285 | |
---|
286 | @example |
---|
287 | cd tools/@value{NEWLIB-UNTAR} |
---|
288 | zcat arc/@value{NEWLIB-RTEMSPATCH} | patch -p1 |
---|
289 | @end example |
---|
290 | |
---|
291 | Check to see if any of these patches have been rejected using the following |
---|
292 | sequence: |
---|
293 | |
---|
294 | @example |
---|
295 | cd tools/@value{NEWLIB-UNTAR} |
---|
296 | find . -name "*.rej" -print |
---|
297 | @end example |
---|
298 | |
---|
299 | If any files are found with the .rej extension, a patch has been rejected. |
---|
300 | This should not happen with a good patch file. |
---|
301 | |
---|
302 | @end ifset |
---|
303 | |
---|
304 | @c |
---|
305 | @c Modify the bit script |
---|
306 | @c |
---|
307 | |
---|
308 | @section Modify the bit Script |
---|
309 | |
---|
310 | Copy the @code{bit} script from arc to the tools directory. |
---|
311 | |
---|
312 | Edit the @code{bit} file to alter the following environmental variables: |
---|
313 | |
---|
314 | @itemize @bullet |
---|
315 | @item INSTALL_POINT |
---|
316 | @item BINUTILS |
---|
317 | @item NEWLIB |
---|
318 | @item GCC |
---|
319 | @item BUILD_DOCS |
---|
320 | @item BUILD_OTHER_LANGUAGES |
---|
321 | @end itemize |
---|
322 | |
---|
323 | These variables are located in the script section that resembles the |
---|
324 | extract below: |
---|
325 | |
---|
326 | |
---|
327 | @example |
---|
328 | # USERCHANGE -- localize these. |
---|
329 | # |
---|
330 | # INSTALL_POINT: Directory tools are installed into. |
---|
331 | # Recommended installation point for various OS's: |
---|
332 | # Linux: /usr/local/rtems |
---|
333 | # Solaris: /opt/gnu/rtems |
---|
334 | # BINUTILS: Binutils source directory |
---|
335 | # NEWLIB: Newlib source directory |
---|
336 | # GCC: Newlib source directory |
---|
337 | # BUILD_DOCS: Set to "yes" if you want to install documentation. |
---|
338 | # BUILD_OTHER_LANGUAGES: |
---|
339 | # Set to "yes" if you want to build Fortran and Objective-C |
---|
340 | # |
---|
341 | BINUTILS=@value{BINUTILS-UNTAR} |
---|
342 | GCC=@value{GCC-UNTAR} |
---|
343 | NEWLIB=@value{NEWLIB-UNTAR} |
---|
344 | BUILD_DOCS=yes |
---|
345 | BUILD_OTHER_LANGUAGES=yes |
---|
346 | INSTALL_POINT=/home/joel/$@{GCC@}/$@{target@} |
---|
347 | |
---|
348 | # USERCHANGE - uncomment this if you want to watch the commands. |
---|
349 | @end example |
---|
350 | |
---|
351 | Where each of the variables which may be modified is described below: |
---|
352 | |
---|
353 | @table @code |
---|
354 | @item INSTALL_POINT |
---|
355 | is the location where you wish the GNU C/C++ cross compilation tools for |
---|
356 | RTEMS to be built. It is recommended that the directory chosen to receive |
---|
357 | these tools be named so that it is clear from which egcs distribution it |
---|
358 | was generated and for which target system the tools are to produce code for. |
---|
359 | |
---|
360 | @item BINUTILS |
---|
361 | is the directory under tools that contains @value{BINUTILS-UNTAR}. |
---|
362 | For example: |
---|
363 | |
---|
364 | @example |
---|
365 | BINUTILS=@value{BINUTILS-UNTAR} |
---|
366 | @end example |
---|
367 | |
---|
368 | @item GCC |
---|
369 | is the directory under tools that contains @value{GCC-UNTAR}. |
---|
370 | For example, |
---|
371 | |
---|
372 | @example |
---|
373 | GCC=@value{GCC-UNTAR} |
---|
374 | @end example |
---|
375 | |
---|
376 | @item NEWLIB |
---|
377 | is the directory under tools that contains @value{NEWLIB-UNTAR}. |
---|
378 | For example: |
---|
379 | |
---|
380 | @example |
---|
381 | NEWLIB=@value{NEWLIB-UNTAR} |
---|
382 | @end example |
---|
383 | |
---|
384 | @item BUILD_DOCS |
---|
385 | is set to "yes" if you want to install documentation. |
---|
386 | For example: |
---|
387 | |
---|
388 | @example |
---|
389 | BUILD_DOCS=yes |
---|
390 | @end example |
---|
391 | |
---|
392 | @item BUILD_OTHER_LANGUAGES |
---|
393 | is set to "yes" if you want to build languages other than C and C++. At |
---|
394 | the current time, this enables Fortan and Objective-C. |
---|
395 | For example: |
---|
396 | |
---|
397 | @example |
---|
398 | BUILD_OTHER_LANGUAGES=yes |
---|
399 | @end example |
---|
400 | |
---|
401 | @end table |
---|
402 | |
---|
403 | @section Running the bit Script |
---|
404 | |
---|
405 | After the @code{bit} script has been modified to reflect the |
---|
406 | local installation, the modified @code{bit} script is run |
---|
407 | using the following sequence: |
---|
408 | |
---|
409 | @example |
---|
410 | cd tools |
---|
411 | ./bit <target configuration> |
---|
412 | @end example |
---|
413 | |
---|
414 | Where <target configuration> is one of the following: |
---|
415 | |
---|
416 | @itemize @bullet |
---|
417 | @item hppa1.1 |
---|
418 | @item i386 |
---|
419 | @item i386-elf |
---|
420 | @item i386-go32 |
---|
421 | @item i960 |
---|
422 | @item m68k |
---|
423 | @item mips64orion |
---|
424 | @item powerpc |
---|
425 | @item sh |
---|
426 | @item sparc |
---|
427 | @end itemize |
---|
428 | |
---|
429 | If no errors are encountered, the @code{bit} script will conclude by |
---|
430 | printing messages similar to the following: |
---|
431 | |
---|
432 | @example |
---|
433 | |
---|
434 | The src and build-i386-tools subdirectory may now be removed. |
---|
435 | |
---|
436 | Started: Fri Apr 10 10:14:07 CDT 1998 |
---|
437 | Finished: Fri Apr 10 12:01:33 CDT 1998 |
---|
438 | @end example |
---|
439 | |
---|
440 | If the @code{bit} script successfully completes, then the |
---|
441 | GNU C/C++ cross compilation tools are installed. |
---|
442 | |
---|
443 | If the @code{bit} script does not successfully complete, then investigation |
---|
444 | will be required to determine the source of the error. |
---|
445 | |
---|