1 | @c |
---|
2 | @c COPYRIGHT (c) 1988-1999. |
---|
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 CYGWIN-COOLVIEW http://www.lexa.ru/sos/ |
---|
12 | @set DOS2UNIX-FTP ftp://ftp.micros.hensa.ac.uk/platforms/ibm-pc/ms-dos/simtelnet/txtutl/dos2unix.zip |
---|
13 | @set PFE-FTP http://www.lancs.ac.uk/people/cpaap/pfe/ |
---|
14 | |
---|
15 | @chapter Using MS-Windows as a Development Host |
---|
16 | |
---|
17 | This chapter discusses the installation of the GNU tool chain |
---|
18 | on a computer running the Microsoft Windows NT 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.surfaid.org>. |
---|
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 | Using Windows 95 or 98 is not recommended although it |
---|
33 | should be possible with version 3.77 of gmake and an updated |
---|
34 | cygwinb19.dll. |
---|
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-archiving process uses |
---|
53 | the GNU @code{zip} and @code{tar} programs as shown below: |
---|
54 | |
---|
55 | @example |
---|
56 | tar -xzvf archive.tgz |
---|
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 | @uref{@value{PFE-FTP},@value{PFE-FTP}} |
---|
71 | |
---|
72 | @subsection Bug in Patch Utility |
---|
73 | |
---|
74 | There is a bug in the @code{patch} utility |
---|
75 | provided in Cygwin32 B19. The files modified end up |
---|
76 | having MS-DOS style line termination. They must have |
---|
77 | Unix format, so a @code{dos2unix}-like command must |
---|
78 | be used to put them back into Unix format as shown below: |
---|
79 | |
---|
80 | @example |
---|
81 | $ dos2unix XYZ |
---|
82 | Dos2Unix: Cleaning file XYZ ... |
---|
83 | @end example |
---|
84 | |
---|
85 | The dos2unix utility may be downloaded from: |
---|
86 | |
---|
87 | @uref{@value{DOS2UNIX-FTP},@value{DOS2UNIX-FTP}} |
---|
88 | |
---|
89 | You @b{must} change the format of every patched file |
---|
90 | for the toolset build to work correctly. |
---|
91 | |
---|
92 | @subsection Files Needed |
---|
93 | |
---|
94 | This section lists the files required to build and install |
---|
95 | a Windows hosted GNU cross development toolset and their |
---|
96 | home WWW site. In addition to the sources required |
---|
97 | for the cross environment listed earlier in @ref{Get All the Pieces}, |
---|
98 | you will need to download the following |
---|
99 | files from their respective sites using your favorite |
---|
100 | Web browser or ftp client. |
---|
101 | |
---|
102 | @table @b |
---|
103 | |
---|
104 | @item cdk.exe |
---|
105 | @uref{@value{CYGWIN-FTP},@value{CYGWIN-FTP}} |
---|
106 | |
---|
107 | @item coolview.tar.gz |
---|
108 | @uref{@value{CYGWIN-COOLVIEW},@value{CYGWIN-COOLVIEW}} |
---|
109 | |
---|
110 | @end table |
---|
111 | |
---|
112 | @subsection System Requirements |
---|
113 | |
---|
114 | Although the finished cross-compiler is fairly easy on resources, |
---|
115 | building it can take a significant amount of processing power and |
---|
116 | disk space. The recommended build system spec is: |
---|
117 | |
---|
118 | @enumerate |
---|
119 | |
---|
120 | @item An AMD K6-300, Pentium II-300 or better processor. GNU C and Cygwin32 are |
---|
121 | @b{very} CPU hungry. |
---|
122 | |
---|
123 | @item At least 64MB of RAM. |
---|
124 | |
---|
125 | @item At least 400MB of FAT16 disk space or 250MB if you have an NTFS partition. |
---|
126 | |
---|
127 | @end enumerate |
---|
128 | |
---|
129 | Even with this spec of machine expect the full suite to take over 2 hours to |
---|
130 | build with a further half an hour for RTEMS itself. |
---|
131 | |
---|
132 | |
---|
133 | @section Installing Cygwin32 B19 |
---|
134 | |
---|
135 | This section describes the process of installing the |
---|
136 | version @value{CYGWIN-VERSION} of the Cygwin32 environment. It assumes |
---|
137 | that this toolset is installed in a directory |
---|
138 | referred to as @code{<RTOS>}. |
---|
139 | |
---|
140 | @enumerate |
---|
141 | |
---|
142 | @item Execute cdk.exe. These instructions assume that you |
---|
143 | install Cygwin32 under the <RTOS>\cygnus\b19 directory. |
---|
144 | |
---|
145 | @item Execute Cygwin.bat (either on the start menu or |
---|
146 | under <RTOS>\cygnus\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 mounts the @code{E:\unix} as the |
---|
157 | root directory for the Cygwin32 environment. Note the use of two @code{\}s |
---|
158 | when specifying DOS paths in bash: |
---|
159 | |
---|
160 | @example |
---|
161 | umount / |
---|
162 | mount -b e:\\unix / |
---|
163 | @end example |
---|
164 | |
---|
165 | @item Create the /bin, /tmp, /source and /build directories. |
---|
166 | |
---|
167 | @example |
---|
168 | mkdir /bin |
---|
169 | mkdir /tmp |
---|
170 | mkdir /source |
---|
171 | mkdir /build |
---|
172 | mkdir /build/binutils |
---|
173 | mkdir /build/egcs |
---|
174 | @end example |
---|
175 | |
---|
176 | @item The light Bourne shell provided with Cygwin B19 is buggy. |
---|
177 | You should copy it to a fake name and copy @code{bash.exe} to @code{sh.exe}: |
---|
178 | |
---|
179 | @example |
---|
180 | cd <RTOS>/cygnus/b19/H-i386-cygwin32/bin |
---|
181 | mv sh.exe old_sh.exe |
---|
182 | cp bash.exe sh.exe |
---|
183 | @end example |
---|
184 | |
---|
185 | The Bourne shell has to be present in /bin directory to run shell scripts properly: |
---|
186 | |
---|
187 | @example |
---|
188 | cp <RTOS>/cygnus/b19/H-i386-cygwin32/bin/sh.exe /bin |
---|
189 | cp <RTOS>/cygnus/b19/H-i386-cygwin32/bin/bash.exe /bin |
---|
190 | @end example |
---|
191 | |
---|
192 | |
---|
193 | @item Open the file |
---|
194 | @code{/cygnus/b19/H-i386-cygwin32/lib/gcc-lib/i386-cygwin32/2.7-b19/specs}, |
---|
195 | and change the following line: |
---|
196 | |
---|
197 | @example |
---|
198 | -lcygwin %@{mwindows:-luser32 -lgdi32 -lcomdlg32@} -lkernel32 |
---|
199 | @end example |
---|
200 | |
---|
201 | to: |
---|
202 | |
---|
203 | @example |
---|
204 | -lcygwin %@{mwindows:-luser32 -lgdi32 -lcomdlg32@} -lkernel32 -ladvapi32 |
---|
205 | @end example |
---|
206 | |
---|
207 | @end enumerate |
---|
208 | |
---|
209 | At this point, you have a native installation of Cygwin32 and |
---|
210 | are ready to proceed to building a cross-compiler. |
---|
211 | |
---|
212 | @c |
---|
213 | @c BINUTILS |
---|
214 | @c |
---|
215 | |
---|
216 | @section Installing binutils |
---|
217 | |
---|
218 | @enumerate |
---|
219 | |
---|
220 | @item Unarchive @value{BINUTILS-TAR} following the |
---|
221 | instructions in @ref{Unarchiving the Tools} into the /source directory. |
---|
222 | Apply the appropriate RTEMS specific patch as detailed in |
---|
223 | @ref{Apply RTEMS Patch to binutils}. |
---|
224 | |
---|
225 | @item In the @code{/build/binutils} directory, execute the following |
---|
226 | command to configure @value{BINUTILS-VERSION}: |
---|
227 | |
---|
228 | @example |
---|
229 | /source/@value{BINUTILS-UNTAR}/configure --verbose --target=m68k-rtems \ |
---|
230 | --prefix=/gcc-m68k-rtems --with-gnu-as --with-gnu-ld |
---|
231 | @end example |
---|
232 | |
---|
233 | Replace @code{m68k-rtems} with the target configuration |
---|
234 | of your choice. See @ref{Running the bit Script} for a |
---|
235 | list of the targets available. |
---|
236 | |
---|
237 | @item Execute the following command to compile the toolset: |
---|
238 | |
---|
239 | @example |
---|
240 | make |
---|
241 | @end example |
---|
242 | |
---|
243 | @item Install the full package with the following command: |
---|
244 | |
---|
245 | @example |
---|
246 | make -k install |
---|
247 | @end example |
---|
248 | |
---|
249 | There is a problem with the gnu info package which will cause an |
---|
250 | error during installation. Telling make to keep going with -k allows |
---|
251 | the install to complete. |
---|
252 | |
---|
253 | @item In the @code{cygnus.bat} file, add the directory |
---|
254 | containing the cross-compiler executables to your search path |
---|
255 | by inserting the following line: |
---|
256 | |
---|
257 | @example |
---|
258 | PATH=E:\unix\gcc-m68k-rtems\bin;%PATH% |
---|
259 | @end example |
---|
260 | |
---|
261 | @item You can erase the /build/binutils directory content if |
---|
262 | disk space is tight. |
---|
263 | |
---|
264 | @item Exit bash and run @code{cygnus.bat} to restart |
---|
265 | the Cygwin32 environment with the new path. |
---|
266 | |
---|
267 | @end enumerate |
---|
268 | |
---|
269 | @c |
---|
270 | @c EGCS |
---|
271 | @c |
---|
272 | |
---|
273 | @section Installing EGCS AND NEWLIB |
---|
274 | |
---|
275 | @enumerate |
---|
276 | @item Unarchive and patch @value{EGCS-TAR} and @value{NEWLIB-TAR} |
---|
277 | following the instructions in @ref{Unarchiving the Tools}. |
---|
278 | Apply the appropriate RTEMS specific patches as detailed in |
---|
279 | @ref{Apply RTEMS Patch to EGCS} and @ref{Apply RTEMS Patch to newlib}. |
---|
280 | |
---|
281 | @b{NOTE}: See @ref{Bug in Patch Utility}. |
---|
282 | |
---|
283 | @item Remove the following directories (we cannot use Fortran |
---|
284 | or Objective-C as Cygwin32 cross-compilers): |
---|
285 | |
---|
286 | @example |
---|
287 | /source/@value{GCC-UNTAR}/libf2c |
---|
288 | /source/@value{GCC-UNTAR}/gcc/objc |
---|
289 | /source/@value{GCC-UNTAR}/gcc/f |
---|
290 | @end example |
---|
291 | |
---|
292 | @b{NOTE}: See @ref{Bug in Patch Utility}. |
---|
293 | |
---|
294 | @item Link the following directories from Newlib to the main EGCS directory, |
---|
295 | /source/@value{GCC-UNTAR}/ : |
---|
296 | |
---|
297 | @itemize @bullet |
---|
298 | @item ln -s ../@value{NEWLIB-UNTAR}/newlib newlib |
---|
299 | @item ln -s ../@value{NEWLIB-UNTAR}/libgloss libgloss |
---|
300 | @end itemize |
---|
301 | |
---|
302 | @item Change to the /build/egcs directory to configure the compiler: |
---|
303 | |
---|
304 | @example |
---|
305 | /source/@value{GCC-UNTAR}/configure --verbose --target=m68k-rtems \ |
---|
306 | --prefix=/gcc-m68k --with-gnu-as --with-gnu-ld \ |
---|
307 | --with-newlib |
---|
308 | @end example |
---|
309 | |
---|
310 | Replace @code{m68k-rtems} with the target configuration |
---|
311 | of your choice. See @ref{Running the bit Script} for a |
---|
312 | list of the targets available. |
---|
313 | |
---|
314 | @item Compile the toolset as follows: |
---|
315 | |
---|
316 | @example |
---|
317 | make cross |
---|
318 | @end example |
---|
319 | |
---|
320 | You must do a @code{make cross} (not a simple @code{make}) |
---|
321 | to insure that the different packages are built in the correct |
---|
322 | order. Making the compiler can take several hours even on |
---|
323 | fairly fast machines, beware. |
---|
324 | |
---|
325 | @item Install with the following command: |
---|
326 | |
---|
327 | @example |
---|
328 | make -k install |
---|
329 | @end example |
---|
330 | |
---|
331 | @item Just as with binutils package, a problem with the gnu |
---|
332 | info package not building correctly requires that you use -k to |
---|
333 | keep going. |
---|
334 | |
---|
335 | @example |
---|
336 | make -k install |
---|
337 | @end example |
---|
338 | |
---|
339 | @end enumerate |
---|
340 | |
---|
341 | With any luck, at this point you having a working cross-compiler. So |
---|
342 | as Geoffroy said: |
---|
343 | |
---|
344 | @center @b{That's it! Celebrate!} |
---|
345 | |
---|