Mihini/Mihini Agent Linux build instructions
In order to build properly the C source code, you will need the following components to be installed:
- cmake (>= 2.8.3)
- 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.
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
-dto toggle debugging on
-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.
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
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 >
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