This is documentation for the old, first-generation Kaa platform v0.x.
Next generation Kaa Enterprise IoT platform is now available! Try it free with a 30-days trial.
Kaa Enterprise documentation is here.
. . .

Raspberry Pi

This guide explains how to cross-compile Kaa C++ SDK for Raspberry Pi. Alternatively, you can build the Kaa C++ SDK directly on the Raspberry Pi board. For more information, see Linux guide for Kaa C++ SDK.

NOTE: This guide is verified against:

  • Host OS: Ubuntu 14.04 LTS Desktop 64-bit
  • Device: Raspberry Pi 3
  • Target OS: Raspbian Jessie

Perform the following instructions on the host machine:

  1. Download and install toolchain.

    mkdir rpi_root && cd rpi_root
    export RPI_ROOT=$(pwd)
    git clone --depth 1
    export CROSS=arm-linux-gnuebihf
    export INSTALLDIR=$RPI_ROOT/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/arm-linux-gnueabihf/libc/usr
    export PATH=$RPI_ROOT/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin:$PATH
    export INSTALLDIR=$RPI_ROOT/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/libc/usr
    export PATH=$RPI_ROOT/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin:$PATH
  2. Download and install zlib.

    cd $RPI_ROOT
    tar -xvzf zlib-1.2.8.tar.gz
    cd zlib-1.2.8
    CROSS_PREFIX="${CROSS}-" ./configure --prefix=${INSTALLDIR}
    make && make install
  3. Download and install bzip2.

    cd $RPI_ROOT
    tar -xvzf bzip2-1.0.6.tar.gz
    cd bzip2-1.0.6
    sed -e "/^all:/s/ test//" -i Makefile
    make CC="${CROSS}-gcc" AR="${CROSS}-ar" LD="${CROSS}-ld" AS="${CROSS}-as"
    make PREFIX=${INSTALLDIR} install
  4. Download and install Boost.

    cd $RPI_ROOT
    wget -O boost_1_59_0.tar.bz2
    tar -xvf boost_1_59_0.tar.bz2
    cd boost_1_59_0
    sed -r 's/(using\s+gcc)(\s+;)/\1 : arm : arm-linux-gnueabihf-c++\2/g' -i project-config.jam
    ./bjam install toolset=gcc-arm --prefix=${INSTALLDIR}
  5. Install Apache Avro for the host and target machines. Avro depends on some Boost components, therefore it is critical that you install them as described in the previous step.

    Install Avro for host machine.

    cd $RPI_ROOT
    sudo apt-get install libboost-dev libboost-filesystem-dev libboost-iostreams-dev libboost-program-options-dev libboost-system-dev
    mkdir -p avro/host
    tar -xvzf avro-cpp-1.7.5.tar.gz -C ./avro/host
    cd ./avro/host/avro-cpp-1.7.5
    mkdir build && cd build
    cmake ..
    sudo make install

    Patch and install Avro for target machine.

    cd $RPI_ROOT
    mkdir -p avro/target
    tar -xvzf avro-cpp-1.7.5.tar.gz -C ./avro/target
    cd ./avro/target/avro-cpp-1.7.5
    patch < avro-cpp-disable-tests.patch
    mkdir build && cd build
    make && make install
  6. Build Botan.

    cd $RPI_ROOT
    tar -xvzf Botan-1.11.27.tgz
    cd Botan-1.11.27
    python --cpu=arm --cc-bin=${CROSS}-g++ --prefix=${INSTALLDIR}
    make && make install
    cp -r ${INSTALLDIR}/include/botan-1.11/botan/ ${INSTALLDIR}/include
    rm -r ${INSTALLDIR}/include/botan-1.11
  7. Download Kaa C++ SDK from your Kaa instance and compile it. See Generate SDK.

    mkdir kaa-cpp
    tar -zxf kaa-cpp-ep-sdk-*.tar.gz -C kaa-cpp
    cd kaa-cpp
    mkdir build
    cd build
    cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/rpi.cmake ..