1 |
1026 |
ivang |
@c
|
2 |
|
|
@c COPYRIGHT (c) 1988-2002.
|
3 |
|
|
@c On-Line Applications Research Corporation (OAR).
|
4 |
|
|
@c All rights reserved.
|
5 |
|
|
@c
|
6 |
|
|
@c nt.t,v 1.16 2002/01/17 21:47:46 joel Exp
|
7 |
|
|
@c
|
8 |
|
|
|
9 |
|
|
@appendix Using MS-Windows as a Development Host
|
10 |
|
|
|
11 |
|
|
This chapter discusses the installation of the GNU tool chain
|
12 |
|
|
on a computer running the Microsoft Windows NT operating system.
|
13 |
|
|
|
14 |
|
|
@section Cygwin 1.0 or Newer
|
15 |
|
|
|
16 |
|
|
Recent versions of Cygwin are vastly improved over the beta
|
17 |
|
|
versions. Most of the oddities, instabilities, and performance
|
18 |
|
|
problems have been resolved. The installation procedure
|
19 |
|
|
is much simpler. However, there are a handful of issues
|
20 |
|
|
that remain to successfully use Cygwin as an RTEMS development
|
21 |
|
|
environment.
|
22 |
|
|
|
23 |
|
|
@itemize @bullet
|
24 |
|
|
|
25 |
|
|
@item There is no @code{cc} program by default. The GNU configure
|
26 |
|
|
scripts used by RTEMS require this to be present to work properly.
|
27 |
|
|
The solution is to link @code{gcc.exe} to @code{cc.exe}.
|
28 |
|
|
|
29 |
|
|
@item Make sure you unarchive and build in a binary mounted
|
30 |
|
|
filesystem (e.g. mounted with the @code{-b} option). Otherwise,
|
31 |
|
|
many confusing errors will result.
|
32 |
|
|
|
33 |
|
|
@item If you want to use RPM, you will have to obtain that
|
34 |
|
|
separately by following the links from the main Cygwin site.
|
35 |
|
|
|
36 |
|
|
@item When using the RPMs, there may be warnings about
|
37 |
|
|
@code{/etc/mtab} while installing the info files. This can be
|
38 |
|
|
ignored.
|
39 |
|
|
|
40 |
|
|
@item A user has reported that they needed
|
41 |
|
|
to set CYGWIN=ntsec for chmod to work correctly, but had to set
|
42 |
|
|
CYGWIN=nontsec for compile to work properly (otherwise there were
|
43 |
|
|
complaints about permissions on a temporary file).
|
44 |
|
|
|
45 |
|
|
@item If you want to build the tools from source, you have the
|
46 |
|
|
same options as UNIX users -- @code{bit} or @code{RPM}.
|
47 |
|
|
|
48 |
|
|
@end itemize
|
49 |
|
|
|
50 |
|
|
@section Cygwin B19
|
51 |
|
|
|
52 |
|
|
This section is based on a draft provided by
|
53 |
|
|
@uref{mailto:g_montel@@yahoo.com, Geoffroy Montel }.
|
54 |
|
|
Geoffroy's procedure was based on information from
|
55 |
|
|
@uref{mailto:, David Fiddes }.
|
56 |
|
|
Their input and feedback is greatly appreciated.
|
57 |
|
|
|
58 |
|
|
@b{STATUS:} This chapter should be considered preliminary.
|
59 |
|
|
Please be careful when following these instructions.
|
60 |
|
|
|
61 |
|
|
This installation process works well under Windows NT.
|
62 |
|
|
Using Windows 95 or 98 is not recommended although it
|
63 |
|
|
should be possible with version 3.77 of GNU make and an updated
|
64 |
|
|
cygwinb19.dll.
|
65 |
|
|
|
66 |
|
|
This procedure should also work with newer versions of
|
67 |
|
|
the tool versions listed in this chapter, but this has
|
68 |
|
|
not been verified.
|
69 |
|
|
|
70 |
|
|
@subsection MS-Windows Host Specific Requirements
|
71 |
|
|
|
72 |
|
|
This section details the components required to install
|
73 |
|
|
and build a Windows hosted GNU cross development toolset.
|
74 |
|
|
|
75 |
|
|
@subsubsection Unzipping Archives
|
76 |
|
|
|
77 |
|
|
You will have to uncompress many archives during this
|
78 |
|
|
process. You must @b{NOT} use @code{WinZip} or
|
79 |
|
|
@code{PKZip}. Instead the un-archiving process uses
|
80 |
|
|
the GNU @code{zip} and @code{tar} programs as shown below:
|
81 |
|
|
|
82 |
|
|
@example
|
83 |
|
|
tar -xzvf archive.tgz
|
84 |
|
|
@end example
|
85 |
|
|
|
86 |
|
|
@code{tar} is provided with Cygwin32.
|
87 |
|
|
|
88 |
|
|
@subsubsection Text Editor
|
89 |
|
|
|
90 |
|
|
You absolutely have to use a text editor which can
|
91 |
|
|
save files with Unix format (so don't use Notepad
|
92 |
|
|
nor Wordpad). There are a number of editors
|
93 |
|
|
freely available that can be used.
|
94 |
|
|
|
95 |
|
|
@itemize @bullet
|
96 |
|
|
@item @b{VIM} (@b{Vi IMproved}) is available from
|
97 |
|
|
@b{http://www.vim.org/}. This editor has the very
|
98 |
|
|
handy ability to easily read and write files in
|
99 |
|
|
either DOS or UNIX style.
|
100 |
|
|
|
101 |
|
|
@item @b{GNU Emacs} is available for many platforms
|
102 |
|
|
including MS-Windows. The official homepage
|
103 |
|
|
is @b{http://www.gnu.org/software/emacs/emacs.html}.
|
104 |
|
|
The GNU Emacs on Windows NT and Windows 95/98 FAQ is
|
105 |
|
|
at @b{http://www.gnu.org/software/emacs/windows/ntemacs.html}.
|
106 |
|
|
|
107 |
|
|
@item @b{PFE} (@b{Programmers File Editor}) may be downloaded
|
108 |
|
|
from @b{http://www.simtel.net/pub/simtelnet/win95/editor/pfe101i.zip}. Note this
|
109 |
|
|
editor is no longer actively supported.
|
110 |
|
|
|
111 |
|
|
@c @uref{http://www.simtel.net/pub/simtelnet/win95/editor/pfe101i.zip}
|
112 |
|
|
|
113 |
|
|
@end itemize
|
114 |
|
|
|
115 |
|
|
@subsubsection Bug in Patch Utility
|
116 |
|
|
|
117 |
|
|
There is a bug in the @code{patch} utility
|
118 |
|
|
provided in Cygwin32 B19. The files modified end up
|
119 |
|
|
having MS-DOS style line termination. They must have
|
120 |
|
|
Unix format, so a @code{dos2unix}-like command must
|
121 |
|
|
be used to put them back into Unix format as shown below:
|
122 |
|
|
|
123 |
|
|
@example
|
124 |
|
|
$ dos2unix XYZ
|
125 |
|
|
Dos2Unix: Cleaning file XYZ ...
|
126 |
|
|
@end example
|
127 |
|
|
|
128 |
|
|
The dos2unix utility may be downloaded from:
|
129 |
|
|
|
130 |
|
|
@c @uref{ftp://ftp.micros.hensa.ac.uk/platforms/ibm-pc/ms-dos/simtelnet/txtutl/dos2unix.zip,ftp://ftp.micros.hensa.ac.uk/platforms/ibm-pc/ms-dos/simtelnet/txtutl/dos2unix.zip}
|
131 |
|
|
@b{ftp://ftp.micros.hensa.ac.uk/platforms/ibm-pc/ms-dos/simtelnet/txtutl/dos2unix.zip}
|
132 |
|
|
|
133 |
|
|
You @b{must} change the format of every patched file
|
134 |
|
|
for the toolset build to work correctly.
|
135 |
|
|
|
136 |
|
|
@subsubsection Files Needed
|
137 |
|
|
|
138 |
|
|
This section lists the files required to build and install
|
139 |
|
|
a Windows hosted GNU cross development toolset and their
|
140 |
|
|
home WWW site. In addition to the sources required
|
141 |
|
|
for the RTEMS cross environment listed earlier in this manual,
|
142 |
|
|
you may need to download the following
|
143 |
|
|
files from their respective sites using your favorite
|
144 |
|
|
Web browser or ftp client. [NOTE: This information was current when B19
|
145 |
|
|
was released and URLs may no longer be correct.]
|
146 |
|
|
|
147 |
|
|
@table @b
|
148 |
|
|
|
149 |
|
|
@item cdk.exe
|
150 |
|
|
@c @uref{http://www.cygnus.com/misc/gnu-win32/,http://www.cygnus.com/misc/gnu-win32/}
|
151 |
|
|
@b{http://www.cygnus.com/misc/gnu-win32/}
|
152 |
|
|
|
153 |
|
|
@item coolview.tar.gz
|
154 |
|
|
@c @uref{http://www.lexa.ru/sos/,http://www.lexa.ru/sos/}
|
155 |
|
|
@b{http://www.lexa.ru/sos/}
|
156 |
|
|
|
157 |
|
|
@end table
|
158 |
|
|
|
159 |
|
|
@subsubsection System Requirements
|
160 |
|
|
|
161 |
|
|
Although the finished cross-compiler is fairly easy on resources,
|
162 |
|
|
building it can take a significant amount of processing power and
|
163 |
|
|
disk space. The recommended build system spec is:
|
164 |
|
|
|
165 |
|
|
@enumerate
|
166 |
|
|
|
167 |
|
|
@item An AMD K6-300, Pentium II-300 or better processor. GNU C and Cygwin32 are
|
168 |
|
|
@b{very} CPU hungry.
|
169 |
|
|
|
170 |
|
|
@item At least 64MB of RAM.
|
171 |
|
|
|
172 |
|
|
@item At least 400MB of FAT16 disk space or 250MB if you have an NTFS partition.
|
173 |
|
|
|
174 |
|
|
@end enumerate
|
175 |
|
|
|
176 |
|
|
Even with this spec of machine expect the full suite to take over 2 hours to
|
177 |
|
|
build with a further half an hour for RTEMS itself.
|
178 |
|
|
|
179 |
|
|
|
180 |
|
|
@subsection Installing Cygwin32 B19
|
181 |
|
|
|
182 |
|
|
This section describes the process of installing the
|
183 |
|
|
version B19 of the Cygwin32 environment. It assumes
|
184 |
|
|
that this toolset is installed in a directory
|
185 |
|
|
referred to as @code{}.
|
186 |
|
|
|
187 |
|
|
@enumerate
|
188 |
|
|
|
189 |
|
|
@item Execute cdk.exe. These instructions assume that you
|
190 |
|
|
install Cygwin32 under the \cygnus\b19 directory.
|
191 |
|
|
|
192 |
|
|
@item Execute Cygwin.bat (either on the start menu or
|
193 |
|
|
under \cygnus\b19).
|
194 |
|
|
|
195 |
|
|
@item At this point, you are at the command line of @code{bash},
|
196 |
|
|
a Unix-like shell. You have to mount the "/" directory. Type:
|
197 |
|
|
|
198 |
|
|
@example
|
199 |
|
|
umount /
|
200 |
|
|
mount -b /
|
201 |
|
|
@end example
|
202 |
|
|
|
203 |
|
|
For example, the following sequence mounts the @code{E:\unix} as the
|
204 |
|
|
root directory for the Cygwin32 environment. Note the use of two @code{\}s
|
205 |
|
|
when specifying DOS paths in bash:
|
206 |
|
|
|
207 |
|
|
@example
|
208 |
|
|
umount /
|
209 |
|
|
mount -b e:\\unix /
|
210 |
|
|
@end example
|
211 |
|
|
|
212 |
|
|
@item Create the /bin, /tmp, /source and /build directories.
|
213 |
|
|
|
214 |
|
|
@example
|
215 |
|
|
mkdir /bin
|
216 |
|
|
mkdir /tmp
|
217 |
|
|
mkdir /source
|
218 |
|
|
mkdir /build
|
219 |
|
|
mkdir /build/binutils
|
220 |
|
|
mkdir /build/gcc
|
221 |
|
|
@end example
|
222 |
|
|
|
223 |
|
|
@item The light Bourne shell provided with Cygwin B19 is buggy.
|
224 |
|
|
You should copy it to a fake name and copy @code{bash.exe} to @code{sh.exe}:
|
225 |
|
|
|
226 |
|
|
@example
|
227 |
|
|
cd /cygnus/b19/H-i386-cygwin32/bin
|
228 |
|
|
mv sh.exe old_sh.exe
|
229 |
|
|
cp bash.exe sh.exe
|
230 |
|
|
@end example
|
231 |
|
|
|
232 |
|
|
The Bourne shell has to be present in /bin directory to run shell scripts properly:
|
233 |
|
|
|
234 |
|
|
@example
|
235 |
|
|
cp /cygnus/b19/H-i386-cygwin32/bin/sh.exe /bin
|
236 |
|
|
cp /cygnus/b19/H-i386-cygwin32/bin/bash.exe /bin
|
237 |
|
|
@end example
|
238 |
|
|
|
239 |
|
|
|
240 |
|
|
@item Open the file
|
241 |
|
|
@code{/cygnus/b19/H-i386-cygwin32/lib/gcc-lib/i386-cygwin32/2.7-b19/specs},
|
242 |
|
|
and append
|
243 |
|
|
|
244 |
|
|
@example
|
245 |
|
|
-ladvapi32
|
246 |
|
|
@end example
|
247 |
|
|
|
248 |
|
|
to the following line:
|
249 |
|
|
|
250 |
|
|
@example
|
251 |
|
|
-lcygwin %@{mwindows:-luser32 -lgdi32 -lcomdlg32@} -lkernel32
|
252 |
|
|
@end example
|
253 |
|
|
|
254 |
|
|
@end enumerate
|
255 |
|
|
|
256 |
|
|
At this point, you have a native installation of Cygwin32 and
|
257 |
|
|
are ready to proceed to building a cross-compiler.
|
258 |
|
|
|
259 |
|
|
@c
|
260 |
|
|
@c BINUTILS
|
261 |
|
|
@c
|
262 |
|
|
|
263 |
|
|
@subsection Installing binutils
|
264 |
|
|
|
265 |
|
|
@enumerate
|
266 |
|
|
|
267 |
|
|
@item Unarchive @value{BINUTILS-TAR} following the
|
268 |
|
|
instructions in @ref{Unarchiving the Tools} into the /source directory.
|
269 |
|
|
Apply the appropriate RTEMS specific patch as detailed in
|
270 |
|
|
@ref{Applying RTEMS Patches}.
|
271 |
|
|
|
272 |
|
|
@item In the @code{/build/binutils} directory, execute the following
|
273 |
|
|
command to configure @value{BINUTILS-VERSION}:
|
274 |
|
|
|
275 |
|
|
@example
|
276 |
|
|
/source/@value{BINUTILS-UNTAR}/configure \
|
277 |
|
|
--verbose --target=m68k-rtems \
|
278 |
|
|
--prefix=/gcc-m68k-rtems --with-gnu-as --with-gnu-ld
|
279 |
|
|
@end example
|
280 |
|
|
|
281 |
|
|
Replace @code{m68k-rtems} with the target configuration
|
282 |
|
|
of your choice. See @ref{Using the bit Script} for a
|
283 |
|
|
list of the targets available.
|
284 |
|
|
|
285 |
|
|
@item Execute the following command to compile the toolset:
|
286 |
|
|
|
287 |
|
|
@example
|
288 |
|
|
make
|
289 |
|
|
@end example
|
290 |
|
|
|
291 |
|
|
@item Install the full package with the following command:
|
292 |
|
|
|
293 |
|
|
@example
|
294 |
|
|
make -k install
|
295 |
|
|
@end example
|
296 |
|
|
|
297 |
|
|
There is a problem with the gnu info package which will cause an
|
298 |
|
|
error during installation. Telling make to keep going with @code{-k} allows
|
299 |
|
|
the install to complete.
|
300 |
|
|
|
301 |
|
|
@item In the @code{cygnus.bat} file, add the directory
|
302 |
|
|
containing the cross-compiler executables to your search path
|
303 |
|
|
by inserting the following line:
|
304 |
|
|
|
305 |
|
|
@example
|
306 |
|
|
PATH=E:\unix\gcc-m68k-rtems\bin;%PATH%
|
307 |
|
|
@end example
|
308 |
|
|
|
309 |
|
|
@item You can erase the /build/binutils directory content if
|
310 |
|
|
disk space is tight.
|
311 |
|
|
|
312 |
|
|
@item Exit bash and run @code{cygnus.bat} to restart
|
313 |
|
|
the Cygwin32 environment with the new path.
|
314 |
|
|
|
315 |
|
|
@end enumerate
|
316 |
|
|
|
317 |
|
|
@c
|
318 |
|
|
@c GCC
|
319 |
|
|
@c
|
320 |
|
|
|
321 |
|
|
@subsection Installing GCC AND NEWLIB
|
322 |
|
|
|
323 |
|
|
@enumerate
|
324 |
|
|
@item Unarchive and patch @value{GCC-TAR} and @value{NEWLIB-TAR}
|
325 |
|
|
following the instructions in @ref{Unarchiving the Tools}.
|
326 |
|
|
Apply the appropriate RTEMS specific patches as detailed in
|
327 |
|
|
@ref{Applying RTEMS Patches}.
|
328 |
|
|
|
329 |
|
|
@b{NOTE}: See @ref{Bug in Patch Utility}.
|
330 |
|
|
|
331 |
|
|
@item Remove the following directories (we cannot use Fortran
|
332 |
|
|
or Objective-C as Cygwin32 cross-compilers):
|
333 |
|
|
|
334 |
|
|
@example
|
335 |
|
|
/source/@value{GCC-UNTAR}/libf2c
|
336 |
|
|
/source/@value{GCC-UNTAR}/gcc/objc
|
337 |
|
|
/source/@value{GCC-UNTAR}/gcc/f
|
338 |
|
|
@end example
|
339 |
|
|
|
340 |
|
|
@b{NOTE}: See @ref{Bug in Patch Utility}.
|
341 |
|
|
|
342 |
|
|
@item Link the following directories from Newlib to the main GCC directory,
|
343 |
|
|
/source/@value{GCC-UNTAR}/ :
|
344 |
|
|
|
345 |
|
|
@itemize @bullet
|
346 |
|
|
@item ln -s ../@value{NEWLIB-UNTAR}/newlib newlib
|
347 |
|
|
@item ln -s ../@value{NEWLIB-UNTAR}/libgloss libgloss
|
348 |
|
|
@end itemize
|
349 |
|
|
|
350 |
|
|
@item Change to the /build/gcc directory to configure the compiler:
|
351 |
|
|
|
352 |
|
|
@example
|
353 |
|
|
/source/@value{GCC-UNTAR}/configure \
|
354 |
|
|
--verbose --target=m68k-rtems \
|
355 |
|
|
--prefix=/gcc-m68k --with-gnu-as --with-gnu-ld \
|
356 |
|
|
--with-newlib
|
357 |
|
|
@end example
|
358 |
|
|
|
359 |
|
|
Replace @code{m68k-rtems} with the target configuration
|
360 |
|
|
of your choice. See @ref{Using the bit Script} for a
|
361 |
|
|
list of the targets available.
|
362 |
|
|
|
363 |
|
|
@item Compile the toolset as follows:
|
364 |
|
|
|
365 |
|
|
@example
|
366 |
|
|
make cross
|
367 |
|
|
@end example
|
368 |
|
|
|
369 |
|
|
You must do a @code{make cross} (not a simple @code{make})
|
370 |
|
|
to insure that the different packages are built in the correct
|
371 |
|
|
order. Making the compiler can take several hours even on
|
372 |
|
|
fairly fast machines, beware.
|
373 |
|
|
|
374 |
|
|
@item Install with the following command:
|
375 |
|
|
|
376 |
|
|
@example
|
377 |
|
|
make -k install
|
378 |
|
|
@end example
|
379 |
|
|
|
380 |
|
|
@item Just as with binutils package, a problem with the gnu
|
381 |
|
|
info package not building correctly requires that you use -k to
|
382 |
|
|
keep going.
|
383 |
|
|
|
384 |
|
|
@end enumerate
|
385 |
|
|
|
386 |
|
|
With any luck, at this point you having a working cross-compiler. So
|
387 |
|
|
as Geoffroy said:
|
388 |
|
|
|
389 |
|
|
@center @b{That's it! Celebrate!}
|
390 |
|
|
|