Jump to: navigation, search

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

 
(6 intermediate revisions by one other user not shown)
Line 1: Line 1:
= Minimum requirements =
+
== Minimum requirements ==
  
 
In order to build properly the C source code, you will need the following components to be installed:
 
In order to build properly the C source code, you will need the following components to be installed:
  
* cmake (>= 2.8.3)
+
* <code>cmake</code> (&gt;= 2.8.3)
* gcc
+
* <code>gcc</code>
* readline library (optional)
+
* <code>readline</code> library (optional)
  
On Ubuntu/Debian you can install those by installing packages: cmake build-essential libreadline5-dev
+
== Build ==
  
<source lang="bash">
+
<pre>
apt-get install cmake build-essential libreadline5-dev
+
$ bin/build.sh
</source>
+
</pre>
'''Note:''' On Fedora you have to install the "Development Tools" package group and the cmake and readline-devel packages
+
  
<source lang="bash">
+
<pre>
yum groupinstall "Development Tools"
+
$ cd build.default
yum install cmake readline-devel
+
</pre>
yum groupinstall
+
<pre>
</source>
+
$ runtime/start.sh
 +
</pre>
  
= Configure build system =
+
For detailed explanations, see the following file http://git.eclipse.org/c/mihini/org.eclipse.mihini.git/tree/README.md
  
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.
+
== Run Mihini ==
  
 +
Once you built , configured and started Mihini, you should see an output similar to :
  
ReadyAgentSources/cmake folder contains toolchains files (named toolchain.*) along with other files (but don't pay attention at other files in cmake folder).<br> Each toolchain file defines a configuration for compiling the sources:
+
<pre>
 
+
 
+
* (cross-)compiler configuration (most important ones) : 
+
<source lang="bash">
+
# 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)
+
</source>
+
 
+
* 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.
+
 
+
 
+
{{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 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. <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++.
+
 
+
 
+
Available targets are the ones corresponding to the toolchain files in <code>cmake</code> 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:<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.
+
 
+
= Run Mihini =
+
 
+
Just start Mihini in a command line terminal:
+
 
+
<source lang="bash">
+
cd build.default/runtime
+
./start.sh
+
</source>
+
 
+
You should see the logs of Mihini, something similar to:
+
<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 Mihini ...
 
2012-08-24 17:21:42 GENERAL-INFO: Starting Mihini ...
Line 94: Line 44:
 
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: Mihini successfully initialized
 
2012-08-24 17:21:42 GENERAL-INFO: Mihini successfully initialized
</source>
+
</pre>
 
+
== Mihini shell ==
+
 
+
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">
+
telnet localhost 2000
+
</source>
+
 
+
Once connected to the shell you can send commands.<br> Example, you can change a Mihini config parameter:
+
 
+
<code>
+
$ telnet localhost 2000
+
Trying 127.0.0.1...
+
Connected to localhost.
+
Escape character is '^]'.
+
Lua interactive shell
+
> agent.config.network.activate = false
+
>
+
</code>
+
 
+
== Mihini configuration ==
+
 
+
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.
+
 
+
 
+
= Update build artifacts after source modifications =
+
 
+
This also applies when one wants to build artifacts that are not built by default.
+
 
+
<source lang="bash">
+
#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
+
</source>
+

Latest revision as of 10:36, 13 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)

Build

$ bin/build.sh
$ cd build.default
$ runtime/start.sh

For detailed explanations, see the following file http://git.eclipse.org/c/mihini/org.eclipse.mihini.git/tree/README.md

Run Mihini

Once you built , configured and started Mihini, you should see an output 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