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