Update November 4, 2015
With the release of mraa 8.1 there is now support for Node. 4.X. Upm 4.0 now allows the installation of upm modules via npm. I have updated this post to account for the new capabilities of these libraries.
This has to be the easiest way.
This comes up for me quite often so I decided to add a post about it.
Here are some quick and easy to follow step for installing/updating MRAA and UPM on an Intel Edison. The Edison generally has the prerequisites installed already so you should just have to compile. If you need more comprehensive instructions you can take a look at MRAA/UPM section of my Getting Started with Minnow Board Max post.
These instructions assume you have git installed. If not install git first following the instructions found here.
If we just want to update MRAA on an Edison we can use:
echo "src mraa-upm http://iotdk.intel.com/repos/2.0/intelgalactic" > /etc/opkg/mraa-upm.conf opkg update opkg install libmraa0
This will install the latest release version of mraa (8.1 as of 3 November 15) and would be the preferred way to go. If you need something that is upstream from this release you will have to down load and compile the source.
The mraa library can also be installed by npm if you only want the Node js bindings. It’s as simple as this:
npm install mraa
How to install from source is described here:
First we need to clone the MRAA repo from git hub:
git clone https://github.com/intel-iot-devkit/mraa.git
This will download whatever the default branch and tag is currently set at (usually the latest). If you wanted to switch to another tag (like version 7.3 for example) now is the time to do so
Now we are ready to build. We will used the same out of tree build as described in the MRAA documentation.
mkdir build cd build cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/usr -DBUILDSWIGJAVA=ON make make install
Details can be found on the mraa github page.
Upm will be installed with mraa. If you have just installed the latest mraa you should have the latest upm also (4.0 as of Nov. 4, 2015).
As of version 4.0 upm can also be installed via npm. Of course you will only get the node bindings. It’s as simple as:
npm install jsupm_<module-name>
If there are sensors in the upstream branch you want to use you will have to compile all or part of upm by hand as described here:
UPM can be cloned with the following:
git clone https://github.com/intel-iot-devkit/upm.git
Switch to the desired version (or just use the default). Ensure the version you select is supported by the version of MRAA that is installed.
Now is also the time to add any libraries that you need that are not currently in the release. Just add the directory of the driver to the /src directory with the required support files.
We will again be using the out of tree build as described in the documentation. Enter these commands to build and install:
mkdir build cd build cmake ..
If you want to only install a specific driver change to that drivers directory in build/src and then run:
make make install
If you want to install all of upm just run make and make install in the root of the build directory.
Building UPM on an Edison can take a while, so be patient.
That should do it. If there are no error messages you should be ready to utilize the new libraries.
Details can be found on the upm github page.