summaryrefslogtreecommitdiffstats
path: root/scripts/README
blob: 701d577e4b96a24fc34c9e728219e007ad5dd8aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255

	RPM support for BSPs
	====================

Introduction
------------

Building an rpm requires to have a tar archive of the sources, and a
rpm-spec files specifying the details of building.

To support per bsp rpms, one rpm-spec is used per BSP. 
Instead of writing one rpm-spec for each BSP, I have written a shell script
(mkspec) which generates one *.spec (rtems-<target_alias>-<bsp>.spec) per BSP
bsp from an rpm-spec template (rtems.spec.in).

A second shell script (mkrpms) is a convienience script which invokes a
sequence of building rpms for several bsps.


mkbinutilspec
-------------

mkbinutilspec takes two arguments:

$1 ... the target_alias for binutils RPMs of this toolset

Invoking mkbinutilspec will generate a <target_alias>-binutils.spec either in

    /usr/src/packages/SPECS (SuSE convention) or
    /usr/src/redhat/SPECS (Redhat convention) or
    /usr/src/SPECS

Eg. ./mkbinutilspec sparc-rtems generates

On SuSE-6.2:   /usr/src/packages/SPECS/sparc-rtems-binutils.spec
On RedHat 6.0: /usr/src/redhat/SPECS/sparc-rtems-binutils.spec

mkgccnewlibspec
---------------

mkgccnewlibspec takes two arguments:

$1 ... the target_alias for the gcc/newlib RPMs of this toolset

Invoking mkgccnewlibspec will generate a <target_alias>-gccnewlibs.spec
either in:

    /usr/src/packages/SPECS (SuSE convention) or
    /usr/src/redhat/SPECS (Redhat convention) or
    /usr/src/SPECS

Eg. ./mkgccnewlibspec sparc-rtems generates

On SuSE-6.2:   /usr/src/packages/SPECS/sparc-rtems-gcc_newlib.spec
On RedHat 6.0: /usr/src/redhat/SPECS/sparc-rtems-gcc_newlib.spec

mkgdbspec
---------

mkgdbspec takes two arguments:

$1 ... the target_alias for the gdb RPMs of this toolset

Invoking mkgdbspec will generate a <target_alias>-gdb.spec
either in:

    /usr/src/packages/SPECS (SuSE convention) or
    /usr/src/redhat/SPECS (Redhat convention) or
    /usr/src/SPECS

Eg. ./mkgdbspec sparc-rtems generates

On SuSE-6.2:   /usr/src/packages/SPECS/sparc-rtems-gcc_newlib.spec
On RedHat 6.0: /usr/src/redhat/SPECS/sparc-rtems-gcc_newlib.spec


# XXX BSPs not tested yet by Joel
#
#  mkbspspec
#  ---------
#  
#  mkbspspec takes two arguments: 
#  $1 ... the target_alias this bsp belongs to
#  $2 ... the bsp to be built
#  
#  Invoking mkbspspec will generate a rtems-<target_alias>-<bsp>.spec either in
#  /usr/src/packages/SPECS (SuSE convention) or 
#  /usr/src/redhat/SPECS (Redhat convention) or
#  /usr/src/SPECS
#  
#  Eg. ./mkspec gensh1 sh-rtemself generates
#  /usr/src/packages/SPECS/rtems-sh-rtemself-gensh1.spec on SuSE-6.2.

mkspec
---------

mkspec takes two arguments:

$1 ... the target_alias for the RPMs composing this toolset
$2 ... the bsp to be built

Invoking mkspec will generate a set of spec files either in:

    /usr/src/packages/SPECS (SuSE convention) or
    /usr/src/redhat/SPECS (Redhat convention) or
    /usr/src/SPECS

Eg. ./mkspec sparc-rtems erc32 generates

On SuSE-6.2:   /usr/src/packages/SPECS/sparc-rtems-binutils.spec
               /usr/src/packages/SPECS/sparc-rtems-gcc_newlib.spec
               /usr/src/packages/SPECS/sparc-rtems-gdb.spec
On RedHat 6.0: /usr/src/packages/SPECS/sparc-rtems-binutils.spec
               /usr/src/packages/SPECS/sparc-rtems-gcc_newlib.spec
               /usr/src/packages/SPECS/sparc-rtems-gdb.spec


Building binutils-rpms
----------------------

0. Login as root.

1. Install a tarball of the various tool sources (with the
version number attached!) to /usr/src/[packages|redhat]/SOURCES

  cd /usr/src/[packages|redhat]/SOURCES
  cp .../binutils-<VERSION>  .
  cp .../binutils-<VERSION>-rtems-<DATE>.diff  .

2. Generate and install the required rpm-spec file[s]

cd rtems-<VERSION>/scripts/
mkbinutilspec <target_alias>

where target_alias is of the form sparc-rtems or sh-rtems-elf.

3. Build the rpms 

Building a binary rpm:

rpm -bb /usr/src/[packages|redhat]/SPECS/rtems-<target_alias>-binutils.spec

Building a source and binary rpm
rpm -ba /usr/src/[packages|redhat]/SPECS/rtems-<target_alias>-binutils.spec

XXX Note: a BSP's src.rpm contains its spec-file and the tar-archive of the
sources (approx. 4-5MB per BSP).

Building TOOL-rpms
------------------

0. Login as root.

1. Install a tarball of the various tool sources (with the
version number attached!) to /usr/src/[packages|redhat]/SOURCES

  cd /usr/src/[packages|redhat]/SOURCES
  cp .../binutils-<VERSION>  .
  cp .../gcc-<VERSION>       .
  cp .../newlib-<VERSION>    .

2. Generate and install the required rpm-spec file[s]

cd rtems-<VERSION>/scripts/
mktoolspec <target_alias>

3. Build the rpms

Building a binary rpm:
rpm -bb /usr/src/[packages|redhat]/SPECS/rtems-<target_alias>.spec

Building a source and binary rpm
rpm -ba /usr/src/[packages|redhat]/SPECS/rtems-<target_alias>.spec

XXX Note: a BSP's src.rpm contains its spec-file and the tar-archive of the
sources (approx. 4-5MB per BSP). 

Building BSP-rpms
-----------------

0. Login as root.

1. Install a tarball of RTEMS's sources (with version number attached!) to
/usr/src/[packages|redhat]/SOURCES
Eg. 
tar czvf /usr/src/packages/SOURCES/rtems-<VERSION>.tar.gz rtems-<VERSION>

2. Generate and install the required rpm-spec file[s]
cd rtems-<VERSION>/scripts/
mkspec <bsp> <target_alias>

3. Build the rpms
Building a binary rpm:
rpm -bb /usr/src/[packages|redhat]/SPECS/rtems-<target_alias>-<bsp>.spec

Building a source and binary rpm
rpm -ba /usr/src/[packages|redhat]/SPECS/rtems-<target_alias>-<bsp>.spec

Note: a BSP's src.rpm contains its spec-file and the tar-archive of the
sources (approx. 4-5MB per BSP). 

Canadian Cross RPMS
-------------------
Normally one uses a GNU/Linux host computer to produce RPMs that are
to be installed and run on another GNU/Linux host computer.  When
building Canadian Cross RPMs, we build *-rtems tools that are to be
installed on a non-GNU/Linux host.  

To build cygwin-rpms on a GNU/Linux host, you will to have a GNU/Linux ->
i386-cygwin cross-toolset installed and in your PATH before executing the
following commands:

  cd scripts
  ./configure --build=`../config.guess` --host=i386-cygwin \
    --target=<target>
  make
  rpm --target=<i386-cygwin> -b[b|a] binutils/<target>-....spec

Known Bugs/Deficiencies
-----------------------

* All files mentioned in here are in its early infancy ;-)

* Building for a single bsp requires an own copy of the source tree inside
rpm's build directory.
* Building inside the RTEMS source tree doesn't work.
* Dependencies on toolchain-rpms not yet supported in rtems.spec.in.
* Installing multiple binary bsp rpms for the same target can cause 
warnings from rpm, because these bsp-rpms share files.
* rtems.spec.in is prepared for rpm relocation support, but RTEMS is not
relocatible (yet?)
* rtems.spec.in deserves to be extended (description, authors etc)
* The final packaging stage to build a binary rpm takes an awful lot of
time - deserves to be investigated.
* Some RTEMS's cross executables (eg. hello.exe for sparc-rtems/erc32) cause 
warnings from rpm and/or objdump. AFAIS, this is a bug in rpm.
* Probably many more ...

* Last but not least: RTEMS should be split.

Remarks
-------
* It would make sense to split RTEMS host/cross-tools and files depending on
the target only (<target_alias>/make/*.cfg -- Whow, RTEMS really has files 
which depend on the target only :) into separate rpms.
* Instead of using a single rpm-spec for each bsp, RTEMS could also use a
single rpm-spec for all (or at least a given subset of all) bsps of a target.
* rpm -b[b|a] leaves its built trees unpacked in 
/usr/src/[packages|redhat]/BUILD. Therefore you will rather soon run out of disc
space if not removing them. (Use rpm --clean -b[a|b] for cleaning them up 
automatically after building) 
* The size of binary rpms can differ up to one magnitude depending on the
target/bsp (eg. sh-rtems/gensh1 ~10MB vs. sh-rtemself/gensh1 ~32MB) 

Ralf Corsepius, 1999/10/14