Hot code loading

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(HotLoad the code)
(Start erlang as a node)
Line 1: Line 1:
 
== To change a running system ==
 
== To change a running system ==
  
=== Start erlang as a node ===
+
=== Start erlang as a node on your host===
This is my /etc/X11/Xsession.d/80zhone. As you can see the erlang node's got a name "-name neo@192.168.0.202" (a running erlang virtual machine is called an erlang node). And it's got a cookie "-setcookie SFEWRG34AFDSGAFG35235".
+
This is my /etc/X11/Xsession.d/80zhone. As you can see the erlang node's got a name "-name neo@192.168.0.202" (a running erlang virtual machine is called an erlang node). And it's got a cookie "-setcookie SFEWRG34AFDSGAFG35235". This is all that's needed on the neo.
  
 
<pre>
 
<pre>

Revision as of 20:48, 5 December 2008

To change a running system

Start erlang as a node on your host

This is my /etc/X11/Xsession.d/80zhone. As you can see the erlang node's got a name "-name neo@192.168.0.202" (a running erlang virtual machine is called an erlang node). And it's got a cookie "-setcookie SFEWRG34AFDSGAFG35235". This is all that's needed on the neo.

#!/bin/sh -e
#zhone > /tmp/zhone.log 2>&1 &
/home/root/cean/start.sh -setcookie SFEWRG34AFDSGAFG35235 -name neo@192.168.0.202 -noshell -pa /home/root/trunk -s main start > debug.txt
renice -3 $!
exit 0


Every erlang node in your network should have a unique name, and a common cookie. Start an erlang node on your host PC with a unique name and the common cookie:

erl -setcookie SFEWRG34AFDSGAFG35235 -name 'host@192.168.0.200'

From your host erlang console try

net_adm:ping('neo@192.168.0.202'). 

The response should be 'pong' if you have a successful connection - if not, the response is 'pang'

Then try the shell command

nodes().

The response should be a list of all known nodes in your network.

HotLoad the code

To carry out Hot Code Loading start a an erlang node on your host and from this erlang shell type

net_adm:ping('neo@192.168.0.202'). 
nl(your_modulename).

Substitute your_modulename with the name of the module you want to load into the virtual machine on your neo. The response should be 'abcast' if sucessful. If not the response is 'error'.

The ping command is only necessary the first time to let your host node find your neo node. Don't forget to copy the compiled erlang file to your neo, hot code loading does not copy your beam file to the file system.

Personal tools

To change a running system

Start erlang as a node

This is my /etc/X11/Xsession.d/80zhone. As you can see the erlang node's got a name "-name neo@192.168.0.202" (a running erlang virtual machine is called an erlang node). And it's got a cookie "-setcookie SFEWRG34AFDSGAFG35235".

#!/bin/sh -e
#zhone > /tmp/zhone.log 2>&1 &
/home/root/cean/start.sh -setcookie SFEWRG34AFDSGAFG35235 -name neo@192.168.0.202 -noshell -pa /home/root/trunk -s main start > debug.txt
renice -3 $!
exit 0


Every erlang node in your network should have a unique name, and a common cookie. Start an erlang node on your host PC with a unique name and the common cookie:

erl -setcookie SFEWRG34AFDSGAFG35235 -name 'host@192.168.0.200'

From your host erlang console try

net_adm:ping('neo@192.168.0.202'). 

The response should be 'pong' if you have a successful connection - if not, the response is 'pang'

Then try the shell command

nodes().

The response should be a list of all known nodes in your network.

HotLoad the code

To carry out Hot Code Loading start a an erlang node on your host and from this erlang shell type

net_adm:ping('neo@192.168.0.202'). 
nl(your_modulename).

Substitute your_modulename with the name of the module you want to load into the virtual machine on your neo. The response should be 'abcast' if sucessful. If not the response is 'error'.

The ping command is only necessary the first time to let your host node find your neo node. Don't forget to copy the compiled erlang file to your neo, hot code loading does not copy your beam file to the file system.