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 Get all the pieces |
---|
17 | |
---|
18 | The tree structure in the figure below is assumed to be present in the |
---|
19 | following discussions: |
---|
20 | |
---|
21 | @center @b{XXX directory tree figure goes here} |
---|
22 | |
---|
23 | Gather the components that will be required for the installation and place |
---|
24 | them in an archive directory. Call this directory arc. Be sure that there |
---|
25 | is sufficient space to hold all necessary information. This will amount to |
---|
26 | approximately 20 megabytes. |
---|
27 | |
---|
28 | @subheading @value{GCC-VERSION} |
---|
29 | @example |
---|
30 | FTP Site: @value{GCC-FTPSITE} |
---|
31 | Directory: @value{GCC-FTPDIR} |
---|
32 | File: @value{GCC-TAR} |
---|
33 | @end example |
---|
34 | |
---|
35 | @subheading @value{BINUTILS-VERSION} |
---|
36 | @example |
---|
37 | FTP Site: @value{BINUTILS-FTPSITE} |
---|
38 | Directory: @value{BINUTILS-FTPDIR} |
---|
39 | File: @value{BINUTILS-TAR} |
---|
40 | @end example |
---|
41 | |
---|
42 | @subheading @value{NEWLIB-VERSION} |
---|
43 | @example |
---|
44 | FTP Site: @value{NEWLIB-FTPSITE} |
---|
45 | Directory: @value{NEWLIB-FTPDIR} |
---|
46 | File: @value{NEWLIB-TAR} |
---|
47 | @end example |
---|
48 | |
---|
49 | @subheading @value{RTEMS-VERSION} |
---|
50 | @example |
---|
51 | FTP Site: @value{RTEMS-FTPSITE} |
---|
52 | Directory: @value{RTEMS-FTPDIR} |
---|
53 | File: @value{RTEMS-TAR} |
---|
54 | File: bit |
---|
55 | File: @value{BINUTILS-RTEMSPATCH} |
---|
56 | File: @value{NEWLIB-RTEMSPATCH} |
---|
57 | File: @value{GCC-RTEMSPATCH} |
---|
58 | File: hello_world_c.tgz |
---|
59 | @end example |
---|
60 | |
---|
61 | |
---|
62 | @section Create the tools directory |
---|
63 | |
---|
64 | Create a directory called tools that will serve as a working directory to |
---|
65 | perform the build of the cross compiler tools. |
---|
66 | |
---|
67 | Unpack the compressed tar files using the following command sequence: |
---|
68 | |
---|
69 | @example |
---|
70 | cd tools |
---|
71 | tar xzf ../arc/@value{GCC-TAR} |
---|
72 | tar xzf ../arc/@value{BINUTILS-TAR} |
---|
73 | tar xzf ../arc/@value{NEWLIB-TAR} |
---|
74 | @end example |
---|
75 | |
---|
76 | After the compressed tar files have been unpacked, the following |
---|
77 | directories will have been created under tools. |
---|
78 | |
---|
79 | @itemize @bullet |
---|
80 | @item @value{BINUTILS-UNTAR} |
---|
81 | @item @value{GCC-UNTAR} |
---|
82 | @item @value{NEWLIB-UNTAR} |
---|
83 | @end itemize |
---|
84 | |
---|
85 | @c |
---|
86 | @c EGCS patches |
---|
87 | @c |
---|
88 | |
---|
89 | @section Apply RTEMS Patch to EGCS |
---|
90 | |
---|
91 | @ifclear GCC-RTEMSPATCH |
---|
92 | No RTEMS specific patches are required for @value{GCC-VERSION} to |
---|
93 | support @value{RTEMS-VERSION}. |
---|
94 | @end ifclear |
---|
95 | |
---|
96 | @ifset GCC-RTEMSPATCH |
---|
97 | |
---|
98 | Apply the patch using the following command sequence: |
---|
99 | |
---|
100 | @example |
---|
101 | cd tools/@value{GCC-UNTAR} |
---|
102 | zcat arc/@value{GCC-RTEMSPATCH} | patch -p1 |
---|
103 | @end example |
---|
104 | |
---|
105 | Check to see if any of these patches have been rejected using the following |
---|
106 | sequence: |
---|
107 | |
---|
108 | @example |
---|
109 | cd tools/@value{GCC-UNTAR} |
---|
110 | find . -name "*.rej" -print |
---|
111 | @end example |
---|
112 | |
---|
113 | If any files are found with the .rej extension, a patch has been rejected. |
---|
114 | This should not happen with a good patch file. |
---|
115 | |
---|
116 | To see the files that have been modified use the sequence: |
---|
117 | |
---|
118 | @example |
---|
119 | cd tools/@value{GCC-UNTAR} |
---|
120 | find . -name "*.orig" -print |
---|
121 | @end example |
---|
122 | |
---|
123 | The files that are found, have been modified by the patch file. |
---|
124 | |
---|
125 | @end ifset |
---|
126 | |
---|
127 | @c |
---|
128 | @c BINUTILS patches |
---|
129 | @c |
---|
130 | |
---|
131 | @section Apply RTEMS Patch to binutils |
---|
132 | |
---|
133 | @ifclear BINUTILS-RTEMSPATCH |
---|
134 | No RTEMS specific patches are required for @value{BINUTILS-VERSION} to |
---|
135 | support @value{RTEMS-VERSION}. |
---|
136 | @end ifclear |
---|
137 | |
---|
138 | @ifset BINUTILS-RTEMSPATCH |
---|
139 | Apply the patch using the following command sequence: |
---|
140 | |
---|
141 | @example |
---|
142 | cd tools/@value{BINUTILS-UNTAR} |
---|
143 | zcat arc/@value{BINUTILS-RTEMSPATCH} | patch -p1 |
---|
144 | @end example |
---|
145 | |
---|
146 | Check to see if any of these patches have been rejected using the following |
---|
147 | sequence: |
---|
148 | |
---|
149 | @example |
---|
150 | cd tools/@value{BINUTILS-UNTAR} |
---|
151 | find . -name "*.rej" -print |
---|
152 | @end example |
---|
153 | |
---|
154 | If any files are found with the .rej extension, a patch has been rejected. |
---|
155 | This should not happen with a good patch file. |
---|
156 | |
---|
157 | To see the files that have been modified use the sequence: |
---|
158 | |
---|
159 | @example |
---|
160 | cd tools/@value{BINUTILS-UNTAR} |
---|
161 | find . -name "*.orig" -print |
---|
162 | @end example |
---|
163 | |
---|
164 | The files that are found, have been modified by the patch file. |
---|
165 | |
---|
166 | @end ifset |
---|
167 | |
---|
168 | @c |
---|
169 | @c Newlib patches |
---|
170 | @c |
---|
171 | |
---|
172 | @section Apply RTEMS Patch to newlib |
---|
173 | |
---|
174 | @ifclear NEWLIB-RTEMSPATCH |
---|
175 | No RTEMS specific patches are required for @value{NEWLIB-VERSION} to |
---|
176 | support @value{RTEMS-VERSION}. |
---|
177 | @end ifclear |
---|
178 | |
---|
179 | @ifset NEWLIB-RTEMSPATCH |
---|
180 | |
---|
181 | Apply the patch using the following command sequence: |
---|
182 | |
---|
183 | @example |
---|
184 | cd tools/@value{NEWLIB-UNTAR} |
---|
185 | zcat arc/@value{NEWLIB-RTEMSPATCH} | patch -p1 |
---|
186 | @end example |
---|
187 | |
---|
188 | Check to see if any of these patches have been rejected using the following |
---|
189 | sequence: |
---|
190 | |
---|
191 | @example |
---|
192 | cd tools/@value{NEWLIB-UNTAR} |
---|
193 | find . -name "*.rej" -print |
---|
194 | @end example |
---|
195 | |
---|
196 | If any files are found with the .rej extension, a patch has been rejected. |
---|
197 | This should not happen with a good patch file. |
---|
198 | |
---|
199 | To see the files that have been modified use the sequence: |
---|
200 | |
---|
201 | @example |
---|
202 | cd tools/@value{NEWLIB-UNTAR} |
---|
203 | find . -name "*.orig" -print |
---|
204 | @end example |
---|
205 | |
---|
206 | The files that are found, have been modified by the patch file. |
---|
207 | |
---|
208 | @end ifset |
---|
209 | |
---|
210 | @c |
---|
211 | @c Modify the bit script |
---|
212 | @c |
---|
213 | |
---|
214 | @section Modify the bit script |
---|
215 | |
---|
216 | Copy the @code{bit} script from arc to the tools directory. |
---|
217 | |
---|
218 | Edit the @code{bit} file to alter the following environmental variables: |
---|
219 | |
---|
220 | @itemize @bullet |
---|
221 | @item INSTALL_POINT |
---|
222 | @item BINUTILS |
---|
223 | @item NEWLIB |
---|
224 | @item GCC |
---|
225 | @item BUILD_DOCS |
---|
226 | @item BUILD_OTHER_LANGUAGES |
---|
227 | @end itemize |
---|
228 | |
---|
229 | These variables are located in the script section that resembles the |
---|
230 | extract below: |
---|
231 | |
---|
232 | |
---|
233 | @example |
---|
234 | # USERCHANGE -- localize these. |
---|
235 | # |
---|
236 | # INSTALL_POINT: Directory tools are installed into. |
---|
237 | # Recommended installation point for various OS's: |
---|
238 | # Linux: /usr/local/rtems |
---|
239 | # Solaris: /opt/gnu/rtems |
---|
240 | # BINUTILS: Binutils source directory |
---|
241 | # NEWLIB: Newlib source directory |
---|
242 | # GCC: Newlib source directory |
---|
243 | # BUILD_DOCS: Set to "yes" if you want to install documentation. |
---|
244 | # BUILD_OTHER_LANGUAGES: |
---|
245 | # Set to "yes" if you want to build Fortran and Objective-C |
---|
246 | # |
---|
247 | BINUTILS=@value{BINUTILS-UNTAR} |
---|
248 | GCC=@value{GCC-UNTAR} |
---|
249 | NEWLIB=@value{NEWLIB-UNTAR} |
---|
250 | BUILD_DOCS=yes |
---|
251 | BUILD_OTHER_LANGUAGES=yes |
---|
252 | INSTALL_POINT=/home/joel/$@{GCC@}/$@{target@} |
---|
253 | |
---|
254 | # USERCHANGE - uncomment this if you want to watch the commands. |
---|
255 | @end example |
---|
256 | |
---|
257 | Where each of the variables which may be modified is described below: |
---|
258 | |
---|
259 | @table @code |
---|
260 | @item INSTALL_POINT |
---|
261 | is the location where you wish the GNU C/C++ cross compilation tools for |
---|
262 | RTEMS to be built. It is recommended that the directory chosen to receive |
---|
263 | these tools be named so that it is clear from which egcs distribution it |
---|
264 | was generated and for which target system the tools are to produce code for. |
---|
265 | |
---|
266 | @item BINUTILS |
---|
267 | is the directory under tools that contains @value{BINUTILS-UNTAR}. |
---|
268 | For example, |
---|
269 | |
---|
270 | @example |
---|
271 | BINUTILS=@value{BINUTILS-UNTAR}. |
---|
272 | @end example |
---|
273 | |
---|
274 | @item GCC |
---|
275 | is the directory under tools that contains @value{GCC-UNTAR}. |
---|
276 | For example, |
---|
277 | |
---|
278 | @example |
---|
279 | GCC=@value{GCC-UNTAR}. |
---|
280 | @end example |
---|
281 | |
---|
282 | @item NEWLIB |
---|
283 | is the directory under tools that contains @value{NEWLIB-UNTAR}. |
---|
284 | For example, |
---|
285 | |
---|
286 | @example |
---|
287 | NEWLIB=@value{NEWLIB-UNTAR}. |
---|
288 | @end example |
---|
289 | |
---|
290 | @item BUILD_DOCS |
---|
291 | is set to "yes" if you want to install documentation. |
---|
292 | For example, |
---|
293 | |
---|
294 | @example |
---|
295 | BUILD_DOCS=yes |
---|
296 | @end example |
---|
297 | |
---|
298 | @item BUILD_OTHER_LANGUAGES |
---|
299 | is set to "yes" if you want to build languages other than C and C++. At |
---|
300 | the current time, this enables Fortan and Objective-C. |
---|
301 | For example, |
---|
302 | |
---|
303 | @example |
---|
304 | BUILD_OTHER_LANGUAGES=yes |
---|
305 | @end example |
---|
306 | |
---|
307 | @end table |
---|
308 | |
---|
309 | @section Running the bit script |
---|
310 | |
---|
311 | After the @code{bit} script has been modified to reflect the |
---|
312 | local installation, the modified @code{bit} script is run |
---|
313 | using the following sequence: |
---|
314 | |
---|
315 | @example |
---|
316 | cd tools |
---|
317 | ./bit <target configuration> |
---|
318 | @end example |
---|
319 | |
---|
320 | Where <target configuration> is one of the following: |
---|
321 | |
---|
322 | @itemize @bullet |
---|
323 | @item hppa1.1 |
---|
324 | @item i386 |
---|
325 | @item i386-elf |
---|
326 | @item i386-go32 |
---|
327 | @item i960 |
---|
328 | @item m68k |
---|
329 | @item mips64orion |
---|
330 | @item powerpc |
---|
331 | @item sh |
---|
332 | @item sparc |
---|
333 | @end itemize |
---|
334 | |
---|
335 | If no errors are encountered, the @code{bit} script will conclude by |
---|
336 | printing messages similar to the following: |
---|
337 | |
---|
338 | @example |
---|
339 | |
---|
340 | The src and build-i386-tools subdirectory may now be removed. |
---|
341 | |
---|
342 | Started: Fri Apr 10 10:14:07 CDT 1998 |
---|
343 | Finished: Fri Apr 10 12:01:33 CDT 1998 |
---|
344 | @end example |
---|
345 | |
---|
346 | If the @code{bit} script successfully completes, then the |
---|
347 | GNU C/C++ cross compilation tools are installed. |
---|
348 | |
---|
349 | If the @code{bit} script does not successfully complete, then investigation |
---|
350 | will be required to determine the source of the error. |
---|
351 | |
---|