2.3. Obtain the Sources

You have considered and chosen a suitable installation prefix in the previous section. We have chosen $HOME/quick-start/rtems/6 as the installation prefix. We will show how to use a released version of RTEMS and then as an alternative we will show you using the RSB Git repository. Consider using a Git clone if you wish to make contributions to the RTEMS Project.

You need the RTEMS Source Builder (RSB) to work with RTEMS and we prefer you use a released version. A released version of the RSB downloads all source code from the RTEMS servers. Each release archives all the referenced source providing long term stability as changes in upstream projects do not effect a release’s build.

You will need approximately 1.5G bytes of disk space to build the tools, RTEMS kernel, network stack and 3rd party packages for the ERC32 BSP.

2.3.1. Releases

You can download the source archives for a released RTEMS version from RTEMS’ servers. Releases can be view at https://ftp.rtems.org/pub/rtems/releases with the releases listed as a series under a release’s major number. For RTEMS 5.1 the release series is 5 and the release path is https://ftp.rtems.org/pub/rtems/releases/5/5.1.

To work with the archives of a released RTEMS version, simply replace the version number 5 used throughout this chapter with the version number you selected, e.g. sparc-rtems4.11, sparc-rtems6, and so on.

Download and unpack using the curl and tar command with these commands:

mkdir -p $HOME/quick-start/src
cd $HOME/quick-start/src
curl https://ftp.rtems.org/pub/rtems/releases/5/5.1/sources/rtems-source-builder-5.1.tar.xz | tar xJf -

If curl does not work consider using wget or a browser.

The RSB is unpacked under the path rtems-source-builder-5.1. Rename this to rsb to get shorter paths during the tool suite build. To do this run these commands:

cd $HOME/quick-start/src
mv rtems-source-builder-5.1 rsb

If you wish to build the RTEMS kernel from source obtain the RTEMS kernel sources:

cd $HOME/quick-start/src
curl https://ftp.rtems.org/pub/rtems/releases/5/5.1/sources/rtems-5.1.tar.xz | tar xJf -

2.3.2. Git

Alternatively, clone the Git repositories into $HOME/quick-start/src.

A Git repository clone gives you some flexibility with the added complexity of needing to use a Git branch to build a released version. With Git you can switch between branches to try out different RTEMS versions and you have access to the RTEMS source history. The RTEMS Project welcomes contributions. The Git repositories enable you to easily create patches and track local changes.

You can clone the Git repository to get all versions of RTEMS including the development head. Release branches in Git are kept stable however they may differ from a release’s source archive.

mkdir -p $HOME/quick-start/src
cd $HOME/quick-start/src
git clone https://gitlab.rtems.org/rtems/tools/rtems-source-builder.git rsb
git clone https://gitlab.rtems.org/rtems/rtos/rtems.git

The rsb repository clone contains the RTEMS Source Builder (RSB). We clone it into rsb to get shorter paths during the tool suite build. The rtems repository clone contains the RTEMS sources. These two repositories are enough to get started. There are more repositories available.

2.3.3. Offline Download

If you have limited Internet access you can download the source before you start building. If you are permanently connected to the Internet you do not need to do this and the sources will be automatically download on demand when needed.

Once the sources have been downloaded you could disconnect your host computer from the Internet. It is no longer required to work with RTEMS. To download the sources to build the ERC 32 BSP before building run the following commands:

cd $HOME/quick-start/src/rsb/rtems
../source-builder/sb-set-builder --source-only-download 6/rtems-sparc

This command should output something like this (omitted lines are denoted by ...):

RTEMS Source Builder - Set Builder, 6 (5e449fb5c2cb)
Build Set: 6/rtems-sparc
Build Set: 6/rtems-autotools.bset
Build Set: 6/rtems-autotools-internal.bset
download: https://git.rtems.org/rtems-tools/snapshot/rtems-tools-90342feb4dd63d188ce945adfb0a769...<see log> -> sources/rtems-tools-90342feb4dd63d188ce945adfb0a7694a42a65cd.tar.bz2
Build Sizes: usage: 0.000B total: 264.228MB (sources: 264.186MB, patches: 43.468KB, installed 0.000B)
Build Set: Time 0:06:34.357125

If you encounter errors, check your internet connection, firewall settings, virus scanners and the availability of the download servers.