1
<?xml version="1.0" encoding="latin1" ?>
2
<!DOCTYPE chapter SYSTEM "chapter.dtd">
7
<year>1996</year><year>2009</year>
8
<holder>Ericsson AB. All Rights Reserved.</holder>
11
The contents of this file are subject to the Erlang Public License,
12
Version 1.1, (the "License"); you may not use this file except in
13
compliance with the License. You should have received a copy of the
14
Erlang Public License along with this software. If not, it can be
15
retrieved online at http://www.erlang.org/.
17
Software distributed under the License is distributed on an "AS IS"
18
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
19
the License for the specific language governing rights and limitations
24
<title>Installation of Embedded Environment</title>
25
<prepared>Peter Högfeldt</prepared>
26
<responsible>Peter Högfeldt</responsible>
28
<approved>(Peter Högfeldt</approved>
30
<date>1997-05-26</date>
32
<file>target.sgml</file>
34
<p>This chapter is about installing a Embedded Environment. Solaris
35
2.5.1 is the only UNIX operating system supported for embedded systems.
36
The following topics are considered,</p>
37
<list type="bulleted">
39
<p>Creation of user and installation directory,</p>
42
<p>Installation of Embedded Environment,</p>
45
<p>Configuration for automatic start at reboot,</p>
48
<p>Making a hardware watchdog available,</p>
51
<p>Changing permission for reboot,</p>
54
<p>Patches for Solaris 2.5.1,</p>
57
<p>Configuration of the os_mon application.</p>
60
<p>Several of the procedures described below require expert knowledge of
61
the Solaris 2 operating system. For most of them super user privilege is
65
<title>Creation of user and installation directory</title>
66
<p>It is recommended that the Embedded Environment is run by an ordinary
67
user, i.e. a user which does not have super user privileges. </p>
68
<p>Throughout this chapter we assume that the user name is <c>otpuser</c>,
69
and that the home directory of that user is,</p>
71
/export/home/otpuser </pre>
72
<p>Furthermore, we assume that in the home directory of <c>otpuser</c>,
73
there is a directory named <c>otp</c>, the full path of which is,</p>
75
/export/home/otpuser/otp </pre>
76
<p>This directory is the <em>installation directory</em> of the Embedded
81
<title>Installation of Embedded Environment</title>
82
<p>The procedure for installation of a Embedded Environment does not differ
83
from that of a Development Environment (see the chapter <em>Installation of Development Environment</em>), except for the following,</p>
84
<list type="bulleted">
86
<p>the (compressed) tape archive file should be extracted in
87
the installation directory as defined above, and,</p>
90
<p>there is no need to link the start script to a standard directory
91
like <c>/usr/local/bin</c>.</p>
94
<p>The details for extracting the tape archive file is not repeated here.</p>
98
<title>Configuration for Automatic Start at Boot</title>
99
<p>A true Embedded Environment has to start when the system boots. This
100
section accounts for the necessary configurations needed to achieve
102
<p>The embedded environment and all the applications will start automatically
103
if the script file shown below is added to the <c>/etc/rc3.d</c> directory.
104
The file must be owned and readable by <c>root</c>, and its name cannot
105
be arbitrarily assigned. The following name is recommended,</p>
108
<p>For further details on initialization (and termination) scripts, and
109
naming thereof, see the file <c>/etc/init.d/README</c> on a Solaris
114
# File name: S75otp.system
115
# Purpose: Automatically starts Erlang and applications when the
117
# Author: janne@erlang.ericsson.se
118
# Resides in: /etc/rc3.d
122
then # /usr not mounted
126
killproc() { # kill the named process(es)
127
pid=`/usr/bin/ps -e |
128
/usr/bin/grep -w $1 |
129
/usr/bin/sed -e 's/^ *//' -e 's/ .*//'`
130
[ "$pid" != "" ] && kill $pid
133
# Start/stop processes required for Erlang
137
# Start the Erlang emulator
139
su - otpuser -c "/export/home/otpuser/otp/bin/start" &
145
echo "Usage: $0 { start | stop }"
148
<p>The file <c>/export/home/otpuser/otp/bin/start</c> referred to in the
149
above script, is precisely the script <c>start</c> described in the next
150
chapter of this guide, <em>Starting an Embedded System</em>. The script
151
variable <c>OTP_ROOT</c> in that <c>start</c> script corresponds to
152
the example path </p>
154
/export/home/otpuser/otp </pre>
155
<p>used in this section. The <c>start</c> script should be edited
157
<p>Use of the <c>killproc</c> procedure in the above script could
158
be combined with a call to <c>erl_call</c>, e.g.</p>
160
$SOME_PATH/erl_call -n Node init stop </pre>
161
<p>in order to take Erlang down gracefully (see the <c>erl_call(1)</c>
162
reference manual page for further details on the use of <c>erl_call</c>).
163
That however requires that Erlang runs as a distributed node which is
164
not always the case.</p>
165
<p>The <c>killproc</c> procedure should not be removed: the purpose is
166
here to move from run level 3 (multi-user mode with networking resources)
167
to run level 2 (multi-user mode without such resources), in which Erlang
172
<title>Hardware Watchdog</title>
173
<p>For Solaris 2.5.1 running on VME boards from Force Computers, there
174
is a possibility to activate the onboard hardware watchdog, provided a
175
VME bus driver is added to the operating system. For further details
176
see the <em>Embedded Systems</em> documentation.</p>
177
<p>See also the <c>heart(3)</c> reference manual page in <em>Kernel</em>.</p>
181
<title>Changing permissions for reboot</title>
182
<p>If the <c>HEART_COMMAND</c> environment variable is to be set in
183
the <c>start</c> script of the next chapter, <em>Starting an Embedded System</em>, and if the value shall be set to the path of the Solaris
184
<c>reboot</c> command, i.e.</p>
186
HEART_COMMAND=/usr/sbin/reboot </pre>
187
<p>the ownership and file permissions for <c>/usr/sbin/reboot</c> must
188
be changed as follows,</p>
190
chown 0 /usr/sbin/reboot
191
chmod 4755 /usr/sbin/reboot </pre>
192
<p>See also the <c>heart(3)</c> reference manual page in <em>Kernel</em>.</p>
196
<title>The TERM environment variable</title>
197
<p>When the Erlang runtime system is automatically started from the
198
<c>S75otp.system</c> script the <c>TERM</c> environment variable
199
has to be set. The following is a minimal setting,</p>
202
<p>which should be added to the <c>start</c> script described in the
207
<title>Patches for Solaris 2.5.1</title>
208
<p>For proper functioning of flushing file system data to disk, the
209
Solaris 2.5.1 specific patch with number 103640-02 must be added
210
to the operating system.</p>
214
<title>Installation of module os_sup in application os_mon</title>
215
<p>The following four installation procedures requires superuser privilege.</p>
218
<title>Installation</title>
219
<list type="ordered">
221
<p><em>Make a copy the Solaris standard configuration file for syslogd.</em></p>
222
<list type="bulleted">
224
<p>Make a copy the Solaris standard configuration file for syslogd.
225
This file is usually named <c>syslog.conf</c> and found in the <c>/etc</c>
229
<p>The file name of the copy must be <c>syslog.conf.ORIG</c> but the
230
directory location is optional. Usually it is <c>/etc</c>.
232
<p>A simple way to do this is to issue the command</p>
234
cp /etc/syslog.conf /etc/syslog.conf.ORIG</code>
239
<p><em>Make an Erlang specific configuration file for syslogd.</em></p>
240
<list type="bulleted">
242
<p>Make an edited copy of the back-up copy previously made.</p>
245
<p>The file name must be <c>syslog.conf.OTP</c> and the path
246
must be the same as the back-up copy.</p>
249
<p>The format of the configuration file is found in the man page for
250
<c>syslog.conf(5)</c>, by issuing the command <c>man syslog.conf</c>.</p>
253
<p>Usually a line is added which should state:</p>
254
<list type="bulleted">
256
<p>which types of information that will be supervised by Erlang,</p>
259
<p>the name of the file (actually a named pipe) that should receive
265
<p>If e.g. only information originating from the unix-kernel should
266
be supervised, the line should begin with <c>kern.LEVEL</c> (for the
267
possible values of <c>LEVEL</c> see <c>syslog.conf(5)</c>).</p>
270
<p>After at least one tab-character, the line added should contain
271
the full name of the named pipe where syslogd writes its information. The
272
path must be the same as for the <c>syslog.conf.ORIG</c> and
273
<c>syslog.conf.OTP</c> files. The file name must be <c>syslog.otp</c>.</p>
276
<p>If the directory for the <c>syslog.conf.ORIG</c> and
277
<c>syslog.conf.OTP</c> files is <c>/etc</c> the line in
278
<c>syslog.conf.OTP</c> will look like:</p>
280
kern.LEVEL /etc/syslog.otp </code>
285
<p><em>Check the file privileges of the configuration files.</em></p>
286
<list type="bulleted">
288
<p>The configuration files should have <c>rw-r--r--</c> file
289
privileges and be owned by root.</p>
292
<p>A simple way to do this is to issue the commands</p>
294
chmod 644 /etc/syslog.conf
295
chmod 644 /etc/syslog.conf.ORIG
296
chmod 644 /etc/syslog.conf.OTP </code>
299
<p><em>Note:</em> If the <c>syslog.conf.ORIG</c> and
300
<c>syslog.conf.OTP</c> files are not in the <c>/etc</c> directory,
301
the file path in the second and third command must be modified.</p>
306
<p><em>Modify file privileges and ownership of the mod_syslog utility.</em></p>
307
<list type="bulleted">
309
<p>The file privileges and ownership of the <c>mod_syslog</c> utility
310
must be modified.</p>
313
<p>The full name of the binary executable file is derived from the
314
position of the <c>os_mon</c> application if the file system by adding
315
<c>/priv/bin/mod_syslog</c>. The generic full name of the binary executable
317
<code type="none"><![CDATA[
318
<OTP_ROOT>/lib/os_mon-<rev>/priv/bin/mod_syslog ]]></code>
319
<p><em>Example:</em> If the path to the otp-root is
320
<c>/usr/otp</c>, thus the path to the <c>os_mon</c> application is
321
<c>/usr/otp/lib/os_mon-1.0</c> (assuming revision 1.0) and the full name
322
of the binary executable file is
323
<c>/usr/otp/lib/os_mon-1.0/priv/bin/mod_syslog</c>.</p>
326
<p>The binary executable file must be owned by root, have
327
<c>rwsr-xr-x</c> file privileges, in particular the setuid bit of
328
user must be set.</p>
331
<p>A simple way to do this is to issue the commands</p>
332
<code type="none"><![CDATA[
333
cd <OTP_ROOT>/lib/os_mon-<rev>/priv/bin/mod_syslog
334
chmod 4755 mod_syslog
335
chown root mod_syslog ]]></code>
343
<title>Testing the application configuration file</title>
344
<p>The following procedure does not require root privilege.</p>
345
<list type="bulleted">
347
<p>Ensure that the configuration parameters for the <c>os_sup</c>
348
module in the <c>os_mon</c> application are correct.</p>
351
<p>Browse the application configuration file (do <em>not</em> edit
352
it). The full name of the application configuration file is derived
353
from the position of the os_mon-application if the file system by adding
354
<c>/ebin/os_mon.app</c>.</p>
355
<p>The generic full name of the file is thus</p>
356
<code type="none"><![CDATA[
357
<OTP_ROOT>/lib/os_mon-<rev>/ebin/os_mon.app. ]]></code>
358
<p><em>Example:</em> If the path to the otp-root is <c>/usr/otp</c>,
359
thus the path to the <c>os_mon</c> application is <c>/usr/otp/lib/os_mon-1.0</c> (assuming revision 1.0) and the full name of the binary executable file
360
is <c>/usr/otp/lib/os_mon-1.0/ebin/os_mon.app</c>.</p>
363
<p>Ensure that the following configuration parameters are bound to
364
the correct values.</p>
369
<cell align="left" valign="top"><em>Parameter</em></cell>
370
<cell align="left" valign="top"><em>Function</em></cell>
371
<cell align="left" valign="top"><em>Standard value</em></cell>
374
<cell align="left" valign="middle">start_os_sup</cell>
375
<cell align="left" valign="middle">Specifies if os_sup will be started or not.</cell>
376
<cell align="left" valign="middle"><c>true</c>for the first instance on the hardware; <c>false</c>for the other instances.</cell>
379
<cell align="left" valign="middle">os_sup_own</cell>
380
<cell align="left" valign="middle">The directory for (1)the back-up copy, (2) the Erlang specific configuration file for syslogd.</cell>
381
<cell align="left" valign="middle"><c>"/etc"</c></cell>
384
<cell align="left" valign="middle">os_sup_syslogconf</cell>
385
<cell align="left" valign="middle">The full name for the Solaris standard configuration file for syslogd </cell>
386
<cell align="left" valign="middle"><c>"/etc/syslog.conf"</c></cell>
389
<cell align="left" valign="middle">error_tag</cell>
390
<cell align="left" valign="middle">The tag for the messages that are sent to the error logger in the Erlang runtime system.</cell>
391
<cell align="left" valign="middle"><c>std_error</c></cell>
393
<tcaption>Configuration Parameters</tcaption>
395
<p>If the values listed in the <c>os_mon.app</c> does not suite your
396
needs, you should <c>not</c> edit that file. Instead you should
397
<em>override</em> values in a <em>system configuration file</em>, the
398
full pathname of which is given on the command line to <c>erl</c>.</p>
399
<p><em>Example:</em> The following is an example of the contents of an
400
application configuration file.</p>
403
[{os_mon, [{start_os_sup, true}, {os_sup_own, "/etc"},
404
{os_sup_syslogconf, "/etc/syslog.conf"}, {os_sup_errortag, std_error}]}]. </pre>
408
<title>Related documents</title>
409
<p>See also the <c>os_mon(3)</c>, <c>application(3)</c> and <c>erl(1)</c>
410
reference manual pages.</p>