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 | @set CYGWIN-VERSION B19 |
---|
10 | @set CYGWIN-FTP http://www.cygnus.com/misc/gnu-win32 |
---|
11 | @set DOS2UNIX-FTP ftp://ftp.micros.hensa.ac.uk/platforms/ibm-pc/ms-dos/simtelnet/txtutl/dos2unix.zip |
---|
12 | @set PFE-FTP http://www.lancs.ac.uk/people/cpaap/pfe/ |
---|
13 | |
---|
14 | @chapter Using MS-Windows as a Development Host |
---|
15 | |
---|
16 | This chapter discusses the installation of the GNU tool chain |
---|
17 | on a computer running either the Microsoft Windows95 |
---|
18 | or WindowsNT operating system. |
---|
19 | |
---|
20 | This chapter is based on a draft provided by |
---|
21 | Geoffroy Montel <g_montel@@yahoo.com>. Geoffroy's |
---|
22 | procedure was based on information from |
---|
23 | David Fiddes <D.J.Fiddes@@hw.ac.uk>. |
---|
24 | Their input and feedback is greatly appreciated. |
---|
25 | |
---|
26 | @b{STATUS:} This chapter should be considered preliminary. |
---|
27 | Please be careful when following these instructions. |
---|
28 | |
---|
29 | @section Version Information |
---|
30 | |
---|
31 | This installation process works well under Windows NT. |
---|
32 | It is said to also work under Windows95 (although it |
---|
33 | did not work with B18). Anyway, the resulting code works |
---|
34 | under both NT and 95. |
---|
35 | |
---|
36 | This procedure should also work with newer version of |
---|
37 | the tool versions listed in this chapter, but this has |
---|
38 | not been verified. If you have success with a particular |
---|
39 | version of the toolset or notice problems in this chapter, |
---|
40 | please let the RTEMS maintainers know so they can be |
---|
41 | addressed in future revisions of this document. |
---|
42 | |
---|
43 | @section MS-Windows Host Specific Requirements |
---|
44 | |
---|
45 | This section details the components required to install |
---|
46 | and build a Windows hosted GNU cross development toolset. |
---|
47 | |
---|
48 | @subsection Unzipping Archives |
---|
49 | |
---|
50 | You will have to uncompress many archives during this |
---|
51 | process. You must @b{NOT} use @code{WinZip} or |
---|
52 | @code{PKZip}. Instead the un-achiving process uses |
---|
53 | the GNU @code{zip} and @code{tar} programs as shown below: |
---|
54 | |
---|
55 | @example |
---|
56 | tar -xzvf archive.gzip |
---|
57 | @end example |
---|
58 | |
---|
59 | @code{tar} is provided with Cygwin32. |
---|
60 | |
---|
61 | @subsection Text Editor |
---|
62 | |
---|
63 | You absolutely have to use a text editor which can |
---|
64 | save files with Unix format (so don't use Notepad |
---|
65 | nor Wordpad). If you do not have an appropriate |
---|
66 | text editor, try @b{Programmers File Editor}, it is |
---|
67 | free and very convenient. This editor may be downloaded |
---|
68 | from: |
---|
69 | |
---|
70 | @ifset use-html |
---|
71 | @href{@value{PFE-FTP},,@value{PFE-FTP}} |
---|
72 | @end ifset |
---|
73 | @ifclear use-html |
---|
74 | @value{PFE-FTP} |
---|
75 | @end ifclear |
---|
76 | |
---|
77 | @subsection Bug in Patch Utility |
---|
78 | |
---|
79 | There is a bug in the @code{patch} utility |
---|
80 | provided in Cygwin32 B19. The files modified end up |
---|
81 | having MS-DOS style line termination. They must have |
---|
82 | Unix format, so a @code{dos2unix}-like command must |
---|
83 | be used to put them back into Unix format as shown below: |
---|
84 | |
---|
85 | @example |
---|
86 | $ dos2unix XYZ |
---|
87 | Dos2Unix: Cleaning file XYZ ... |
---|
88 | @end example |
---|
89 | |
---|
90 | The dos2unix utility may be downloaded from: |
---|
91 | |
---|
92 | @ifset use-html |
---|
93 | @href{@value{DOS2UNIX-FTP},,,@value{DOS2UNIX-FTP}} |
---|
94 | @end ifset |
---|
95 | @ifclear use-html |
---|
96 | @value{DOS2UNIX-FTP} |
---|
97 | @end ifclear |
---|
98 | |
---|
99 | |
---|
100 | @subsection Files Needed |
---|
101 | |
---|
102 | This section lists the files required to build and install |
---|
103 | a Windows hosted GNU cross development toolset and their |
---|
104 | home WWW site. In addition to the sources required |
---|
105 | for the cross environment listed earlier in @ref{Get All the Pieces}, |
---|
106 | you will need to download the following |
---|
107 | files from their respective sites using your favorite |
---|
108 | Web browser or ftp client. |
---|
109 | |
---|
110 | @table @b |
---|
111 | |
---|
112 | @item cdk.exe |
---|
113 | @ifset use-html |
---|
114 | @href{@value{CYGWIN-FTP},,@value{CYGWIN-FTP}} |
---|
115 | @end ifset |
---|
116 | @ifclear use-html |
---|
117 | @value{CYGWIN-FTP} |
---|
118 | @end ifclear |
---|
119 | |
---|
120 | @item usertools.exe |
---|
121 | @ifset use-html |
---|
122 | @href{@value{CYGWIN-FTP},,@value{CYGWIN-FTP}} |
---|
123 | @end ifset |
---|
124 | @ifclear use-html |
---|
125 | @value{CYGWIN-FTP} |
---|
126 | @end ifclear |
---|
127 | |
---|
128 | @end table |
---|
129 | |
---|
130 | @section Installing Cygwin32 B19 |
---|
131 | |
---|
132 | This section describes the process of installing the |
---|
133 | version @value{CYGWIN-VERSION} of the Cygwin32 environment. It assumes |
---|
134 | that this toolset is installed in a directory |
---|
135 | referred to as @code{<RTOS>}. |
---|
136 | |
---|
137 | @enumerate |
---|
138 | |
---|
139 | @item Execute cdk.exe. These instructions assume that you |
---|
140 | install Cygwin32 under the <RTOS>\GnuWin32\b19 directory. |
---|
141 | |
---|
142 | @item Execute usertools.exe. These instructions assume that you |
---|
143 | install Cygwin32 under the <RTOS>\GnuWin32\b19 directory. |
---|
144 | |
---|
145 | @item Execute Cygwin.bat (either on the start menu or |
---|
146 | under <RTOS>\GnuWin32\b19). |
---|
147 | |
---|
148 | @item At this point, you are at the command line of @code{bash}, |
---|
149 | a Unix-like shell. You have to mount the "/" directory. Type: |
---|
150 | |
---|
151 | @example |
---|
152 | umount / |
---|
153 | mount -b <RTOS> / |
---|
154 | @end example |
---|
155 | |
---|
156 | For example, the following sequence creates an MS-DOS virtual |
---|
157 | drive @code{O:} using an MS-DOS command window and then mounts |
---|
158 | that virtual drive as the root directory for the Cygwin32 environment: |
---|
159 | |
---|
160 | @example |
---|
161 | subst o: <RTOS> |
---|
162 | umount / |
---|
163 | mount -b o: / |
---|
164 | @end example |
---|
165 | |
---|
166 | @item Create the /bin, /tmp, /build and /usr directories. |
---|
167 | |
---|
168 | @example |
---|
169 | mkdir /bin |
---|
170 | mkdir /tmp |
---|
171 | mkdir /build |
---|
172 | mkdir /usr |
---|
173 | @end example |
---|
174 | |
---|
175 | @item The light Bourne shell provided with Cygwin B19 is buggy. |
---|
176 | You should copy it to a fake name and copy @code{bash.exe} to @code{sh.exe}: |
---|
177 | |
---|
178 | @example |
---|
179 | cd <RTOS>/GnuWin32/b19/bin |
---|
180 | mv sh.exe old_sh.exe |
---|
181 | cp bash.exe sh.exe |
---|
182 | @end example |
---|
183 | |
---|
184 | The Bourne shell often has to be present in /bin directory when installing |
---|
185 | new packages. |
---|
186 | |
---|
187 | @item Open the file |
---|
188 | @code{/gnuwin32/b19/H-i386-cygwin32/lib/gcc-lib/i386-cygwin32/2.7-b19/specs}, |
---|
189 | and change the following line: |
---|
190 | |
---|
191 | @example |
---|
192 | -lcygwin %@{mwindows:-luser32 -lgdi32 -lcomdlg32@} -lkernel32 |
---|
193 | @end example |
---|
194 | |
---|
195 | to: |
---|
196 | |
---|
197 | @example |
---|
198 | -lcygwin %@{mwindows:-luser32 -lgdi32 -lcomdlg32@} -lkernel32 -ladvapi32 |
---|
199 | @end example |
---|
200 | |
---|
201 | @end enumerate |
---|
202 | |
---|
203 | At this point, you have a native installation of Cygwin32 and |
---|
204 | are ready to proceed to building a cross-compiler. |
---|
205 | |
---|
206 | @c |
---|
207 | @c BINUTILS |
---|
208 | @c |
---|
209 | |
---|
210 | @section Installing binutils |
---|
211 | |
---|
212 | @enumerate |
---|
213 | |
---|
214 | @item Unarchive @value{BINUTILS-TAR} following the |
---|
215 | instructions in @ref{Unarchiving the Tools}. Apply the |
---|
216 | appropriate RTEMS specific patch as detailed in |
---|
217 | @ref{Apply RTEMS Patch to binutils}. |
---|
218 | |
---|
219 | @b{NOTE}: See @ref{Bug in Patch Utility}. |
---|
220 | |
---|
221 | @item In the @code{/build} directory, execute the following |
---|
222 | command to configure @value{BINUTILS-VERSION}: |
---|
223 | |
---|
224 | @example |
---|
225 | @value{BINUTILS-UNTAR}/configure --verbose --target=m68k-rtems \ |
---|
226 | --prefix=/gcc-m68k-rtems --with-gnu-as \ |
---|
227 | --with-gnu-ld --with-targets=all --with-newlib --with-multilib |
---|
228 | @end example |
---|
229 | |
---|
230 | Replace @code{m68k-rtems} with the target configuration |
---|
231 | of your choice. See @ref{Running the bit Script} for a |
---|
232 | list of the targets available. |
---|
233 | |
---|
234 | @item Execute the following command to compile the toolset: |
---|
235 | |
---|
236 | @example |
---|
237 | make |
---|
238 | @end example |
---|
239 | |
---|
240 | @item With B19, an error will occur. Remove the ".exe" suffix |
---|
241 | from the tools by finding them all and renaming them |
---|
242 | as shown below: |
---|
243 | |
---|
244 | @example |
---|
245 | find . -name *.exe -print |
---|
246 | mv XXX/gas.exe XXX/gas |
---|
247 | .... |
---|
248 | @end example |
---|
249 | |
---|
250 | @item Install the full package with the following command: |
---|
251 | |
---|
252 | @example |
---|
253 | make install |
---|
254 | @end example |
---|
255 | |
---|
256 | @item There is a problem with the gnu info package |
---|
257 | which may prevent it from building correctly. To |
---|
258 | get around this try again with: |
---|
259 | |
---|
260 | @example |
---|
261 | make -k install |
---|
262 | @end example |
---|
263 | |
---|
264 | @item Once the executables are installed, |
---|
265 | you can restore the ".exe" suffix to the files in |
---|
266 | the @code{/gcc-m68k-rtems/bin} and |
---|
267 | @code{/gcc-m68k-rtems/m68k-rtems/bin} directories again. |
---|
268 | |
---|
269 | @item In the @code{cygnus.bat} file, add the directory |
---|
270 | to the cross-compiler executables to your search path |
---|
271 | by adding the following line: |
---|
272 | |
---|
273 | @example |
---|
274 | PATH=O:\gcc-m68k-rtems\bin;%PATH% |
---|
275 | @end example |
---|
276 | |
---|
277 | @item You can erase the /build directory content. |
---|
278 | |
---|
279 | @item Exit bash and run @code{cygnus.bat} to restart |
---|
280 | the Cygwin32 environment. |
---|
281 | |
---|
282 | @end enumerate |
---|
283 | |
---|
284 | @c |
---|
285 | @c EGCS |
---|
286 | @c |
---|
287 | |
---|
288 | @section Installing EGCS AND NEWLIB |
---|
289 | |
---|
290 | @enumerate |
---|
291 | @item Unarchive and patch @value{EGCS-TAR} and @value{NEWLIB-TAR} |
---|
292 | following the instructions in @ref{Unarchiving the Tools}. |
---|
293 | Apply the appropriate RTEMS specific patches as detailed in |
---|
294 | @ref{Apply RTEMS Patch to EGCS} and @ref{Apply RTEMS Patch to newlib}. |
---|
295 | |
---|
296 | @b{NOTE}: See @ref{Bug in Patch Utility}. |
---|
297 | |
---|
298 | @item Remove the following directories (we do not need Fortran |
---|
299 | or Objective-C): |
---|
300 | |
---|
301 | @example |
---|
302 | · /build/@value{GCC-UNTAR}/libf2c |
---|
303 | · /build/@value{GCC-UNTAR}/gcc/objc |
---|
304 | · /build/@value{GCC-UNTAR}/gcc/f |
---|
305 | @end example |
---|
306 | |
---|
307 | @b{NOTE}: See @ref{Bug in Patch Utility}. |
---|
308 | |
---|
309 | @item Copy to /build/@value{GCC-UNTAR}/ the following directories: |
---|
310 | |
---|
311 | @itemize @bullet |
---|
312 | @item /build/@value{NEWLIB-UNTAR}/newlib |
---|
313 | @item /build/@value{NEWLIB-UNTAR}/libgloss |
---|
314 | @end itemize |
---|
315 | |
---|
316 | @item Go under /build directory and run: |
---|
317 | |
---|
318 | @example |
---|
319 | ../@value{GCC-UNTAR}/configure --verbose --target=m68k-rtems \ |
---|
320 | --prefix=/gcc-m68k --with-gnu-as --with-gnu-ld \ |
---|
321 | --with-targets=all --with-newlib --with-multilib |
---|
322 | @end example |
---|
323 | |
---|
324 | Replace @code{m68k-rtems} with the target configuration |
---|
325 | of your choice. See @ref{Running the bit Script} for a |
---|
326 | list of the targets available. |
---|
327 | |
---|
328 | @item Then run your favourite Unix format compaatible file editor, |
---|
329 | and edit /build/@value{GCC-UNTAR}/gcc/Makefile |
---|
330 | Search for the section: |
---|
331 | |
---|
332 | @example |
---|
333 | # libgcc1-test target (must also be overridable for a target) |
---|
334 | LIBGCC1_TEST = libgcc1-test |
---|
335 | @end example |
---|
336 | |
---|
337 | and change it to read: |
---|
338 | |
---|
339 | @example |
---|
340 | LIBGCC1_TEST = |
---|
341 | @end example |
---|
342 | |
---|
343 | @item Search for the section: |
---|
344 | |
---|
345 | @example |
---|
346 | # Set this to `ld' to enable use of collect2. |
---|
347 | USE_COLLECT2 = |
---|
348 | MAYBE_USE_COLLECT2 = |
---|
349 | # It is convenient for configure to add the assignment at the beginning, |
---|
350 | # so don't override it here. |
---|
351 | USE_COLLECT2 = ld |
---|
352 | @end example |
---|
353 | |
---|
354 | and change it to read: |
---|
355 | |
---|
356 | @example |
---|
357 | USE_COLLECT2 = |
---|
358 | @end example |
---|
359 | |
---|
360 | This changes are needed due to a @code{collect2} problem in B19. |
---|
361 | |
---|
362 | @item Compile the toolset as follows: |
---|
363 | |
---|
364 | @example |
---|
365 | make cross |
---|
366 | @end example |
---|
367 | |
---|
368 | You must do a @code{make cross} (not a simple @code{make}) |
---|
369 | to insure that the different packages are built in the correct |
---|
370 | order. This command could take a long time to run depending on |
---|
371 | the speed of the computer you are using. |
---|
372 | |
---|
373 | @item Install with the following command: |
---|
374 | |
---|
375 | @example |
---|
376 | make -k install |
---|
377 | @end example |
---|
378 | |
---|
379 | @item Just as with binutils package, a problem with the gnu |
---|
380 | info package not building correctly may occur, so try again with: |
---|
381 | |
---|
382 | @example |
---|
383 | make -k install |
---|
384 | @end example |
---|
385 | |
---|
386 | @end enumerate |
---|
387 | |
---|
388 | With any luck, at this point you having a working cross-compiler. So |
---|
389 | as Geoffroy said: |
---|
390 | |
---|
391 | @center @b{That's it! Celebrate!} |
---|
392 | |
---|