Skip to content

S2C Sandbox: Cross compile Evins

komar edited this page Feb 6, 2020 · 2 revisions

Download

Erlang version 19.2

You need download and install Erlang/OTP version 19.2 for your distribution: https://www.erlang-solutions.com/resources/download.html

Download toolchain and repository for Sandbox

You need download toolchain and repository for sandbox, as described https://github.com/EvoLogics/sdmsh/wiki/S2C-Sandbox-%3A-Download-and-Install-toolchain

Download evins

You need clone git repository with evins https://github.com/okebkal/evins.git

Download erlang base for S2C Sandbox

https://lab.evologics.de/share/soft/EvoLogics-sandbox/erl-base-19.2.tar.gz https://lab.evologics.de/share/soft/EvoLogics-sandbox/evins-user-helpers.tar.gz

Cross compile evins

Unpack evins-user-helpers.tar.gz

You need unpack evins-user-helpers.tar.gz and copy ./evins-repack-for-stamp9g20 to directory with evins

Setup toolchain enviroment

Setup toolchain enviroment:

$ . /usr/local/oecore-i686/environment-setup-armv5te-angstrom-linux-uclibceabi

You will get somthing like that:

 APP    evins.app.src
make -C /home/komar/work/proj/am/evins/c_src
make[1]: Entering directory '/home/komar/work/proj/am/evins/c_src'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/komar/work/proj/am/evins/c_src'
===> Starting relx build process ...
===> Resolving OTP Applications from directories:
          /home/komar/work/proj/am/evins/ebin
          /home/komar/work/proj/am/evins/deps
          /usr/lib/erlang/lib
          /home/komar/work/proj/am/evins/apps
          /home/komar/work/proj/am/evins/_rel
===> Resolved evins-0.3
===> Including Erts from /usr/lib/erlang
===> release successfully created!
make[1]: Entering directory '/home/komar/work/proj/am/evins'
make[1]: Leaving directory '/home/komar/work/proj/am/evins'
===> Starting relx build process ...
===> Resolving OTP Applications from directories:
          /home/komar/work/proj/am/evins/ebin
          /home/komar/work/proj/am/evins/deps
          /usr/lib/erlang/lib
          /home/komar/work/proj/am/evins/apps
          /home/komar/work/proj/am/evins/_rel
===> Resolved evins-0.3
===> tarball /home/komar/work/proj/am/evins/_rel/evins/evins-0.3.tar.gz successfully created!

Prepare evins for sandbox installation

You need run evins-repack-for-stamp9g20 from evins-user-helpers (you need put you path to evins-0.3.tar.gz):

$ ./evins-repack-for-stamp9g20 /home/komar/work/proj/am/evins/_rel/evins/evins-0.3.tar.gz

You will see something like that:

Archive for deplying to S2C Sandbox for arch arm ready:
-rw-rw-r-- 1 komar komar 2.1M Feb  6 13:00 evins-0.3.tar.xz
lrwxrwxrwx 1 komar komar   16 Feb  6 13:00 evins-arm-angstrom-linux-uclibceabi.tar.xz -> evins-0.3.tar.xz

Install evins to S2c Sandbox

Uploading

You need upload to directory /tmp in sandbox such files:

  • evins-arm-angstrom-linux-uclibceabi.tar.xz
  • erl-base-19.2.tar.gz
  • evins-install.sh from evins-user-helpers.tar.gz
  • init.d-evins from evins-user-helpers.tar.gz

Install evins

root@evo-sandbox:/tmp$ ./evins-install.sh evins-arm-angstrom-linux-uclibceabi.tar.xz erl-base-19.2.tar.gz

Install startup script for evins

root@evo-sandbox:/tmp$ mv init.d-evins /etc/init.d/evins
root@evo-sandbox:/tmp$ update-rc.d evins defaults

After this evins will run as daemon at boot time

Running evins

Test evins run

root@evo-sandbox$ /opt/evins/bin/evins console

You must see something like that:

Exec: /opt/evins/erts-8.2/bin/erlexec -boot /opt/evins/releases/0.3/start -mode interactive -boot_var ERTS_LIB_DIR /opt/evins/lib -config /opt/evins/releases/0.3/sys.config -args_file /opt/evins/releases/0.3/vm.args -pa -- console
Root: /opt/evins
/opt/evins
Erlang/OTP 19 [erts-8.2] [source] [async-threads:10] [kernel-poll:false]

Eshell V8.2  (abort with ^G)
(evins@evo-sandbox)1> !!! Name of current protocol csma_aloha
1580.993200.158868             mod_nl:201:mod_nl_nl1: NL Protocol sncfloodr 
1580.993200.163373         fsm_conf:199:mod_mac_alh1: Unhandled event: {allowed}
1580.993200.169543             mod_nl:202:mod_nl_nl1: Routing Table 63 
...

If it so, you can connect to port 1111 from another shell

$ nc <modem-ip> 1111
?
=========================================== HELP ===========================================
?                       - List of all commands

===================================== Send and receive ======================================
NL,send[,<Type>],[<Datalen>],<Dst>,<Data>   - Send data, <Datalen> - optional,
...

Run evins as daemon

/etc/init.d/evins start