next up previous contents
Next: Get, build and install Up: Infrastructure - Tools and Previous: Add the directory containing   Contents

Subsections

Get and build the development tools

RTEMS uses the GNU toolchain to build the executive and libraries. Information about the GNU tools can be found on the GNU home page. If you're feeling brave you can skip the following sections and turn loose the script included in appendixA. In either case, if you're building on Solaris you'll need to ensure that you have GNU make (gmake) installed on your system and also set a couple of environment variables for things to build properly:
MAKE=gmake
INTLLIBS=-lintl

The script can also be downloaded from here. The script attempts to download, unpack, configure, build and install the GNU cross-development tools and libraries for one or more target architectures. To use the script, set the ARCHS environment variable to the architectures you wish to support, then

sh getAndBuildTools.sh
Set the MAKE environment variable to the name of whatever make program you need for your system.

Download the tool source files

The source for the GNU tools should be obtained from the On-line Applications Research (OAR) FTP server since that server provides any RTEMS-specific patches that may have to be applied before the tools can be built.

The files in the OAR FTP server directory ftp://www.rtems.com/pub/rtems/SOURCES/4.9 should be downloaded to the RTEMS/tools directory created above. The files can be downloaded using a web browser or a command-line program such as curl or wget. (note that the command examples have been split to help them fit on the page):

curl -remote-name
   ftp://www.rtems.com/pub/rtems/SOURCES/4.9/binutils-2.19.tar.bz2
curl -remote-name
  ftp://www.rtems.com/pub/rtems/SOURCES/4.9/gcc-core-4.3.2.tar.bz2
curl -remote-name
  ftp://www.rtems.com/pub/rtems/SOURCES/4.9/gcc-g++-4.3.2.tar.bz2
curl -remote-name
  ftp://www.rtems.com/pub/rtems/SOURCES/4.9/newlib-1.16.0.tar.gz
curl -remote-name
  ftp://www.rtems.com/pub/rtems/SOURCES/4.9/
gcc-core-4.3.2-rtems4.9-20081214.diffcurl -remote-name
  ftp://www.rtems.com/pub/rtems/SOURCES/4.9/gcc-core-4.3.2-rtems4.9-20081214.diff
newlib-1.16.0-rtems4.9-20090324.diffcurl -remote-name
  ftp://www.rtems.com/pub/rtems/SOURCES/4.9/newlib-1.16.0-rtems4.9-20090324.diff
or
wget --passive-ftp --no-directories --retr-symlinks
  ftp://www.rtems.com/pub/rtems/SOURCES/4.9/binutils-2.19.tar.bz2
wget --passive-ftp --no-directories --retr-symlinks
  ftp://www.rtems.com/pub/rtems/SOURCES/4.9/gcc-core-4.3.2.tar.bz2
...

Depending on the type of firewall between your machine and the OAR FTP server you may need to remove the --passive-ftp option from the wget commands.

Unpack the source archives:

The following commands will extract the GNU tool sources from the downloaded tar archive files.

bzcat binutils-2.19.tar.bz2 | tar xf -
bzcat gcc-core-4.3.2.tar.bz2 | tar xf -
bzcat gcc-g++-4.3.2.tar.bz2 | tar xf -
zcat <newlib-1.16.0.tar.gz | tar xf -

To build the newlib libraries needed by RTEMS you must make a symbolic link to the newlib source directory from the gcc source directory.

cd gcc-4.3.2
rm -rf newlib
ln -s ../1.16.0/newlib newlib
cd ..

Apply any RTEMS-specific patches

If any patch files (those with a .diff suffix) were downloaded from the OAR FTP server the patches in those files must be applied before the tools can be compiled.

Here is how the patches can be applied to the binutils sources:

cd binutils-2.19

patch -p1 <../

cd ..

gcc-core-4.3.2-rtems4.9-20081214.diff Here is how the patches can be applied to the gcc sources:

cd gcc-4.3.2

patch -p1 <../ gcc-core-4.3.2-rtems4.9-20081214.diff

cd ..

newlib-1.16.0-rtems4.9-20090324.diff Here is how the patches can be applied to the newlib sources:

cd newlib-1.16.0

patch -p1 <../ newlib-1.16.0-rtems4.9-20090324.diff

cd ..

Configure, build and install the `binutils':

The commands in this section must be repeated for each desired target architecture. The examples shown build the tools for Motorola Power PC targets.

  1. Create a directory in which the tools will be built and change to that directory.
    rm -rf build
    mkdir build
    cd build
    

  2. Configure the tools.
    ../binutils-2.19/configure -target=powerpc-rtems4.9.2 \
                 -prefix=/usr/local/rtems/rtems-4.9.2 \
                 -verbose -disable-nls \
                 -without-included-gettext \
                 -disable-win32-registry \
                 -disable-werror

    You should replace the `powerpc' with the name of the architecture for which you're building the tools. Common alternatives are `m68k' and `i386' for the Motorola M68k and Intel x86 family of processors, respectively.

  3. Build and install the tools.
    make -w all install
    
    In this and all subsequent cases the use of a GNU make program is required. On some hosts you'll have to use gmake instead of make.

  4. Return to the directory containing the tool and library sources.
    cd ..
    

Configure, build and install the cross-compiler and libraries

  1. Create a directory in which the tools will be built and change to that directory.
    rm -rf build
    mkdir build
    cd build
    

  2. Configure the compiler and libraries.
    ../4.3.2/configure -target=powerpc-rtems4.9.2 \
                -prefix=/usr/local/rtems/rtems-4.9.2 \
                -disable-libstdcxx-pch \
                -with-gnu-as -with-gnu-ld -verbose \
                -with-newlib \
                -with-system-zlib \
                -disable-nls -without-included-gettext \
                -disable-win32-registry \
                -enable-version-specific-runtime-libs \
                -enable-threads \
                -enable-newlib-io-c99-formats \
                -enable-languages="c,c++"

    You should again replace the 'powerpc' with the name of the architecture for which you're building the cross-compiler and libraries.

  3. Build and install the cross-compiler and libraries by.
    make -w all install
    

  4. Return to the directory containing the tool and library sources.
    cd ..
    


next up previous contents
Next: Get, build and install Up: Infrastructure - Tools and Previous: Add the directory containing   Contents
Eric Norum
norume@aps.anl.gov
Mon Oct 19 11:30:39 CDT 2009