Last edited 11 months ago

How to integrate Azure IoT Edge on OpenSTLinux

Applicable for STM32MP15x lines

Warning DB.png Important
This article provides, as example, some helper guidelines for a topic that is not part of STM32MPU ecosystem releases for which ST provides some support.
The integration presented in this article was tested with the following setup: ecosystem release v3.0.0 and STM32MP157x-DK2 Discovery kit More info green.png board. Consequently, using this article with any other board, and / or with on any other ecosystem release, may require some modifications.

1. Article purpose[edit | edit source]

The purpose of this article is to explain how to integrate the Microsoft Azure IoT Edge device [1] on OpenSTLinux.

This article explains step by step how to add the Yocto meta-data components needed on OpenSTLinux distribution, and how to configure and build the image.


2. Prerequisites[edit | edit source]

You need to have an active Azure subscription, a "Free Trail" subscription is possible for 12 months. The way to do that is described in the Linux Quickstart document[2].

2.1. Hardware prerequisites[edit | edit source]


  • STM32MP157C-DK2
STM32MP157C-DK2

For more information about the STM32 discovery board and how to start it up, jump to this section Getting_started/STM32MP1_boards/STM32MP157x-DK2.

2.2. Software prerequisites[edit | edit source]

The STM32MP1 Distribution Package must be installed on your host. The process has been verified with the delivery ecosystem release v3.0.0 . For more information about the OpenSTLinux distribution package go to STM32MPU_Distribution_Package article.

Note that the software customizations have been applied on a (DISTRO: openstlinux-weston, MACHINE: stm32mp1) OpenSTLinux distribution environment, and for a st-image-weston image.

3. Software update with Yocto meta-iotedge and the dependencies[edit | edit source]

Info white.png Information
The configuration tested is based on iotedge 1.1.3 version :
meta-iotedge : branch dunfell  : commit a03c2f1c089f498658fbcec79a9a417212aae52d 
meta-virtualization : branch dunfell  : commit 502b81ae3ae11bf4d889b7eff6239fb9e6c55994 
meta-rust : branch master : commit 7ff669d8cedd83a2d3efb73073a63b0a7efffddc


1.Get meta-iotedge [3] and the dependencies

cd  [your STM32MP1 Distribution path]/layers/
git clone https://github.com/Azure/meta-iotedge.git
git clone git://github.com/meta-rust/meta-rust.git
git clone git://git.yoctoproject.org/meta-virtualization
cd meta-iotedge
git checkout a03c2f1c089f498658fbcec79a9a417212aae52d -b dunfell
cd meta-virtualization
git checkout  502b81ae3ae11bf4d889b7eff6239fb9e6c55994 -b dunfell     
cd meta-rust
git checkout 7ff669d8cedd83a2d3efb73073a63b0a7efffddc -b INT_AZURE

2.Setup the build configuration

cd [your STM32MP1 Distribution path]
DISTRO=openstlinux-weston MACHINE=stm32mp1 source layers/meta-st/scripts/envsetup.sh

3.Add the meta-iotedge layer and other dependencies yocto layers to the distribution configuration.

cd [your STM32MP1 Distribution path]
bitbake-layers add-layer [your STM32MP1 Distribution path]/meta-rust/
bitbake-layers add-layer [your STM32MP1 Distribution path]/meta-virtualization/
bitbake-layers add-layer [your STM32MP1 Distribution path]/meta-iotedge/

4.Update the configuration to add the new components in your image.

  • Add DISTRO_FEATURES_append = "virtualization" into [your STM32MP1 Distribution path]/layers/meta-st/meta-st-openstlinux/conf/distro/openstlinux-weston.conf
  • Add IMAGE_INSTALL_append += "iotedge-daemon iotedge-cli libiothsm-std docker connman connman-client" into [your STM32MP1 Distribution path]/build-openstlinuxweston-stm32mp1/conf/local.conf
  • Change ROOTFS_PARTITION_SIZE = "763904" to ROOTFS_PARTITION_SIZE = "2097152" in[your STM32MP1 Distribution path]//layers/meta-st/meta-st-stm32mp/conf/machine/include/st-machine-common-stm32mp.inc file
  • delete "inherit python3targetconfig" in layers/meta-virtualization/recipes-extended/libvirt/libvirt-python.inc

3.1. Image build and flash[edit | edit source]

Go the article STM32MPU_Distribution_Package for the details about the process to build and flash your image.

To build the image:

In the folder [your STM32MP1 Distribution path]/build-openstlinuxweston-stm32mp1 Execute the command:

PC $>bitbake st-image-weston

4. Execution of the Azure IoT Edge demonstration[edit | edit source]

1.Update of the IoT Edge configuration file on the board

vi /etc/iotedge/config.yaml
update hostname example with "stm32mp1"
update connectionString with the primary connection string found in your Azure IoT HUB

2. Follow the process described on the Microsoft Azure [2] website

5. References[edit | edit source]