source: rtems-docs/rsb/project-sets.rst @ 969e60e

5
Last change on this file since 969e60e was 9742e45, checked in by Chris Johns <chrisj@…>, on 11/02/16 at 04:20:35

RSB: Fix the heading level for the PDF.

  • Property mode set to 100644
File size: 10.6 KB
Line 
1.. comment SPDX-License-Identifier: CC-BY-SA-4.0
2
3.. comment COPYRIGHT (c) 2012 - 2016.
4.. comment Chris Johns <chrisj@rtems.org>
5
6Project Sets
7============
8
9The RTEMS Source Builder supports project configurations. Project
10configurations can be public or private and can be contained in the RTEMS
11Source Builder project if suitable, other projects they use the RTEMS Source
12Builder or privately on your local file system.
13
14The configuration file loader searches the macro ``_configdir`` and by default
15this is set to ``%{_topdir}/config:%{_sbdir}/config`` where ``_topdir`` is the
16your current working direct, in other words the directory you invoke the RTEMS
17Source Builder command in, and ``_sbdir`` is the directory where the RTEMS
18Source Builder command resides. Therefore the ``config`` directory under each
19of these is searched so all you need to do is create a ``config`` in your
20project and add your configuration files. They do not need to be under the
21RTEMS Source Builder source tree. Public projects are included in the main
22RTEMS Source Builder such as RTEMS.
23
24You can also add your own ``patches`` directory next to your ``config``
25directory as the ``%patch`` command searches the ``_patchdir`` macro variable
26and it is by default set to ``%{_topdir}/patches:%{_sbdir}/patches``.
27
28The ``source-builder/config`` directory provides generic scripts for building
29various tools. You can specialise these in your private configurations to make
30use of them. If you add new generic configurations please contribute them back
31to the project
32
33Bare Metal
34----------
35
36The RSB contains a 'bare' configuration tree and you can use this to add
37packages you use on the hosts. For example 'qemu' is supported on a range of
38hosts. RTEMS tools live in the ``rtems/config`` directory tree. RTEMS packages
39include tools for use on your host computer as well as packages you can build
40and run on RTEMS.
41
42The **bare metal** support for GNU Tool chains. An example is the
43``lang/gcc491`` build set. You need to provide a target via the command line
44``--target`` option and this is in the standard 2 or 3 tuple form. For example
45for an ARM compiler you would use ``arm-eabi`` or ``arm-eabihf`, and for SPARC
46you would use `sparc-elf`::
47
48    $ cd rtems-source-builder/bare
49    $ ../source-builder/sb-set-builder --log=log_arm_eabihf \
50        --prefix=$HOME/development/bare --target=arm-eabihf lang/gcc491
51    RTEMS Source Builder - Set Builder, v0.3.0
52    Build Set: lang/gcc491
53    config: devel/expat-2.1.0-1.cfg
54    package: expat-2.1.0-x86_64-apple-darwin13.2.0-1
55    building: expat-2.1.0-x86_64-apple-darwin13.2.0-1
56    config: devel/binutils-2.24-1.cfg
57    package: arm-eabihf-binutils-2.24-1
58    building: arm-eabihf-binutils-2.24-1
59    config: devel/gcc-4.9.1-newlib-2.1.0-1.cfg
60    package: arm-eabihf-gcc-4.9.1-newlib-2.1.0-1
61    building: arm-eabihf-gcc-4.9.1-newlib-2.1.0-1
62    config: devel/gdb-7.7-1.cfg
63    package: arm-eabihf-gdb-7.7-1
64    building: arm-eabihf-gdb-7.7-1
65    installing: expat-2.1.0-x86_64-apple-darwin13.2.0-1 -> /Users/chris/development/bare
66    installing: arm-eabihf-binutils-2.24-1 -> /Users/chris/development/bare
67    installing: arm-eabihf-gcc-4.9.1-newlib-2.1.0-1 -> /Users/chris/development/bare
68    installing: arm-eabihf-gdb-7.7-1 -> /Users/chris/development/bare
69    cleaning: expat-2.1.0-x86_64-apple-darwin13.2.0-1
70    cleaning: arm-eabihf-binutils-2.24-1
71    cleaning: arm-eabihf-gcc-4.9.1-newlib-2.1.0-1
72    cleaning: arm-eabihf-gdb-7.7-1
73
74RTEMS
75-----
76
77The RTEMS Configurations found in the ``rtems`` directory. The configurations
78are grouped by RTEMS version. In RTEMS the tools are specific to a specific
79version because of variations between Newlib and RTEMS. Restructuring in RTEMS
80and Newlib sometimes moves *libc* functionality between these two parts and
81this makes existing tools incompatible with RTEMS.
82
83RTEMS allows architectures to have different tool versions and patches. The
84large number of architectures RTEMS supports can make it difficult to get a
85common stable version of all the packages. An architecture may require a recent
86GCC because an existing bug has been fixed, however the more recent version may
87have a bug in other architecture. Architecture specific patches should be
88limited to the architecture it relates to. The patch may fix a problem on the
89effect architecture however it could introduce a problem in another
90architecture. Limit exposure limits any possible crosstalk between
91architectures.
92
93If you are building a released version of RTEMS the release RTEMS tar file will
94be downloaded and built as part of the build process. If you are building a
95tool set for use with the development branch of RTEMS, the development branch
96will be cloned directly from the RTEMS GIT repository and built.
97
98When building RTEMS within the RTEMS Source Builder it needs a suitable working
99``autoconf`` and ``automake``. These packages need to built and installed in their
100prefix in order for them to work. The RTEMS Source Builder installs all
101packages only after they have been built so if you host does not have a
102recent enough version of ``autoconf`` and ``automake`` you first need to build them
103and install them then build your tool set. The commands are::
104
105    $ ../source-builder/sb-set-builder --log=l-4.11-at.txt \
106       --prefix=$HOME/development/rtems/4.11 4.11/rtems-autotools
107    $ export PATH=~/development/rtems/4.11/bin:$PATH    <1>
108    $ ../source-builder/sb-set-builder --log=l-4.11-sparc.txt \
109       --prefix=$HOME/development/rtems/4.11 4.11/rtems-sparc
110
111.. topic:: Items:
112
113  1. Setting the path.
114
115If this is your first time building the tools and RTEMS it pays to add the
116``--dry-run`` option. This will run through all the configuration files and if
117any checks fail you will see this quickly rather than waiting for until the
118build fails a check.
119
120To build snapshots for testing purposes you use the available macro maps
121passing them on the command line using the ``--macros`` option. For RTEMS these
122are held in ``config/snapshots`` directory. The following builds *newlib* from
123CVS::
124
125    $ ../source-builder/sb-set-builder --log=l-4.11-sparc.txt \
126       --prefix=$HOME/development/rtems/4.11 \
127       --macros=snapshots/newlib-head.mc \
128       4.11/rtems-sparc
129
130and the following uses the version control heads for ``binutils``, ``gcc``,
131``newlib``, ``gdb`` and *RTEMS*::
132
133    $ ../source-builder/sb-set-builder --log=l-heads-sparc.txt \
134       --prefix=$HOME/development/rtems/4.11-head \
135       --macros=snapshots/binutils-gcc-newlib-gdb-head.mc \
136       4.11/rtems-sparc
137
138Patches
139-------
140
141Packages being built by the RSB need patches from time to time and the RSB
142supports patching upstream packages. The patches are held in a seperate
143directory called ``patches`` relative to the configuration directory you are
144building. For example ``%{_topdir}/patches:%{_sbdir}/patches``. Patches are
145declared in the configuration files in a similar manner to the package's source
146so please refer to the ``%source`` documentation. Patches, like the source, are
147to be made publically available for configurations that live in the RSB package
148and are downloaded on demand.
149
150If a package has a patch management tool it is recommended you reference the
151package's patch management tools directly. If the RSB does not support the
152specific patch manage tool please contact the mailing list to see if support
153can be added.
154
155Patches for packages developed by the RTEMS project can be placed in the RTEMS
156Tools Git repository. The ``tools`` directory in the repository has various
157places a patch can live. The tree is broken down in RTEMS releases and then
158tools within that release. If the package is not specific to any release the
159patch can be added closer to the top under the package's name. Patches to fix
160specific tool related issues for a specific architecture should be grouped
161under the specific architecture and only applied when building that
162architecture avoiding a patch breaking an uneffected architecture.
163
164Patches in the RTEMS Tools repository need to be submitted to the upstream
165project. It should not be a clearing house for patches that will not be
166accepted upstream.
167
168Patches are added to a component's name and in the ``%prep:`` section the
169patches can be set up, meaning they are applied to source. The patches
170are applied in the order they are added. If there is a dependency make
171sure you order the patches correctly when you add them. You can add any
172number of patches and the RSB will handle them efficently.
173
174Patches can have options. These are added before the patch URL. If no options
175are provided the patch's setup default options are used.
176
177Patches can be declared in build set up files.
178
179This examples shows how to declare a patch for gdb in the ``lm32`` architecture::
180
181    %patch add <1> gdb <2> %{rtems_gdb_patches}/lm32/gdb-sim-lm32uart.diff <3>
182
183.. topic:: Items:
184
185  1. The patch's ``add`` command.
186
187  2. The group of patches this patch belongs too.
188
189  3. The patch's URL. It is downloaded from here.
190
191Patches require a checksum to avoid a warning. The ``%hash`` directive can be
192used to add a checksum for a patch that is used to verify the patch::
193
194    %hash md5 <1> gdb-sim-lm32uart.diff <2> 77d070878112783292461bd6e7db17fb <3>
195
196.. topic:: Items:
197
198  1. The type of checksum, in the case an MD5 hash.
199
200  2. The patch file the checksum is for.
201
202  3. The MD5 hash.
203
204The patches are applied when a patch ``setup`` command is issued in the
205``%prep:`` section. All patches in the group are applied. To apply the GDB
206patch above use::
207
208    %patch setup <1> gdb <2> -p1 <3>
209
210.. topic:: Items:
211
212  1. The patch's ``setup`` command.
213
214  2. The group of patches to apply.
215
216  3. The patch group's default options. If no option is given with the patch
217     these options are used.
218
219Architecture specific patches live in the architecture build set file isolating
220the patch to that specific architecture. If a patch is common to a tool it
221resides in the RTEMS tools configuration file. Do not place patches for tools
222in the ``source-builder/config`` template configuration files.
223
224To test a patch simply copy it to your local ``patches`` directory. The RSB
225will see the patch is present and will not attempt to download it. Once you are
226happy with the patch submit it to the project and a core developer will review
227it and add it to the RTEMS Tools git repository.  For example, to test a local
228patch for newlib, add the following two lines to the .cfg file in
229``rtems/config/tools/`` that is included by the bset you use:
230
231.. code-block:: auto
232
233    %patch add newlib file://0001-this-is-a-newlib-patch.patch   <1>
234    %hash md5 0001-this-is-a-newlib-patch.diff 77d070878112783292461bd6e7db17fb <2>
235
236.. topic:: Items:
237
238  1. The diff file prepended with ``file://`` to tell RSB this is a local file.
239
240  2. The output from md5sum on the diff file.
Note: See TracBrowser for help on using the repository browser.