Jump to: navigation, search

Difference between revisions of "Mihini/Mihini Agent Linux build instructions"

(New page: = Minimum requirements = In order to build properly the C source code, you will need the following components to be installed: * cmake (>= 2.8.3) * gcc * readline library (optional) ...)
 
Line 22: Line 22:
 
= Configure build system =
 
= Configure build system =
  
From this point in this document, we'll use ReadyAgentSources as the root directory of ReadyAgent sources. It must contains folders like "bin", "cmake", "luafmk", "agent" etc.
+
From this point in this document, we'll use MihiniSources as the root directory of Mihini sources. It must contains folders like "bin", "cmake", "luafmk", "agent" etc.
  
  
Line 37: Line 37:
 
</source>
 
</source>
  
* other build options related to ReadyAgent integration (those are more likely to be used for fine tuning a ReadyAgent integration, after it is already compiled and running)
+
* other build options related to Mihini integration (those are more likely to be used for fine tuning a Mihini integration, after it is already compiled and running)
  
 
It may also be interesting to make your own toolchains files to adapt the build to your specific environment.
 
It may also be interesting to make your own toolchains files to adapt the build to your specific environment.
Line 43: Line 43:
  
 
{{warning|We strongly recommand you to use a the toolchain that was generated while creating the kernel/rootfs of the Linux system running on your device !
 
{{warning|We strongly recommand you to use a the toolchain that was generated while creating the kernel/rootfs of the Linux system running on your device !
When compiling on 'regular' personal computer,  gcc compiler provided by "build-essential"-like package works out of the box for compiling the agent, as a result toolchain.default.cmake is almost empty!}}
+
When compiling on 'regular' personal computer,  gcc compiler provided by "build-essential"-like package works out of the box for compiling Mihini, as a result toolchain.default.cmake is almost empty!}}
  
 
= Build =
 
= Build =
Line 50: Line 50:
  
  
* It is strongly advised to run next line outside from ReadyAgentSources folder
+
* It is strongly advised to run next line outside from MihiniSources folder
* Output files are produced on working_dir/build.$target folder, with $target equals to target specified in build.sh -t argument. <code>ReadyAgentSources/bin/build.sh [-d] [-t &lt;target&gt;]</code> |} Use <code>-d</code> to toggle debugging on
+
* Output files are produced on working_dir/build.$target folder, with $target equals to target specified in build.sh -t argument. <code>MihiniSources/bin/build.sh [-d] [-t &lt;target&gt;]</code> |} Use <code>-d</code> to toggle debugging on
  
 
Use <code>-t &lt;target&gt;</code> to specify the build target. When no target is specified, the default target (named "default") is used: it uses the compiler for the host computer running the build.sh script, using gcc/g++.
 
Use <code>-t &lt;target&gt;</code> to specify the build target. When no target is specified, the default target (named "default") is used: it uses the compiler for the host computer running the build.sh script, using gcc/g++.
Line 61: Line 61:
 
== Build artifacts details ==
 
== Build artifacts details ==
  
* build.$target/runtime : the runtime folder contains all ReadyAgent artifacts that need to be integrated in the target device.
+
* build.$target/runtime : the runtime folder contains all Mihini artifacts that need to be integrated in the target device.
* build.$target/runtime/lib contains the libs you may need to link with when developing an application that works with ReadyAgent, like:<br> libSwi_AirVantage.so<br> libSwi_Sms.so<br> libSwi_System.so<br> ...
+
* build.$target/runtime/lib contains the libs you may need to link with when developing an application that works with Mihini, like:<br> libSwi_AirVantage.so<br> libSwi_Sms.so<br> libSwi_System.so<br> ...
  
 
* other files and folders in build.$target folder are CMake artifacts, don't modify them, you shouldn't need to look at them.
 
* other files and folders in build.$target folder are CMake artifacts, don't modify them, you shouldn't need to look at them.
  
= Run ReadyAgent =
+
= Run Mihini =
  
Just start the agent in a command line terminal:
+
Just start Mihini in a command line terminal:
  
 
<source lang="bash">
 
<source lang="bash">
Line 75: Line 75:
 
</source>
 
</source>
  
You should see the logs of the ReadyAgent, something similar to:
+
You should see the logs of Mihini, something similar to:
<code>
+
<source lang="bash">
 
+
 
2012-08-24 17:21:42 GENERAL-INFO: ************************************************************
 
2012-08-24 17:21:42 GENERAL-INFO: ************************************************************
2012-08-24 17:21:42 GENERAL-INFO: Starting ReadyAgent ...
+
2012-08-24 17:21:42 GENERAL-INFO: Starting Mihini ...
2012-08-24 17:21:42 GENERAL-INFO:      ReadyAgent: 8.0-DEV - Build: Unknown
+
2012-08-24 17:21:42 GENERAL-INFO:      Mihini: 8.0-DEV - Build: Unknown
 
2012-08-24 17:21:42 GENERAL-INFO:      Lua VM: Lua 5.1.4 (+meta pairs/ipairs) (+patch-lua-5.1.4-3)
 
2012-08-24 17:21:42 GENERAL-INFO:      Lua VM: Lua 5.1.4 (+meta pairs/ipairs) (+patch-lua-5.1.4-3)
 
2012-08-24 17:21:42 GENERAL-INFO:      System: Linux anzu 3.0.0-24-generic #40-Ubuntu SMP Tue Jul 24 15:38:25 UTC 2012 x86_64
 
2012-08-24 17:21:42 GENERAL-INFO:      System: Linux anzu 3.0.0-24-generic #40-Ubuntu SMP Tue Jul 24 15:38:25 UTC 2012 x86_64
Line 94: Line 93:
 
2012-08-24 17:21:42 ASSCON-INFO: Asset registered, name="@sys", id=table: 0x9242d0.
 
2012-08-24 17:21:42 ASSCON-INFO: Asset registered, name="@sys", id=table: 0x9242d0.
 
2012-08-24 17:21:42 GENERAL-INFO: Module [DeviceManagement] initialized
 
2012-08-24 17:21:42 GENERAL-INFO: Module [DeviceManagement] initialized
2012-08-24 17:21:42 GENERAL-INFO: ReadyAgent successfully initialized
+
2012-08-24 17:21:42 GENERAL-INFO: Mihini successfully initialized
</code>
+
</source>
  
== ReadyAgent shell ==
+
== Mihini shell ==
  
You can interact with ReadyAgent by connecting to the Lua shell.<br> When default settings are used, this is how to do it:
+
You can interact with Mihini by connecting to the Lua shell.<br> When default settings are used, this is how to do it:
  
 
<source lang="bash">
 
<source lang="bash">
Line 105: Line 104:
 
</source>
 
</source>
  
Once connected to the shell you can send commands.<br> Example, you can change a ReadyAgent config parameter:
+
Once connected to the shell you can send commands.<br> Example, you can change a Mihini config parameter:
  
 
<code>
 
<code>
Line 117: Line 116:
 
</code>
 
</code>
  
== ReadyAgent configuration ==
+
== Mihini configuration ==
  
To modify some of the ReadyAgent configuration parameters (like communication ports, ...) you'll have to change the ReadyAgent Config.<br> This is explained in ConfigStore page.
+
To modify some of the Mihini configuration parameters (like communication ports, ...) you'll have to change the Mihini Config.<br> This is explained in [[Mihini/ConfigStore|ConfigStore]] page.
  
  

Revision as of 10:43, 1 March 2013

Minimum requirements

In order to build properly the C source code, you will need the following components to be installed:

  • cmake (>= 2.8.3)
  • gcc
  • readline library (optional)

On Ubuntu/Debian you can install those by installing packages: cmake build-essential libreadline5-dev

apt-get install cmake build-essential libreadline5-dev

Note: On Fedora you have to install the "Development Tools" package group and the cmake and readline-devel packages

yum groupinstall "Development Tools"
yum install cmake readline-devel
yum groupinstall

Configure build system

From this point in this document, we'll use MihiniSources as the root directory of Mihini sources. It must contains folders like "bin", "cmake", "luafmk", "agent" etc.


ReadyAgentSources/cmake folder contains toolchains files (named toolchain.*) along with other files (but don't pay attention at other files in cmake folder).
Each toolchain file defines a configuration for compiling the sources:


  • (cross-)compiler configuration (most important ones) :
# specify the cross compiler
SET(CMAKE_C_COMPILER   /path/to/gcc)
SET(CMAKE_CXX_COMPILER /path/to/g++)
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH  /path/to/root/env)
  • other build options related to Mihini integration (those are more likely to be used for fine tuning a Mihini integration, after it is already compiled and running)

It may also be interesting to make your own toolchains files to adapt the build to your specific environment.


Warning2.png
We strongly recommand you to use a the toolchain that was generated while creating the kernel/rootfs of the Linux system running on your device ! When compiling on 'regular' personal computer, gcc compiler provided by "build-essential"-like package works out of the box for compiling Mihini, as a result toolchain.default.cmake is almost empty!


Build

Build the software:


  • It is strongly advised to run next line outside from MihiniSources folder
  • Output files are produced on working_dir/build.$target folder, with $target equals to target specified in build.sh -t argument. MihiniSources/bin/build.sh [-d] [-t <target>] |} Use -d to toggle debugging on

Use -t <target> to specify the build target. When no target is specified, the default target (named "default") is used: it uses the compiler for the host computer running the build.sh script, using gcc/g++.


Available targets are the ones corresponding to the toolchain files in cmake directory. Using non default targets will require to install additional cross compiling toolchains.


Build artifacts details

  • build.$target/runtime : the runtime folder contains all Mihini artifacts that need to be integrated in the target device.
  • build.$target/runtime/lib contains the libs you may need to link with when developing an application that works with Mihini, like:
    libSwi_AirVantage.so
    libSwi_Sms.so
    libSwi_System.so
    ...
  • other files and folders in build.$target folder are CMake artifacts, don't modify them, you shouldn't need to look at them.

Run Mihini

Just start Mihini in a command line terminal:

cd build.default/runtime
./start.sh

You should see the logs of Mihini, something similar to:

2012-08-24 17:21:42 GENERAL-INFO: ************************************************************
2012-08-24 17:21:42 GENERAL-INFO: Starting Mihini ...
2012-08-24 17:21:42 GENERAL-INFO:      Mihini: 8.0-DEV - Build: Unknown
2012-08-24 17:21:42 GENERAL-INFO:      Lua VM: Lua 5.1.4 (+meta pairs/ipairs) (+patch-lua-5.1.4-3)
2012-08-24 17:21:42 GENERAL-INFO:      System: Linux anzu 3.0.0-24-generic #40-Ubuntu SMP Tue Jul 24 15:38:25 UTC 2012 x86_64
2012-08-24 17:21:42 GENERAL-INFO: ************************************************************
2012-08-24 17:21:42 GENERAL-INFO: Module [AssetConnector] initialized
2012-08-24 17:21:42 SHELL-INFO: Binding a shell server at address ?localhost, port 2000
2012-08-24 17:21:42 GENERAL-INFO: Module [Lua Shell] initialized
2012-08-24 17:21:42 GENERAL-INFO: Module [NetworkManager] initialized
2012-08-24 17:21:42 GENERAL-INFO: Module [Lua RPC] initialized
2012-08-24 17:21:42 GENERAL-INFO: Module [ServerConnector] initialized
2012-08-24 17:21:42 GENERAL-INFO: Module [DataManagement] initialized
2012-08-24 17:21:42 ASSCON-INFO: Connection received from asset [table: 0x9242d0] at '<local ipc=table: 0x8f33f0>:0'
2012-08-24 17:21:42 ASSCON-INFO: Asset registered, name="@sys", id=table: 0x9242d0.
2012-08-24 17:21:42 GENERAL-INFO: Module [DeviceManagement] initialized
2012-08-24 17:21:42 GENERAL-INFO: Mihini successfully initialized

Mihini shell

You can interact with Mihini by connecting to the Lua shell.
When default settings are used, this is how to do it:

telnet localhost 2000

Once connected to the shell you can send commands.
Example, you can change a Mihini config parameter:

$ telnet localhost 2000 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. Lua interactive shell > agent.config.network.activate = false >

Mihini configuration

To modify some of the Mihini configuration parameters (like communication ports, ...) you'll have to change the Mihini Config.
This is explained in ConfigStore page.


Update build artifacts after source modifications

This also applies when one wants to build artifacts that are not built by default.

#go to the build folder
cd build.default
# this one rebuilds all default targets if their dependencies have change.
make
# this one builds a specific target
make some-target