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