<?xml version="1.0" encoding="latin1" ?>
<!DOCTYPE chapter SYSTEM "chapter.dtd">

<chapter>
  <header>
    <copyright>
      <year>1997</year><year>2009</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      The contents of this file are subject to the Erlang Public License,
      Version 1.1, (the "License"); you may not use this file except in
      compliance with the License. You should have received a copy of the
      Erlang Public License along with this software. If not, it can be
      retrieved online at http://www.erlang.org/.
    
      Software distributed under the License is distributed on an "AS IS"
      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
      the License for the specific language governing rights and limitations
      under the License.
    
    </legalnotice>

    <title>VxWorks</title>
    <prepared>Patrik Winroth</prepared>
    <responsible></responsible>
    <docno></docno>
    <approved></approved>
    <checked></checked>
    <date>2000-10-17</date>
    <rev></rev>
    <file>vxworks.xml</file>
  </header>
  <p>This chapter describes the OS specific parts of OTP which relate
    to VxWorks.
    </p>

  <section>
    <title>Introduction</title>
    <p>The Erlang/OTP distribution for VxWorks is limited to what
      Switchboard requires (Switchboard is a general purpose
      switching hardware developed by Ericsson).
      </p>
    <p>Please consult the README file, included at root level in the
      installation, for latest information on the distribution.
      </p>
  </section>

  <section>
    <title>Memory Usage</title>
    <p>Memory required is 32 Mbyte.
      </p>
  </section>

  <section>
    <title>Disk Usage</title>
    <p>The disk space required is 22 Mbyte, the documentation included.   
      </p>
  </section>

  <section>
    <title>Installation</title>
    <p>OTP/VxWorks is supplied in a distribution file named
      <c><![CDATA[<PREFIX>.tar.gz]]></c>; i.e.  a tar archive that is
      compressed with gzip. <c><![CDATA[<PREFIX>]]></c> represents the
      name of the release,
      e.g. <c>otp_LXA12345_vxworks_cpu32_R42A</c>. Assuming you are
      installing to a Solaris file system, the installation is
      performed by following these steps: &lt;
      </p>
    <p></p>
    <list type="bulleted">
      <item>Change to the directory where you want to install
       OTP/VxWorks (<c><![CDATA[<ROOTDIR>]]></c>): <c><![CDATA[cd <ROOTDIR>]]></c></item>
      <item>Make a directory to put OTP/VxWorks in: <c>mkdir otp_vxworks_cpu32</c> (or whatever you want to call it)</item>
      <item>Change directory to the newly created one: <c>cd otp_vxworks_cpu32</c></item>
      <item>Copy the distribution file there from where it is located
       (<c><![CDATA[<RELDIR>]]></c>): <c><![CDATA[cp <RELDIR>/<PREFIX>.tar.gz .]]></c></item>
      <item>Unzip the distribution file: <c><![CDATA[gunzip <PREFIX>.tar.gz]]></c></item>
      <item>Untar <c><![CDATA[<PREFIX>.tar]]></c>: <c><![CDATA[tar xvf <PREFIX>.tar]]></c></item>
      <item>Create a bin directory: <c>mkdir bin</c></item>
      <item>Copy the VxWorks Erlang/OTP start-up script to the bin directory:
      <c>cp erts-Vsn/bin/erl bin/.</c></item>
      <item>Copy the example start scripts to the bin directory: 
      <c>cp releases/R42A/*.boot bin/.</c></item>
    </list>
    <p>If you use VxWorks nfs mounting facility to mount the Solaris
      file system, this installation may be directly used. An other
      possibility is to copy the installation to a local VxWorks DOS
      file system, from where it is used.
      </p>
  </section>

  <section>
    <title>OS Specific Functionality/Information</title>
    <p>There are a couple of files that are unique to the VxWorks
      distribution of Erlang/OTP, these files are described here.
      </p>
    <list type="bulleted">
      <item>README - this files has some information on VxWorks
       specifics that you are advised to consult. This includes the
       latest information on what parts of OTP are included in the
       VxWorks distribution of Erlang/OTP. If you want us to
       include more parts, please contact us to discuss
       this.</item>
      <item>erts-Vsn/bin/resolv.conf - A resolver configuration EXAMPLE file. 
       You have to edit this file.</item>
      <item>erts-Vsn/bin/erl - This is an EXAMPLE start script for VxWorks.
       You have to edit this file to suit your needs.</item>
      <item>erts-Vsn/bin/erl_io - One possible solution to the problem
       of competing Erlang and VxWorks shell. Contains the function
       'start_erl' called by the erl script. Also contains the
       function 'to_erl' to be used when connecting to the Erlang
       shell from VxWorks' shell.</item>
      <item>erts-Vsn/bin/erl_exec - Rearranges command line arguments
       and starts Erlang.</item>
      <item>erts-Vsn/bin/vxcall - Allows spawning of standard VxWorks
       shell functions (which is just about any function in the
       system...) from open_port/2.  E.g. open_port({spawn, 'vxcall
       func arg1 arg2'}, []) will cause the output that 'func arg1,
       arg2' would have given in the shell to be received from the
       port.</item>
      <item>erts-Vsn/bin/rdate - Set the time from a networked host,
       like the SunOS command.  Nothing Erlang-specific, but nice
       if you want date/0 and time/0 to give meaningful values (you
       also need a TIMEZONE environment setting if GMT isn't
       acceptable).  For example: <c>putenv "TIMEZONE=CET::-60:033002:102603"</c> sets central european
       time.</item>
      <item>erts-Vsn/src - Contains source for the above files, and
       additionally config.c, driver.h, preload.c and
       reclaim.h. Reclaim.h defines the interface to a simple
       mechanism for "resource reclamation" that is part of the
       Erlang runtime system - may be useful to "port program" writers (and
       possibly others). Take careful note of the caveats listed in
       the file!</item>
    </list>
  </section>

  <section>
    <title>Starting Erlang</title>
    <p>Start (and restart) of the system depends on what file system
      is used. To be able to start the system from a nfs mounted
      file system you can use VxWorks start script facility to run a
      start script similar to the example below. Note that the
      Erlang/OTP start-up script is run at the end of this script.
      </p>
    <code type="none"><![CDATA[
#  start.script v1.0 1997/09/08 patrik
#  
#  File name:  start.script 
#  Purpose:    Starting the VxWorks/cpu32 erlang/OTP
#  Author:     patrik@erix.ericsson.se
#  Resides in: ~tornado/wind/target/config/ads360/

#
# Set shell prompt
#
shellPromptSet("sauron-> ")

#
# Set default gateway
#
hostAdd "router-20","150.236.20.251"
routeAdd "0","router-20"

#
# Mount /home from gandalf
#
hostAdd "gandalf","150.236.20.16"
usergroup=10 
nfsAuthUnixSet("gandalf", 452, 10, 1, &usergroup) 
nfsMount("gandalf", "/export/home", "/home")

#
# Load and run rdate.o to set correct date on the target
#
ld < /home/gandalf/tornado/wind/target/config/ads360/rdate.o
rdate("gandalf")

#
# Setup timezone information (Central European time)
#
putenv "TIMEZONE=CET::-60:033002:102603"

#
# Run the Erlang/OTP start script
#
cd "/home/gandalf/tornado/wind/target/erlang_cpu32_R42A/bin"
<erl
    ]]></code>
  </section>
</chapter>