source: rtems-docs/rsb/project-sets.rst @ 7cef256

5
Last change on this file since 7cef256 was f95699b, checked in by Sebastian Huber <sebastian.huber@…>, on 01/10/19 at 11:52:25

rsb: Move content of duplicate section

Move "Controlling the Tools Build" section and "Building Tools and
RTEMS" chapter to "Project Sets" chapter and "RTEMS" section.

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