IoTGateway/IoTSuite

From ESS-WIKI
Jump to: navigation, search

Basically, we refer to How to certify IoT devices running Linux with Azure IoT SDK for IoTSuite test. Here, we assume you have done Step 1 already.

Device Explorer

Follow the Step 2, you can download the DeviceExplorer on Windows.

Note: The Device Explorer utility only runs on Windows. On other platforms use the iothub explorer tool.

IoT Hub Connection String for RISC

HostName=RISCIoTSuite.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=h2zpoAztFD4JGUpV/Z0Laue1+3RigDUreb5abaM9qDQ=

Setup Yocto Environment

In Step 3-1, we know we need the following packages, and it requires cmake version 3.0 or higher & gcc version 4.9 or higher.

sudo apt-get install -y curl libcurl4-openssl-dev uuid-dev uuid g++ make cmake git unzip openjdk-7-jre

To install these packages on Yocto, we choose fsl-yocto-3.14.28_1.0.0 (Yocto BSP 1.7) as our base image, because the default gcc version is 4.9.1.

cmake

Because the cmake version in Yocto BSP 1.7 is 2.8.12.2, we have to add a latest one.

1. Get new poky source code from master branch.

git clone git://git.yoctoproject.org/poky

2. Copy the cmake folder to Yocto BSP.

poky/meta/recipes-devtools/cmake

Java

If you do not try to pass IoTSuite test for Java, you can skip this step.

1. Get new meta-java layer from master branch.

git clone git://git.yoctoproject.org/meta-java

2. libstdc++ static is needed on your host to compile icedtea7-native. [1]

3. Modify conf/bblayers.conf (Add meta-java after meta-advantech)

BBLAYERS += " ${BSPDIR}/sources/meta-java "

4. Modify conf/local.conf

# [JDK]
# Possible provider: cacao-initial-native and jamvm-initial-native
PREFERRED_PROVIDER_virtual/java-initial-native = "cacao-initial-native"
# Possible provider: cacao-native and jamvm-native
PREFERRED_PROVIDER_virtual/java-native = "jamvm-native"
# Optional since there is only one provider for now
PREFERRED_PROVIDER_virtual/javac-native = "ecj-bootstrap-native"

5. Modify meta-advantech/recipes-fsl/images/fsl-image-adv.inc

IMAGE_INSTALL += "openjdk-7-jre"

6. If you cannot fetch rhino correctly, do this.

$ vim sources/meta-java/recipes-core/rhino/rhino_1.7r4.bb
 SRC_URI = "\
            https://github.com/mozilla/rhino/archive/Rhino1_7R4_RELEASE.zip
 S = "${WORKDIR}/rhino-Rhino1_7R4_RELEASE"
 SRC_URI[md5sum] = "1f893577269631703d31e4de9d5dc1f4"
 SRC_URI[sha256sum] = "860965fc611764745b3a4fc5bd4baac07356a9fedd2ce6642e7bb0bd7ef58d07"

Others

For other packages, we can modify meta-advantech/recipes-fsl/images/fsl-image-adv.inc

IMAGE_INSTALL += " curl curl-dev openssl openssl-dev ossp-uuid ossp-uuid-dev cmake git unzip "
IMAGE_INSTALL += " packagegroup-sdk-target ca-certificates-native python-html libssp libssp-dev "

Build Image

After all, you can build a new Yotco image for IoTSuite development environment!

$ bitbake fsl-image-qt5

You can also get the image for RSB-4410 from our share.

  • \\172.22.15.111\public\AzureIoT\fsl-image-qt5-imx6qrsb4410a1-iotsuite.img.gz

Build Samples on Yocto

Here, we need to refer to Run a simple C sample on Intel Edison.

Azure IoT SDK

Get the IoTSuite source code.

$ cd ~
$ git clone https://github.com/Azure/azure-iot-sdks.git -b 2016-01-15
$ cd azure-iot-sdks/c
$ git clone https://github.com/Azure/azure-c-shared-utility.git

Apache Qpid Proton (AMQP)

1. Install Apache Qpid Proton (AMQP) to integrate with the device hub and Event Hubs.

$ ~/azure-iot-sdks/c/build_all/linux/build_proton.sh --install /usr

2. The above command will fail in some point but we need the part before failure.

3. Go to file: /qpid-proton/proton-c/bindings/CMakeLists.txt and edit this file removing "python" from "BINDINGS".

$ vi ~/qpid-proton/proton-c/bindings/CMakeLists.txt

4. Edit the Build Proton script using following command:

$ vi ~/azure-iot-sdks/c/build_all/linux/build_proton.sh

5. Remove or comment "sync_proton" line in build_proton.sh, otherwise it will sync again the overwrite your change.

#sync_proton

6. Run Step 1 again.

Paho

1. Create folders

$ mkdir -p /usr/local/bin /usr/local/lib /usr/local/include

2. Install Paho package

$ ~/azure-iot-sdks/c/build_all/linux/build_paho.sh

Build Samples

1. Apply patch to read connection string via /home/root/connectionString.conf

$ cd ~/azure-iot-sdks
$ patch -p1 < adv_read_connection_string.patch

You can download the patch from our server.

  • \\172.22.15.111\public\AzureIoT\adv_read_connection_string.patch

2. Build the SDK

$ cd ~/azure-iot-sdks/c/build_all/linux
$ ./build.sh

Run Samples on Yocto

After you build samples successfully, you can find the binary in ~/cmake folder.

Remember to add connection string in /home/root/connectionString.conf. The connection string can be obtained via Device Explorer.

$ vi /home/root/connectionString.conf
 HostName=RISCIoTSuite.azure-devices.net;DeviceId=RSB-4410-A1;SharedAccessKey=LOhOGMcBSTx4KEtwA9j5jhtv6w9QQDF63Nf5AuZwhOI=

Finally, you can follow the Step 3-3 to run samples.

AMQP

$ ~/cmake/iothub_client/samples/iothub_client_sample_amqp/iothub_client_sample_amqp

HTTP

$ ~/cmake/iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http

Package and Share

Please follow the Step 4 to share the package to Mircosoft.

Note: E2E test results seems not necessary for this test. You can ignore the build.log file.