Jump to: navigation, search

Mihini/Mihini Agent Linux build instructions

< Mihini
Revision as of 12:11, 1 March 2013 by Bcabe.sierrawireless.com (Talk | contribs) (Build)

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)
# 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.

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 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:
  • 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

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
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.
# this one builds a specific target
make some-target