Difference between revisions of "How to integrate Azure IoT Edge on OpenSTLinux"

[unchecked revision] [quality revision]
m (Software prerequisites)
m (Reverted edits by Yves Coppeaux (talk) to last revision by Jean-Christophe Trotin)
(Tag: Rollback)
 

1 Article purpose[edit]

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]

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]


  • 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/STM32MP157C-DK2.

2.2 Software prerequisites[edit]

The STM32MP1 Distribution Package must be installed on your host. The process has been verified with the delivery ecosystem release unknown revision 3v1.02.0 Warning.png More info.png. For more information about the OpenSTLinux distribution package go to STM32MP1_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 Yoto meta-iotedge and the dependencies[edit]

Info white.png Information
The configuration tested is based on :
meta-iotedge :Yocto branchthud dunfell  branch : commit 6840cf2afb51b4f2c535a05d5635736652f664f7iotedge v1.0.8
meta-virtualization : branchYocto dunfellthud  :branch commitlatest
502b81ae3ae11bf4d889b7eff6239fb9e6c55994
meta-rust : branchcommit master :for commit"Update e4d25b98083bcecb94df6ee189a165d63ede7f3d
to rust and cargo version 1.36.0"


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

cd  [your STM32MP1 Distribution path]/layers/
git clone -b dunfellthud https://github.com/Azure/meta-iotedge.git
git clone git://github.com/meta-rust/meta-rust.git
git clone -b dunfellthud git://git.yoctoproject.org/meta-virtualization
cd meta-rust
git checkout e4d25b98083bcecb94df6ee189a165d63ede7f3dc5ff05d1e99c1e80844c1673456e2368499918c7 -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 docker-contrib 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 filedelete "inherit python3targetconfig" in
  • Add CONFIG_EXT4_FS_SECURITY=y into [your STM32MP1 Distribution path]/layers/meta-virtualization/st/meta-st-stm32mp\recipes-extendedkernel/libvirtlinux/libvirtlinux-python.incstm32mp/4.19/fragment-03-systemd.config

3.1 Image build and flash[edit]

Go the article STM32MP1_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]

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

vi /etc/iotedge/config.yam
update hostname example with "stm32mp1"

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

5 References[edit]


==Article purpose==
The purpose of this article is to explain how to integrate the '''Microsoft Azure IoT Edge device''' <ref>https://docs.microsoft.com/en-us/azure/iot-edge/</ref> 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.

{{InternalInfo|
* W2016.5: YCO: it is a simple demonstration of a simulator sensor device with our STM32MP1 board, we use also only the physical ethernet port connexion, we didn't manage any certificat, purpose is to add the software component needed in our OpenSTLinux distribution.

* W2014.4: YCO: Another solution was to add some Packages availables on Microsoft Azure repository (for Linux armv7l 32bits  architecture), on a starter kit but there are some missing dependecies components for virtualization &container in the OpenSTLinux image, we can perhaps provide these missing packages on ST repository}}

==Prerequisites==
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<ref name=azure-iot-edge> https://docs.microsoft.com/en-us/azure/iot-edge/quickstart-linux/</ref>. 

===Hardware prerequisites===
{{InternalInfo|W2014.4 : YCO : We are able to integrate the Azure IoT Edge on STM32MP157C-EV1 also}} 

* STM32MP157C-DK2
 [[File: STM32MP157C-DK2_angle2.jpg|thumb|upright=2|center|link=|STM32MP157C-DK2]]
For more information about the STM32 discovery board and how to start it up, jump to this section [[Getting_started/STM32MP1_boards/STM32MP157C-DK2]].

===Software prerequisites===
The STM32MP1 Distribution Package must be installed on your host. The process has been verified with the delivery  {{EcosystemRelease | revision=3.01.2.0}}. For more information about the OpenSTLinux distribution package go to   [[STM32MP1_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.

==Software update with Yoto meta-iotedge and the dependencies==
{{Info| The configuration tested is based on :
 meta-iotedge : Yocto thud branch dunfell  : commit 6840cf2afb51b4f2c535a05d5635736652f664f7
 meta-virtualization : branch dunfell  : commit 502b81ae3ae11bf4d889b7eff6239fb9e6c55994
 meta-rust : branch master : commit e4d25b98083bcecb94df6ee189a165d63ede7f3d: iotedge v1.0.8
 meta-virtualization : Yocto thud branch latest
 meta-rust : commit for "Update to rust and cargo version 1.36.0"}}<br>

1.Get '''meta-iotedge''' <ref>https://github.com/Azure/meta-iotedge/tree/dunfellthud</ref> and the dependencies

 {{PC$}}cd  [your STM32MP1 Distribution path]/layers/
 {{PC$}}git clone -b dunfellthud https://github.com/Azure/meta-iotedge.git
 {{PC$}}git clone git://github.com/meta-rust/meta-rust.git
 {{PC$}}git clone -b dunfellthud git://git.yoctoproject.org/meta-virtualization
 {{PC$}}cd meta-rust
 {{PC$}}git checkout e4d25b98083bcecb94df6ee189a165d63ede7f3dc5ff05d1e99c1e80844c1673456e2368499918c7 -b INT_AZURE

2.Setup the build configuration

 {{PC$}}cd [your STM32MP1 Distribution path]
 {{PC$}}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.

 {{PC$}}cd [your STM32MP1 Distribution path]
 {{PC$}}bitbake-layers add-layer [your STM32MP1 Distribution path]/meta-rust/
 {{PC$}}bitbake-layers add-layer [your STM32MP1 Distribution path]/meta-virtualization/
 {{PC$}}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 docker-contrib 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'''Add '''CONFIG_EXT4_FS_SECURITY'''=y into [your STM32MP1 Distribution path]/layers/meta-st/meta-st-stm32mp\recipes-kernel/linux/linux-stm32mp/4.19/'''fragment-03-systemd.config'''
===Image build and flash===
Go the article [[STM32MP1_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

==Execution of the Azure IoT Edge demonstration==
1.Update of the '''IoT Edge''' configuration file on the board
 {{Board$}}vi /etc/iotedge/config.yam
 update '''hostname''' example with "stm32mp1"

2. Follow the process described on the '''Microsoft Azure''' <ref name=azure-iot-edge> https://docs.microsoft.com/en-us/azure/iot-edge/quickstart-linux/</ref> website

== References==<references />

<noinclude>

[[Category:How to run use cases with expansions]]
{{PublicationRequestId | 17215 | 2020-08-28}}</noinclude>
Line 5: Line 5:
   
 
{{InternalInfo|
 
{{InternalInfo|
* W2016.5: YCO: it is a simple demonstration of a simulator sensor device with our STM32MP1 board, we use also only the physical ethernet port connexion, we didn't manage any certificat, purpose is to add the software component needed in our OpenSTLinux distribution.}}
+
* W2016.5: YCO: it is a simple demonstration of a simulator sensor device with our STM32MP1 board, we use also only the physical ethernet port connexion, we didn't manage any certificat, purpose is to add the software component needed in our OpenSTLinux distribution.
  +
* W2014.4: YCO: Another solution was to add some Packages availables on Microsoft Azure repository (for Linux armv7l 32bits  architecture), on a starter kit but there are some missing dependecies components for virtualization &container in the OpenSTLinux image, we can perhaps provide these missing packages on ST repository}}
   
 
==Prerequisites==
 
==Prerequisites==
 
You need to have an active Azure subscription, a "Free Trail" subscription is possible for 12 months.
 
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<ref name=azure-iot-edge> https://docs.microsoft.com/en-us/azure/iot-edge/quickstart-linux/</ref>.  
+
The way to do that is described in the Linux Quickstart document<ref>https://docs.microsoft.com/en-us/azure/iot-edge/quickstart-linux/</ref>.  
   
 
===Hardware prerequisites===
 
===Hardware prerequisites===
Line 19: Line 20:
   
 
===Software prerequisites===
 
===Software prerequisites===
The STM32MP1 Distribution Package must be installed on your host. The process has been verified with the delivery  {{EcosystemRelease | revision=3.0.0}}. For more information about the OpenSTLinux distribution package go to  [[STM32MP1_Distribution_Package]] article.
+
The STM32MP1 Distribution Package must be installed on your host. The process has been verified with the delivery  {{EcosystemRelease | revision=1.2.0}}. For more information about the OpenSTLinux distribution package go to  [[STM32MP1_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.
 
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.
Line 25: Line 26:
 
==Software update with Yoto meta-iotedge and the dependencies==
 
==Software update with Yoto meta-iotedge and the dependencies==
 
{{Info| The configuration tested is based on :
 
{{Info| The configuration tested is based on :
  meta-iotedge : branch dunfell  : commit 6840cf2afb51b4f2c535a05d5635736652f664f7
+
  meta-iotedge :Yocto thud branch : iotedge v1.0.8
  meta-virtualization : branch dunfell  : commit 502b81ae3ae11bf4d889b7eff6239fb9e6c55994
+
  meta-virtualization : Yocto thud branch latest
  meta-rust : branch master : commit e4d25b98083bcecb94df6ee189a165d63ede7f3d}}
+
  meta-rust : commit for "Update to rust and cargo version 1.36.0"}}
 
<br>
 
<br>
1.Get '''meta-iotedge''' <ref>https://github.com/Azure/meta-iotedge/tree/dunfell</ref> and the dependencies
+
1.Get '''meta-iotedge''' <ref>https://github.com/Azure/meta-iotedge/tree/thud</ref> and the dependencies
   
 
  {{PC$}}cd  [your STM32MP1 Distribution path]/layers/
 
  {{PC$}}cd  [your STM32MP1 Distribution path]/layers/
  {{PC$}}git clone -b dunfell https://github.com/Azure/meta-iotedge.git
+
  {{PC$}}git clone -b thud https://github.com/Azure/meta-iotedge.git
 
  {{PC$}}git clone git://github.com/meta-rust/meta-rust.git
 
  {{PC$}}git clone git://github.com/meta-rust/meta-rust.git
  {{PC$}}git clone -b dunfell git://git.yoctoproject.org/meta-virtualization
+
  {{PC$}}git clone -b thud git://git.yoctoproject.org/meta-virtualization
 
  {{PC$}}cd meta-rust
 
  {{PC$}}cd meta-rust
  {{PC$}}git checkout e4d25b98083bcecb94df6ee189a165d63ede7f3d -b INT_AZURE
+
  {{PC$}}git checkout c5ff05d1e99c1e80844c1673456e2368499918c7 -b INT_AZURE
   
 
2.Setup the build configuration
 
2.Setup the build configuration
Line 52: Line 53:
 
4.Update the configuration to add the new components in your image.
 
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 '''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'''
+
* Add '''IMAGE_INSTALL_append +'''= "'''iotedge-daemon iotedge-cli libiothsm-std docker docker-contrib 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
 
* 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'''
+
* Add '''CONFIG_EXT4_FS_SECURITY'''=y into [your STM32MP1 Distribution path]/layers/meta-st/meta-st-stm32mp\recipes-kernel/linux/linux-stm32mp/4.19/'''fragment-03-systemd.config'''
  +
 
 
===Image build and flash===
 
===Image build and flash===
 
Go the article [[STM32MP1_Distribution_Package]] for the details about the process to build and flash your image.
 
Go the article [[STM32MP1_Distribution_Package]] for the details about the process to build and flash your image.
Line 69: Line 71:
 
  update '''hostname''' example with "stm32mp1"
 
  update '''hostname''' example with "stm32mp1"
   
2. Follow the process described on the '''Microsoft Azure''' <ref name=azure-iot-edge> https://docs.microsoft.com/en-us/azure/iot-edge/quickstart-linux/</ref> website
+
2. Follow the process described on the '''Microsoft Azure''' <ref>https://docs.microsoft.com/en-us/azure/iot-edge/quickstart-linux/</ref> website
   
 
== References==
 
== References==