-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL
411 lines (302 loc) · 12.7 KB
/
INSTALL
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
BUILDING AND INSTALLATION HINTS FOR CEXP
For building Cexp you will need the
following programs and libraries:
Tools:
------
- usual (cross) compiler toolchain
- GNU bison (yacc is not enough).
NOTE: bison is only required if you
change the grammar 'cexp.y'
Libraries:
----------
- OPTIONAL: libbfd, libopcodes, libiberty (from binutils vers. 2.18 or 2.23)
- Spencer's libregexp (distributed with Cexp). This is a modified,
_reentrant_ version.
- libtecla: clean & lean & reentrant line editor. I like it much
better than GNU readline (messy, bloated & non-reentrant). Its
license (X11) is less restrictive than readline's (GPL)
NOTE: the version distributed with Cexp has been slightly
patched to support RTEMS.
- alternatively: GNU libreadline, which in turn requires
libncurses or libtermcap. NOTE: libreadline is _not_ reentrant
and hence should _NOT_ be used on RTEMS (unless you have
one single thread using it) - I recommend using TECLA: it's smaller
and nicer. Also, CEXP has command completion implemented for
TECLA.
Building:
---------
Quick/Automated Method
----------------------
The build system uses the well-known GNU 'configure' method.
a) Host Demo
mkdir build-host
cd build-host
../configure
make
for building the host demo in a 'build-host' subdirectory. Both,
a 'cexp' demo executable and a 'xsyms' utility program (for
generating a symbol file in host format) are built there. To
play with the demo:
cd build-host
./xsyms cexp cexp.sym
./cexp -s ./cexp.sym
Note that the symbol table is like any other object file
searched for using the PATH environment variable. E.g., if
'.' is not in your PATH you must specify the path to cexp.sym
explicitly (-s ./cexp.sym; just '-s cexp.sym' only works if
'.' is in your PATH).
b) Build Cexp target library and cross xsyms tool for a specific
RTEMS BSP
mkdir build-mvme3100
cd build-mvme3100
../configure --with-rtems-top=/path/to/rtems --host=powerpc-rtems
make
NOTES:
* point '--with-rtems-top' to RTEMS' 'PROJECT_ROOT', i.e., the
directory where RTEMS' '<cpu>-rtems' and 'make' directories
are found.
* cross tools must be found in PATH
* will build for all BSPs found under <with-rtems-top>/<host-cpu>-rtems/
but you can restrict the BSPs built using --enable-rtemsbsp='bsp1 bsp2'
* if no '--host' option is given (but the build system 'knows'
that the host system is RTEMS because of the --with-rtems-top option)
then all BSPs for all architectures found under <with-rtems-top>
are configured. It is possible to build for a subset of BSPs
simply by listing them in --with-rtemsbsp -- the BSPs need not
belong to the same host architecture (but if --host is given
then they do).
Build cross xsyms tool:
mkdir build-xsyms
cd build-xsyms
../configure --disable-cexp --target=powerpc-rtems
make
c) Build CEXP multilibs. Note that this requires a multilibbed
RTEMS cpukit.
mkdir build-powerpc-rtems
cd build-powerpc-rtems
../configure --with-rtems-top=/path/to/rtems --host=powerpc-rtems --enable-multilib
make
Manual Method in Detail
----------------------
Configuring Cexp:
- - - - - - - - -
chdir to the source topdir and make a directory, e.g.
mkdir build-i386-linux
chdir to the new directory and issue
../configure
This configures Cexp so that a native demo program is built
which can be executed on the host (e.g., linux) system.
When doing a 'cross-build' (e.g. for RTEMS), you need to
specify the host architecture on which Cexp shall be executed.
Also, you must point the configure script to your RTEMS
installation, i.e., the directory where the target libraries
are located under "<cpu>-rtems/<bsp>/lib/". This is usually
/opt/rtems-<version>
../configure --host=powerpc-rtems --with-rtems-top=/opt/rtems-4.9.0
This builds Cexp for all installed BSP's of the 'powerpc-rtems'
architecture. You may restrict the list of BSPs by using the
--enable-rtemsbsp='bsp1 bsp2 bsp3' option.
The configure script recognizes several other options:
--help list known options.
--disable-nls
disable native language support.
--disable-bfd
use pmbfd instead of libbfd (only relevant if you
have BFD sources installed).
--disable-loader
disable the run-time loader. An ELF symbol file
can still be read. If you disable both, the loader AND
pmbfd (--disable-loader --disable-pmbfd) then all support
for reading files is removed. You must create, compile
and link a 'built-in' symbol table in this case.
On systems with a dynamic linker (linux) this enables
support for reading dynamic symbols from the executable
and all dependent shared libraries (!).
--disable-opcodes
don't use the opcodes library. This removes the
disassembler. This option is only relevant if you
have BFD sources installed.
--disable-tecla
don't use the TECLA library (discouraged)
--disable-readline
don't use GNU readline either (this option is only
effective if --disable-tecla is also specified)
If both, TECLA and readline are disabled then a minimal
built-in editor is used.
--enable-multilib
Build all variants the compiler knows about.
Contrary to the help text multilibs are NOT enabled by
default. Also, since binutils is not multilib-capable
multilib support is only available if BFD is not used.
(pmbfd can be multilibbed).
NOTE: multilibs can only be built if RTEMS' cpukit
was built with multilibs enabled.
--prefix=<path>
Top directory under which everything gets installed
(libraries, headers, documentation etc.).
--exec-prefix-<path>
Prefix for libraries, executables and (by default)
headers. Default:
PREFIX/target/ssrlApps/${host_cpu}-rtems/${rtems_bsp}/
--libdir
Where the libraries are to be installed. Defaults to
EPREFIX/lib
--includedir
Where headers are to be installed. Defaults to
EPREFIX/include
--bindir
Where executables are to be installed. Defaults to
EPREFIX/bin
--enable-std-rtems-installdirs
Install directly into the RTEMS installation directories;
by default a location *outside* of the standard location
is used. If you don't use this option you can also fine-tune
the installation using the usual --prefix, --exec-prefix,
--libdir, --includedir etc. options. If you use this
option '--prefix' & friends are effectively overridden.
--with-hostbindir=<path>
Where tools, i.e., programs that execute on the development
platform are to be installed. Defaults to
PREFIX/host/${build_alias}/bin
--enable-text-segment= yes | no | 0 | <size>
Define how memory for PowerPC text segments is to be
set aside (ignored on other platforms). Consult the
README ('PowerPC Branch Relocation Information') for
more information about this option.
--enable-pthreads
Configure for thread-safe cexpsh on platforms which
support pthreads. THIS IS NOT NEEDED UNDER RTEMS.
Under RTEMS cexp is always thread-safe but it uses
native RTEMS semaphores etc.
Configuring Cexp using the GNU BFD library
- - - - - - - - - - - - - - - - - - - - - -
By default, Cexp now uses the 'poor man's bfd and elf'
libraries as a replacement for the GNU BFD library
but you can still use the GNU BFD library. The main
reason for using BFD would be the desire to use Cexp
on a target that is unsupported by pmbfd (however,
for any ELF target you are encouraged to implement
relocations and contribute the code to Cexp).
Also, if you want to use the disassembler then you need
to install the BFD/opcodes libraries (note that you may
use opcodes with pmbfd yielding a smaller executable).
In order to use BFD, opcodes or both you need to
perform the following steps:
a) download binutils-2.23 (or older 2.18) source
b) untar and install the source into the 'cexp' source directory
c) create a symlink binutils -> binutils-2.23 (or binutils-2.18)
d) *patch* the binutils-2.23 (or 2.18) sources running
patch -b -p0 < binutils-2.23.diff
from the cexp source directory (it is always a good idea
to try '--dry-run' first).
e) *remove* unnecessary source directories (later stages in
the build may fail if this step is omitted)
rm -rf binutils/ ld/ gprof/ gold/ gas/ elfcpp/ intl/
f) configure and make cexp in the usual way. Note that
by default both the BFD and opcodes libraries are
configured and used if 'configure' finds binutils
sources in the cexp source dir.
The following 'configure' options are relevant if
you have binutils sources available:
--disable-bfd
do NOT use BFD but use pmbfd. By default
BFD is used if binutils sources are found.
--disable-opcodes
Disable disassembler support.
E.g., if you want to configure Cexp to use pmbfd
and and opcodes (for disassembler support) then say
--disable-bfd
Building Cexp :
- - - - - - - -
Recommendation: start with a native build (e.g. on linux or solaris) and
play around with the demo.
In the directory where you configured 'cexp', issue
make
this builds the object file interface librarie(s) (libbfd, libopcode, libiberty
or libpmbfd/libpmelf), the tecla library, the regexp library, the cexp
library and (on a host only) the 'cexp' demo program and the 'xsyms' utility.
Building xsyms:
- - - - - - - -
'xsyms' is a 'cross-tool', i.e. it runs on a host working on target object
files. Hence, if you want 'libcexp' for a target and the 'xsyms' tool for
generating symbol tables you must build the package twice:
- a cross-configuration
'../configure --with-rtems-top=<path> --host=<cpu>-rtems'
will generate 'libcexp' for running 'cexp' on the target.
E.g.,
mkdir build-powerpc-rtems
cd build-powerpc-rtems
../configure --with-rtems-top=/opt/rtems --prefix=/opt/rtems --host=powerpc-rtems
make
make install
- a cross-tool-configuration
'../configure --target=<cpu>-rtems --disable-cexp'
will generate 'xsyms' which can be used for extracting symbol tables on
target-objects. E.g.,
mkdir build-X-powerpc-rtems
cd build-X-powerpc-rtems
../configure --build=i386-linux26 --target=powerpc-rtems --disable-cexp --prefix=/opt/rtems
make
make install
Note: 'xsyms' is installed in the 'hostbindir' (see --with-hostbindir
above) in this example the executable will be installed as
/opt/rtems/host/i386-linux26/bin/powerpc-rtems-xsyms
[
- a native configuration ('configure') builds 'libcexp' as well
as the 'cexp' demo and 'xsyms'. The demo can be run on the host and
'xsyms' can extract its symbol table ('xsyms cexp cexp.sym').
]
Running the Cexp Demo on a Host
- - - - - - - - - - - - - - - -
Invoke the executable telling it to read symbols from the executable
file:
./cexp -s ./cexp
You now can type expressions etc. See 'README' for details about using
CEXP.
On some systems you may get errors 'libtecla-1.4.1.so not found' or
similar. In this case, libtecla was built as a shared library but not
installed into one of the directories searched by the (system's)
runtime linker. Use the LD_LIBRARY_PATH environment variable and set
it to point to the directory where libtecla was built.
Linking an Application (Library Dependencies)
---------------------------------------------
Consult the README for important information about how to produce
auxiliary files that force linkage of essential std library code.
Here we only document the library dependencies: In order to use
Cexp, your application needs to link
-lcexp -lspencer_regexp
if NOT configured with --disable-tecla then add
-ltecla_r
if binutils sources are available and Cexp was NOT configured
with --disable-opcodes then add
-lopcodes
if NOT configured with --disable-loader then add
EITHER (binutils sources not installed or --disable-bfd given)
-lpmbfd -lpmelf
OR (binutils sources available and --disable-bfd NOT given)
-lbfd
else (i.e., --disable-loader *was* given)
if --disable-elfsyms was NOT given then add
-lpmelf
Finally, if you end up using either -lbfd or -lopcodes (or both)
then you also need to add
-liberty
Tested Configurations:
----------------------
- linux-x86
- linux-ppc
- solaris-sparc
- RTEMS-mvme23xx (PowerPC 604)
- RTEMS-svgm (PowerPC 750 and 7400)
- RTEMS-mvme5500
- RTEMS-beatnik (mvme5500, mvme6100)
- RTEMS-mvme2100
- RTEMS-mvme3100
- ML405 (virtex)
- RTEMS-pc586
- RTEMS-mvme167
- RTEMS-uC5282
Installing Cexp:
- - - - - - - - -
'make install' should do the job. Choose the prefixes or
--enable-std-rtems-installdirs to meet your needs.