Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Mihini/Cross Compilation"

(Creation of this page, with a tutorial for the RaspberryPi)
 
(Step 4: build and make)
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
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.  
 
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.  
  
== Raspberry Pi  ==
+
== 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.  
+
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  ===
 
=== Step 1: Get the prerequisites  ===
Line 9: Line 9:
 
On a Debian-based system, you will need to: <source lang="bash">
 
On a Debian-based system, you will need to: <source lang="bash">
 
$ sudo apt-get install build-essential cmake git telnet
 
$ sudo apt-get install build-essential cmake git telnet
</source>  
+
</source>
 +
 
 +
If you want to make the .rpm packages on a Debian-based system, you will also need the package <code>rpm</code>.
  
 
=== Step 2: get the toolchain  ===
 
=== Step 2: get the toolchain  ===
Line 22: Line 24:
 
Get the sources <source lang="bash">
 
Get the sources <source lang="bash">
 
$ git clone https://github.com/nim65s/mihini-repo.git
 
$ git clone https://github.com/nim65s/mihini-repo.git
</source>
+
</source>
 
+
Then, you will have to specify the path of the Linaro toolchain in the CMake configuration of Mihini: <source lang="bash">
+
$ cd mihini-repo
+
$ sed -i "s/gsaurel/$(whoami)/" cmake/toolchain.raspberrypi-linaro.cmake
+
</source>  
+
  
 
=== Step 4: build and make  ===
 
=== Step 4: build and make  ===
  
 
To finish, let's build it: <source lang="bash">
 
To finish, let's build it: <source lang="bash">
 +
$ cd mihini-repo
 
$ ./bin/build.sh -t raspberrypi-linaro
 
$ ./bin/build.sh -t raspberrypi-linaro
 
$ cd build.raspberrypi-linaro
 
$ cd build.raspberrypi-linaro
$ make lua luac
+
$ make lua luac loader
 
# Optional, if you want to use Modbus over serial (e.g. to run the Greenhouse sample)
 
# Optional, if you want to use Modbus over serial (e.g. to run the Greenhouse sample)
 
$ make modbus_serial
 
$ 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
 
$ make package
 
</source>  
 
</source>  
  
And Voilà, you have a <code>.deb</code> or a <code>.tar.gz</code> ready to be installed on your RPi&nbsp;!  
+
And Voilà, you have a <code>.deb</code> or a <code>.tar.gz</code> ready to be installed on your RPi&nbsp;!
  
<br>  
+
=== Step 5: use it  ===
 +
 
 +
If you are not sure of what to do with this <code>.deb</code>, you can go to the [[Mihini/Install Mihini|Install Mihini]] page, skipping the first shell command which downloads a similar <code>.deb</code>.
 +
 
 +
Then, you can go back to the main tutorial: [[Mihini/Run_Mihini_on_an_Open_Hardware_platform|Run Mihini on an Open Hardware platform]]
  
 
== Configuring your own toolchain  ==
 
== Configuring your own toolchain  ==
Line 53: Line 58:
  
 
Then, you shall also look at the folder <code>porting/</code>, where you can make a new directory with the name of your target.
 
Then, you shall also look at the folder <code>porting/</code>, where you can make a new directory with the name of your target.
 +
 +
== Prerequisites for making packages ==
 +
=== Debian-based ===
 +
<source lang="bash">
 +
sudo apt-get install build-essential cmake git telnet rpm
 +
</source>
 +
 +
=== Fedora ===
 +
<source lang="bash">
 +
sudo yum install cmake gcc-c++ fedora-packager @development-tools telnet
 +
</source>
 +
 +
=== ArchLinux ===
 +
<source lang="bash">
 +
sudo pacman -Syu base-devel inetutils
 +
</source>
 +
 +
=== Ångström / OpenEmbedded / OpenWRT ===
 +
<source lang="bash">
 +
opkg install cmake
 +
</source>

Latest revision as of 13:18, 14 May 2014

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