Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Mihini/Cross Compilation

This page will help you through the process of building your Mihini's installation on your fast and powerful desktop computer for your embbeded architecture.

Raspbian (RaspberryPi & Debian)

The main files for this platform are already available, so that you will be able to get started quickly ; or it may be used as an example for the others platforms. Please, note that these steps have been validated on a 32 bit OS. Trying to run it on a 64 bit OS may give you errors when trying the build.sh .

Step 1: Get the prerequisites

On a Debian-based system, you will need to:
$ sudo apt-get install build-essential cmake git telnet

If you want to make the .rpm packages on a Debian-based system, you will also need the package rpm.

Step 2: get the toolchain

We are going to use the Linaro toolchain, from the official raspberrypi repository:
$ cd
$ git clone https://github.com/raspberrypi/tools.git

Step 3: get Mihini

Get the sources
$ git clone https://github.com/nim65s/mihini-repo.git

Step 4: build and make

To finish, let's build it:
$ cd mihini-repo
$ ./bin/build.sh -t raspberrypi-linaro
$ cd build.raspberrypi-linaro
$ make lua luac loader
# Optional, if you want to use Modbus over serial (e.g. to run the Greenhouse sample)
$ make modbus_serial
# Optional, if you want the embedded web server
$ make web web_auth
# If you want a debian package, make sure there's a line "SET(CPACK_GENERATOR "TGZ;DEB")" in the top-level CMakeLists.txt file
$ make package

And Voilà, you have a .deb or a .tar.gz ready to be installed on your RPi !

Step 5: use it

If you are not sure of what to do with this .deb, you can go to the Install Mihini page, skipping the first shell command which downloads a similar .deb.

Then, you can go back to the main tutorial: Run Mihini on an Open Hardware platform

Configuring your own toolchain

The target you specify to build.sh (which was «raspberrypi-linaro» in the example above) is used to select the toolchain. You will probably need to copy/paste an existing configuration in cmake/, naming it toolchain.<your target's name>.cmake, and changing the lines

SET(CMAKE_C_COMPILER /path/to/gcc)
SET(CMAKE_CXX_COMPILER /path/to/g++)

Then, you shall also look at the folder porting/, where you can make a new directory with the name of your target.

Prerequisites for making packages

Debian-based

sudo apt-get install build-essential cmake git telnet rpm

Fedora

sudo yum install cmake gcc-c++ fedora-packager @development-tools telnet

ArchLinux

sudo pacman -Syu base-devel inetutils

Ångström / OpenEmbedded / OpenWRT

opkg install cmake

Back to the top