Difference between revisions of "R-Car/Boards/Yocto-Gen3/Azure IoT Edge/v5.5.0"

From eLinux.org
Jump to: navigation, search
(Set up in the Azure)
 
(45 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{Template:R-Car-Gen3-Navbox}}
 +
{{TOC right}}
 +
 +
[[Category:R-Car]]
 +
[[Category:R-Car Gen3]]
 +
 
== Introduction ==
 
== Introduction ==
This page describes how to set up the Yocto environment to use the Azure IoT Hub with R-Car and run it.
+
This page describes how to setup the Yocto environment to use the Azure IoT Edge with R-Car and run it.
 +
 
 +
This page contains information abot building and running AWS GreenGrass on Yocto environment on:
 +
* [[R-Car/Boards/H3SK | Renesas R-Car-H3 Starter Kit Premier]] (unofficial name - H3ULCB)
 +
* [[R-Car/Boards/M3SK | Renesas R-Car-M3 Starter Kit Pro]] (unofficial name - M3ULCB)
 +
** https://www.renesas.com/us/en/products/automotive-products/automotive-system-chips-socs/r-car-h3-m3-starter-kit
 +
* [[R-Car/Boards/CCPF-SK]]
 +
** http://www.shimafuji.co.jp/products/2308
 +
 
 +
== Topic ==
 +
{{Template:R-Car-Gen3-Topic}}
 +
 
 +
== Software revisions ==
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Software !! Revision
 +
|-
 +
| Yocto Project || [https://git.yoctoproject.org/poky/tag/?id=yocto-3.1.8 3.1.8]
 +
|-
 +
| aarch64-poky-linux-gcc (GCC) || 9.3
 +
|-
 +
| Kernel Ver || 5.10.41
 +
|-
 +
| Userland 64/32bit || 64
 +
|-
 +
| U-Boot || 2020.10
 +
|-
 +
| OP_TEE || 3.13.0
 +
|-
 +
| IoT Edge || 1.1.8
 +
|-
 +
|}
  
 
== Environment ==
 
== Environment ==
Line 18: Line 56:
 
! Board !! SoC !! Confirmed
 
! Board !! SoC !! Confirmed
 
|-
 
|-
| R-Car Starter Kit Premier(H3) || v2.0 || OK
+
| R-Car Starter Kit Premier(H3) || H3e-2G v3.0 || OK
 +
|-
 +
| R-Car Starter Kit Premier(H3) || H3 v3.0 (1rank DDR) || OK
 +
|-
 +
| R-Car Starter Kit Premier(H3) || H3 v3.0 (2rank DDR) || NT
 +
|-
 +
| R-Car Starter Kit Premier(H3) || H3 v2.0 with 4GB DDR || OK
 +
|-
 +
| R-Car Starter Kit Pro || M3 v3.0 || OK
 +
|-
 +
| R-Car Starter Kit Pro || M3 v1.0 || OK
 
|-  
 
|-  
| CCPF + R-Car Starter Kit Premier(H3) || v2.0 || OK
+
| CCPF-SK + R-Car Starter Kit Premier(H3) || H3e-2G v3.0 || OK
 
|-  
 
|-  
| R-Car Starter Kit Pro(M3) || v1.0 || OK
+
| CCPF-SK + R-Car Starter Kit Premier(H3) || H3 v3.0 (1rank DDR) || OK
 
|-  
 
|-  
| R-Car Starter Kit Pro(M3) || v3.0 || OK
+
| CCPF-SK + R-Car Starter Kit Premier(H3) || H3 v3.0 (2rank DDR) || NT
 
|-  
 
|-  
| CCPF + R-Car Starter Kit Pro(M3) || v1.0 || OK
+
| CCPF-SK + R-Car Starter Kit Premier(H3) || H3 v2.0 with 4GB DDR || OK
 
|-  
 
|-  
| CCPF + R-Car Starter Kit Pro(M3) || v3.0 || OK
+
| CCPF-SK + R-Car Starter Kit Pro || M3 v3.0 || OK
 +
|-
 +
| CCPF-SK + R-Car Starter Kit Pro || M3 v1.0 || OK
 
|-  
 
|-  
 
|}
 
|}
 +
{{Note}} NT='Not Tested' but will work
 +
 +
See also:
 +
* [[R-Car/Boards/H3SK#Hardware]]
 +
* [[R-Car/Boards/M3SK#Hardware]]
  
 
== Set up in the Azure ==
 
== Set up in the Azure ==
 
# Create an Azure account
 
# Create an Azure account
#: Create an Azure account with reference to the following.
+
#: Create an Azure account with reference to https://azure.microsoft.com/en-us/free/.
#: https://azure.microsoft.com/en-us/free/
 
 
# Create an Azure IoT Hub
 
# Create an Azure IoT Hub
#: Create an Azure IoT Hub with reference to the following.
+
#: Create an Azure IoT Hub with reference to [https://docs.microsoft.com/ja-jp/azure/iot-hub/iot-hub-create-through-portal#create-an-iot-hub Create an IoT hub].
#: https://docs.microsoft.com/ja-jp/azure/iot-hub/iot-hub-create-through-portal#create-an-iot-hub
 
 
# Register an Azure Device
 
# Register an Azure Device
#: Access https://portal.azure.com/ and select the IoT Hub you created in the previous step.
+
#: Access https://portal.azure.com/ and select your IoT Hub.
#: Select "IoT Edge" under "Device Management" in the side menu, and then press "+ Add IoT Edge Device".
+
#: Select "IoT Edge" under "Device Management" from the side menu, and then click "+ Add IoT Edge Device".
 
#:: [[File:Azure-device-1.png|1000px]]<br>
 
#:: [[File:Azure-device-1.png|1000px]]<br>
 
#: Then, set an arbitrary name for "Device ID" and click "Save" without changing the other settings.
 
#: Then, set an arbitrary name for "Device ID" and click "Save" without changing the other settings.
#: Finally, select "IoT Edge" among "Device Management" in the side menu, and press the device ID you created to check the "Primary Connection String".
+
#: And then, select "IoT Edge" under "Device Management" from the side menu, and click the device ID you created to check the "Primary Connection String".
#: (The "Primary Connection String" is used in the "Procedure on the target board" section.)
+
#: (The "Primary Connection String" is used in [[#Receive_telemetry_messages|Receive telemetry messages]].)
 
#:: [[File:Azure-device-3.png|1000px]]<br>
 
#:: [[File:Azure-device-3.png|1000px]]<br>
 
# Add the Azure module
 
# Add the Azure module
#: Add the Simulated Temperature Sensor module with reference to the following.
+
#: Add the Simulated Temperature Sensor module with reference to [https://docs.microsoft.com/en-us/azure/iot-edge/quickstart-linux?view=iotedge-2018-06#deploy-a-module Deploy a module].
#: https://docs.microsoft.com/ja-jp/azure/iot-edge/quickstart-linux?view=iotedge-2018-06#deploy-a-module
+
 
 +
== Required packages ==
  
== ビルド手順 ==
+
# Install the required packages
# 事前準備(パッケージのインストール)
 
 
#: <syntaxhighlight lang="bash">
 
#: <syntaxhighlight lang="bash">
 
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
 
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
Line 59: Line 112:
 
libsdl1.2-dev pylint3 xterm
 
libsdl1.2-dev pylint3 xterm
 
</syntaxhighlight>
 
</syntaxhighlight>
# gitの設定
+
#: Refer to [http://www.yoctoproject.org/docs/current/yocto-project-qs/yocto-project-qs.html#packages Yocto Project Quick Start] for more information.
 +
# Set up initial git configuration
 
#: <syntaxhighlight lang="bash">
 
#: <syntaxhighlight lang="bash">
 
$ git config --global user.email "you@example.com"
 
$ git config --global user.email "you@example.com"
 
$ git config --global user.name "Your Name"
 
$ git config --global user.name "Your Name"
 
</syntaxhighlight>
 
</syntaxhighlight>
# Build script(build.sh)
+
 
 +
== Building the BSP ==
 +
# Create the following script(build.sh) for building
 
#: <syntaxhighlight lang="bash">
 
#: <syntaxhighlight lang="bash">
 
#!/bin/bash
 
#!/bin/bash
Line 77: Line 133:
 
META_RENESAS_COMMIT=0fe77668f5d9a31a5d10449988c3d8fb8dc475c5
 
META_RENESAS_COMMIT=0fe77668f5d9a31a5d10449988c3d8fb8dc475c5
 
META_RENESAS_CCPF_COMMIT=b49b57d6e68d5cda70aefbed34e06903484c573b
 
META_RENESAS_CCPF_COMMIT=b49b57d6e68d5cda70aefbed34e06903484c573b
META_VIRTUALIZATION_COMMIT=92cd3467502bd27b98a76862ca6525ce425a8479
+
META_VIRTUALIZATION_COMMIT=c4f156fa93b37b2428e09ae22dbd7f5875606f4d
 
META_DOCKER_COMMIT=1ca1b5caf6f373dcc49db82dce50f4d8ab9f25cd
 
META_DOCKER_COMMIT=1ca1b5caf6f373dcc49db82dce50f4d8ab9f25cd
 
META_RUST_COMMIT=7ff669d8cedd83a2d3efb73073a63b0a7efffddc
 
META_RUST_COMMIT=7ff669d8cedd83a2d3efb73073a63b0a7efffddc
Line 136: Line 192:
 
cd ${WORK}
 
cd ${WORK}
 
source poky/oe-init-build-env ${WORK}/build
 
source poky/oe-init-build-env ${WORK}/build
 +
bitbake core-image-minimal
 
</syntaxhighlight>
 
</syntaxhighlight>
# ビルドスクリプトを実行
+
# Build
 
#: <syntaxhighlight lang="bash">
 
#: <syntaxhighlight lang="bash">
 
$ chmod a+x build.sh
 
$ chmod a+x build.sh
 
$ ./build.sh <target_board_name>
 
$ ./build.sh <target_board_name>
 
</syntaxhighlight>
 
</syntaxhighlight>
#: target_board_name は使用しているボードによって変える必要があるため、以下のように設定すること。
+
#: target_board_name is specified for each board according to the following table:
#: [[File:R-car-sk-target-board-name.png|400px]]<br>
+
#: [[File:R-car-sk-target-board-name.png|400px]]<br><br>
# ビルド実行
+
#: Depending on the performance of the host PC, it may take several hours for the build to complete.
#: <syntaxhighlight lang="bash">
+
#: When the build completes successfully, you will see the following output:
$ cd <target_board_name>
 
$ source poky/oe-init-build-env
 
$ bitbake core-image-minimal
 
</syntaxhighlight>
 
#: イメージのビルドは、ホストシステムの性能によっては数時間かかることがある。
 
#: ビルドが正常に完了すると、以下のような出力が表示される。
 
 
#: <syntaxhighlight lang="bash">
 
#: <syntaxhighlight lang="bash">
 
NOTE: Tasks Summary: Attempted 4704 tasks of which 31 didn't need to be rerun and all succeeded.
 
NOTE: Tasks Summary: Attempted 4704 tasks of which 31 didn't need to be rerun and all succeeded.
 
</syntaxhighlight>
 
</syntaxhighlight>
# ビルド生成物
+
# Check the built images
#: bitbake を実行して生成されたファイルは以下に格納される
+
#: The built images are stored in the following:
 
#:  <target_board_name>/build/tmp/deploy/images/<target_board_name>/
 
#:  <target_board_name>/build/tmp/deploy/images/<target_board_name>/
# イメージを SD カードに書き込む
+
# Write the images to the SD card
#: SDカードにイメージを書き込む方法は、[[R-Car/Boards/Yocto-Gen3/v5.5.0#Loading_kernel_and_rootfs_via_eMMC.2FSD_card|Loading kernel and rootfs via eMMC/SD card]]を参照。
+
#: Write the images to the SD card with reference to [[R-Car/Boards/Yocto-Gen3/v5.5.0#Loading_kernel_and_rootfs_via_eMMC.2FSD_card|Loading kernel and rootfs via eMMC/SD card]].
#: {{Note}}上記の例はイメージが"weston"のため、'''"minimal"'''に置き換えることに注意すること
+
#: {{Note}} Please replace "core-image-weston" with "core-image-minimal".
  
== How to run sample modules ==
+
== Receive telemetry messages ==
 
# Procedure on the target board
 
# Procedure on the target board
## R-Car SK の起動
+
## Turn on the target board
### R-Car SK に uSD カードを挿入して、LANケーブルを接続する。
+
### Insert the SD card into the target board, and connect the LAN cable to it.
### USB デバッグシリアルケーブルを PC と接続して、AC 電源を投入する。
+
### Use a microUSB cable to connect the target board, connect a power supply to it, and connect to serial console.
### PC 側では、ターミナルソフトを起動して、シリアル接続を行う。
+
### Power on.
### 電源をONにする。
+
###: Short-press SW8 "Power" to switch the board on.
###: R-Car SK の POWER SW(SW8) を押下する。
+
###: If the board is attached to the CCPF board, short-press SW4 "Power" instead of SW8.
###: CCPFが付いている場合は、CCPF基板のPOWER SW(SW4)を押下する。
+
## Configure U-Boot to boot from SD card
## SD ブートを U-Boot で設定
+
##: Refer to [[R-Car/Boards/Yocto-Gen3/v5.5.0#Configure_U-Boot_to_boot_from_SD_card|Configure U-Boot to boot from SD card]].
##: SDブートの設定方法は、[[R-Car/Boards/Yocto-Gen3/v5.5.0#Configure_U-Boot_to_boot_from_SD_card|Configure U-Boot to boot from SD card]]を参照。
+
## Connect to your IoT Hub
## IoT Hub 接続設定
+
##: Configure to connect to your IoT Hub.
##: IoT Hub へ接続するための設定を追加する。
+
### Add a write permission to "/etc/iotedge/config.yaml".
### /etc/iotedge/config.yaml」に書き込み権限を追加する。
 
 
###: <syntaxhighlight lang="bash">
 
###: <syntaxhighlight lang="bash">
 
$ chmod +w /etc/iotedge/config.yaml
 
$ chmod +w /etc/iotedge/config.yaml
 
</syntaxhighlight>
 
</syntaxhighlight>
### 「/etc/iotedge/config.yaml」内の「device_connection_string」の「<ADD DEVICE CONNECTION STRING HERE>」をプライマリ接続文字列に書き換える。
+
### Set the "Primary Connection String" to device_connection_string.
 
###: <syntaxhighlight lang="bash">
 
###: <syntaxhighlight lang="bash">
 
$ vi /etc/iotedge/config.yaml
 
$ vi /etc/iotedge/config.yaml
 
   device_connection_string: "<ADD DEVICE CONNECTION STRING HERE>" ← ★
 
   device_connection_string: "<ADD DEVICE CONNECTION STRING HERE>" ← ★
 
</syntaxhighlight>
 
</syntaxhighlight>
###: {{Note}}プライマリ接続文字列は[[R-Car/Azure_IoT_Hub/v5.5.0-draft#Set_up_in_the_Azure|Register an Azure Device]]を参照。
+
###: {{Note}} See [[#Set_up_in_the_Azure|Register an Azure Device]] for the "Primary Connection String".
### /etc/iotedge/config.yaml」の書き込み権限を削除する。
+
### Remove a write permission from "/etc/iotedge/config.yaml".
 
###: <syntaxhighlight lang="bash">
 
###: <syntaxhighlight lang="bash">
 
$ chmod -w /etc/iotedge/config.yaml
 
$ chmod -w /etc/iotedge/config.yaml
 
</syntaxhighlight>
 
</syntaxhighlight>
### 設定内容を反映させるため、デーモンを再起動する。
+
### Restart the IoT Edge daemon.
 
###: <syntaxhighlight lang="bash">
 
###: <syntaxhighlight lang="bash">
 
$ systemctl restart iotedge
 
$ systemctl restart iotedge
 
</syntaxhighlight>
 
</syntaxhighlight>
## IoT Edge Device の動作確認
+
### Check that the IoT Edge daemon is running.
##: 端末側でiotedge daemon Active となっていることを確認する。
+
###: <syntaxhighlight lang="bash">
##:: <syntaxhighlight lang="bash">
 
 
$ systemctl status iotedge --no-page
 
$ systemctl status iotedge --no-page
 
</syntaxhighlight>
 
</syntaxhighlight>
##:: [[File:Azure-status-no-page.png|1000px]]<br>
+
###: [[File:Azure-status-no-page.png|1000px]]<br><br>
##: 端末側でモジュールがデプロイされ running 状態になっていることを確認する。
+
### Check that the following modules are deployed and are running.
##: {{Note}}デプロイされるまでには数分時間がかかるため、注意すること。
+
###: {{Note}} It may take several minutes for the deployment to complete.
##:: <syntaxhighlight lang="bash">
+
###: <syntaxhighlight lang="bash">
 
$ iotedge list
 
$ iotedge list
 
</syntaxhighlight>
 
</syntaxhighlight>
##:: [[File:Azure-list.png|1000px]]<br>
+
##:: [[File:Azure-list.png|1000px]]<br><br>
# Azure IoT Explorer での動作手順
+
# Procedure on the Azure IoT Explorer
#: Azure IoT Explorer で端末からメッセージが送信されていることを確認する。
+
#: Check that it receives telemetry messages from the IoT Edge Device.
## Azure IoT Explorer をダウンロード / インストール
+
## Install the Azure IoT Explorer.
##:: 下記サイトからインストーラーをダウンロードする。
+
##:: Download the installer from https://github.com/Azure/azure-iot-explorer/releases/tag/v0.14.1.
##:: https://github.com/Azure/azure-iot-explorer/releases
+
##:: {{Note}} Use v0.14.1 because v0.14.7(latest version) does not receive any telemetry messages.
##:: {{Note}}最新版のAzure.IoT.Explorer.preview.0.14.7 では、テレメトリが受信できなかったため、'''Azure.IoT.Explorer.preview.0.14.1''' を使用
+
## Launch the Azure IoT Explorer.
## Azure IoT Explorer を起動する
+
## Get the "Primary Connection String" for the iothubowner.
## IoT Hub の iothubowner 接続文字列を取得する。
+
##: Go the IoT Hub page on the Azure Portal, click your "IoT Hub", "Shared access policies" from the side menu, and then click "iothubowner". Next, copy the  "Primary Connection string".
##: Azure ポータルの「IoT Hub」→ 作成した IoT Hub を選択し、サイドメニューから「共有アクセスポリシー」→「iothubowner」→「プライマリ接続文字列」をコピーする。
 
 
##: [[File:Azure-iot-exp-1.png|1000px]]<br>
 
##: [[File:Azure-iot-exp-1.png|1000px]]<br>
## IoT Hub IoT Explorer に登録する
+
## Register your IoT Hub to the IoT Explorer
##: Azure IoT Explorerのサイドメニューから「IoT hubs」を選択し、「+ Add connection」を押下する。
+
##: Select the "IoT hubs" from the side menu of the Azure IoT Explorer, and click "+ Add connection".
##: 「Connection string」に上記でコピーした「iothubowner 接続文字列」をペーストして、「Save」を押下する。
+
##: Paste the "Primary Connection string" you copied into the "Connection string" text box, finally click the "Save".
## テレメトリを確認する
+
## Receive telemetry messages
##: サイドメニューの「Telemetry」を選択して、「Start」を押下する。
+
##: Select the "Telemetry" from the side menu, and click "Start".
##: しばらくすると以下のようにテレメトリが表示される。
+
##: When a message is received, the following log is displayed.
 
##: [[File:Azure-iot-exp-3.png|1000px]]<br>
 
##: [[File:Azure-iot-exp-3.png|1000px]]<br>

Latest revision as of 20:13, 18 January 2022


Introduction

This page describes how to setup the Yocto environment to use the Azure IoT Edge with R-Car and run it.

This page contains information abot building and running AWS GreenGrass on Yocto environment on:

Topic

EOL Notification of the M3SK

Production of M3SK is discontinued.
See M3SK page for detail.

The new version of R-Car Starter Kit Premier is now on sale !!

  • Equipped with R-Car H3e-2G
    (En) https://www.renesas.com/jp/en/about/press-room/renesas-launches-r-car-gen3e-20-percent-higher-cpu-speed-automotive-infotainment-cockpit-and-digital
    (Zh) https://www.renesas.com/jp/zh/about/press-room/renesas-launches-r-car-gen3e-20-percent-higher-cpu-speed-automotive-infotainment-cockpit-and-digital
    (Jp) https://www.renesas.com/jp/ja/about/press-room/renesas-launches-r-car-gen3e-20-percent-higher-cpu-speed-automotive-infotainment-cockpit-and-digital
  • CPU performance is increased 20% by supporting up to 2GHz frequency over past products.
  • You can buy from here.

SW Release Information

Board name SW name Release date Note
R-Car Starter Kit ( Premier / Pro ) Yocto v5.9.4 (stable) [New!!] 2024/03/28
Kingfisher Infotainment Board Yocto v5.9.0 (stable) 2022/02/14 To check for latest information, please refer to the meta-rcar/tree/v5.9.0.
Android 10 (stable) 2021/07/26 R-Car Starter Kit Premier(R-Car H3) + Kingfisher is supported.
R-Car Starter Kit Pro(RTP8J77961ASKB0SK0SA05A) + Kingfisher is also supported from 2021/11/25.
Android P (stable) 2020/09/29 R-Car Starter Kit Premier(R-Car H3) + Kingfisher is supported.
R-Car Starter Kit Pro(RTP8J77961ASKB0SK0SA05A) + Kingfisher is also supported from 2021/03/16.
CCPF-SK Board Yocto v5.9.0 (stable) 2022/02/08 Prebuilt binary is available in Quick startup guide page. (Updated on 2022/03/18)


Software revisions

Software Revision
Yocto Project 3.1.8
aarch64-poky-linux-gcc (GCC) 9.3
Kernel Ver 5.10.41
Userland 64/32bit 64
U-Boot 2020.10
OP_TEE 3.13.0
IoT Edge 1.1.8

Environment

Host PC

OS Ubuntu 20.04 LTS (64bit)
Memory 8 GB or more
Storage At least 100 GB free

Boards confirmed to work

Board SoC Confirmed
R-Car Starter Kit Premier(H3) H3e-2G v3.0 OK
R-Car Starter Kit Premier(H3) H3 v3.0 (1rank DDR) OK
R-Car Starter Kit Premier(H3) H3 v3.0 (2rank DDR) NT
R-Car Starter Kit Premier(H3) H3 v2.0 with 4GB DDR OK
R-Car Starter Kit Pro M3 v3.0 OK
R-Car Starter Kit Pro M3 v1.0 OK
CCPF-SK + R-Car Starter Kit Premier(H3) H3e-2G v3.0 OK
CCPF-SK + R-Car Starter Kit Premier(H3) H3 v3.0 (1rank DDR) OK
CCPF-SK + R-Car Starter Kit Premier(H3) H3 v3.0 (2rank DDR) NT
CCPF-SK + R-Car Starter Kit Premier(H3) H3 v2.0 with 4GB DDR OK
CCPF-SK + R-Car Starter Kit Pro M3 v3.0 OK
CCPF-SK + R-Car Starter Kit Pro M3 v1.0 OK

18px <translate> Note:</translate> NT='Not Tested' but will work

See also:

Set up in the Azure

  1. Create an Azure account
    Create an Azure account with reference to https://azure.microsoft.com/en-us/free/.
  2. Create an Azure IoT Hub
    Create an Azure IoT Hub with reference to Create an IoT hub.
  3. Register an Azure Device
    Access https://portal.azure.com/ and select your IoT Hub.
    Select "IoT Edge" under "Device Management" from the side menu, and then click "+ Add IoT Edge Device".
    Azure-device-1.png
    Then, set an arbitrary name for "Device ID" and click "Save" without changing the other settings.
    And then, select "IoT Edge" under "Device Management" from the side menu, and click the device ID you created to check the "Primary Connection String".
    (The "Primary Connection String" is used in Receive telemetry messages.)
    Azure-device-3.png
  4. Add the Azure module
    Add the Simulated Temperature Sensor module with reference to Deploy a module.

Required packages

  1. Install the required packages
    $ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
    build-essential chrpath socat cpio python3 python3-pip python3-pexpect \
    xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa \
    libsdl1.2-dev pylint3 xterm
    
    Refer to Yocto Project Quick Start for more information.
  2. Set up initial git configuration
    $ git config --global user.email "you@example.com"
    $ git config --global user.name "Your Name"
    

Building the BSP

  1. Create the following script(build.sh) for building
    #!/bin/bash
    
    BOARD_LIST=("h3ulcb" "m3ulcb" "h3ulcb-ccpf-sk" "m3ulcb-ccpf-sk")
    TARGET_BOARD=$1
    WORK=`pwd`/${TARGET_BOARD}
    
    # Commit ID
    POKY_COMMIT=6ebb33bdaccaeadff0c85aab27acf35723df00d8
    META_OE_COMMIT=c38d2a74f762a792046f3d3c377827b08aade513
    META_RENESAS_COMMIT=0fe77668f5d9a31a5d10449988c3d8fb8dc475c5
    META_RENESAS_CCPF_COMMIT=b49b57d6e68d5cda70aefbed34e06903484c573b
    META_VIRTUALIZATION_COMMIT=c4f156fa93b37b2428e09ae22dbd7f5875606f4d
    META_DOCKER_COMMIT=1ca1b5caf6f373dcc49db82dce50f4d8ab9f25cd
    META_RUST_COMMIT=7ff669d8cedd83a2d3efb73073a63b0a7efffddc
    META_IOTEDGE_COMMIT=06a968a4a662dc5c26aac8d72738767ed72aef52
    
    Usage () {
        echo "Usage: $0 \${TARGET_BOARD_NAME}"
        echo "BOARD_NAME list: "
        for i in ${BOARD_LIST[@]}; do echo "  - $i"; done
        exit
    }
    
    # Check Param.
    if ! `IFS=$'\n'; echo "${BOARD_LIST[*]}" | grep -qx "${TARGET_BOARD}"`; then
        Usage
    fi
    
    mkdir -p ${WORK}
    cd ${WORK}
    
    # Clone basic Yocto layers in parallel
    git clone git://git.yoctoproject.org/poky &
    git clone git://git.openembedded.org/meta-openembedded &
    git clone git://github.com/renesas-rcar/meta-renesas &
    git clone git://git.yoctoproject.org/meta-virtualization &
    git clone git://github.com/tkomagata/meta-docker &
    git clone git://github.com/meta-rust/meta-rust &
    git clone git://github.com/tkomagata/meta-iotedge &
    if [ "${TARGET_BOARD}" = "h3ulcb-ccpf-sk" ] || [ "${TARGET_BOARD}" = "m3ulcb-ccpf-sk" ]; then
        git clone git://github.com/renesas-rcar/meta-renesas-ccpf &
    fi
    
    # Wait for all clone operations
    wait
    
    # Switch to proper branches/commits
    cd ${WORK}/poky
    git checkout -b tmp ${POKY_COMMIT}
    cd ${WORK}/meta-openembedded
    git checkout -b tmp ${META_OE_COMMIT}
    cd ${WORK}/meta-renesas
    git checkout -b tmp ${META_RENESAS_COMMIT}
    cd ${WORK}/meta-virtualization
    git checkout -b tmp ${META_VIRTUALIZATION_COMMIT}
    cd ${WORK}/meta-docker
    git checkout -b tmp ${META_DOCKER_COMMIT}
    cd ${WORK}/meta-rust
    git checkout -b tmp ${META_RUST_COMMIT}
    cd ${WORK}/meta-iotedge
    git checkout -b tmp ${META_IOTEDGE_COMMIT}
    if [ "${TARGET_BOARD}" = "h3ulcb-ccpf-sk" ] || [ "${TARGET_BOARD}" = "m3ulcb-ccpf-sk" ]; then
        cd ${WORK}/meta-renesas-ccpf
        git checkout -b tmp ${META_RENESAS_CCPF_COMMIT}
    fi
    
    TEMPLATECONF=${WORK}/meta-iotedge/conf/machine/${TARGET_BOARD}/bsp/
    
    cd ${WORK}
    source poky/oe-init-build-env ${WORK}/build
    bitbake core-image-minimal
    
  2. Build
    $ chmod a+x build.sh
    $ ./build.sh <target_board_name>
    
    target_board_name is specified for each board according to the following table:
    R-car-sk-target-board-name.png

    Depending on the performance of the host PC, it may take several hours for the build to complete.
    When the build completes successfully, you will see the following output:
    NOTE: Tasks Summary: Attempted 4704 tasks of which 31 didn't need to be rerun and all succeeded.
    
  3. Check the built images
    The built images are stored in the following:
     <target_board_name>/build/tmp/deploy/images/<target_board_name>/
  4. Write the images to the SD card
    Write the images to the SD card with reference to Loading kernel and rootfs via eMMC/SD card.
    18px <translate> Note:</translate> Please replace "core-image-weston" with "core-image-minimal".

Receive telemetry messages

  1. Procedure on the target board
    1. Turn on the target board
      1. Insert the SD card into the target board, and connect the LAN cable to it.
      2. Use a microUSB cable to connect the target board, connect a power supply to it, and connect to serial console.
      3. Power on.
        Short-press SW8 "Power" to switch the board on.
        If the board is attached to the CCPF board, short-press SW4 "Power" instead of SW8.
    2. Configure U-Boot to boot from SD card
      Refer to Configure U-Boot to boot from SD card.
    3. Connect to your IoT Hub
      Configure to connect to your IoT Hub.
      1. Add a write permission to "/etc/iotedge/config.yaml".
        $ chmod +w /etc/iotedge/config.yaml
        
      2. Set the "Primary Connection String" to device_connection_string.
        $ vi /etc/iotedge/config.yaml
          device_connection_string: "<ADD DEVICE CONNECTION STRING HERE>" ← ★
        
        18px <translate> Note:</translate> See Register an Azure Device for the "Primary Connection String".
      3. Remove a write permission from "/etc/iotedge/config.yaml".
        $ chmod -w /etc/iotedge/config.yaml
        
      4. Restart the IoT Edge daemon.
        $ systemctl restart iotedge
        
      5. Check that the IoT Edge daemon is running.
        $ systemctl status iotedge --no-page
        
        Azure-status-no-page.png

      6. Check that the following modules are deployed and are running.
        18px <translate> Note:</translate> It may take several minutes for the deployment to complete.
        $ iotedge list
        
      Azure-list.png

  2. Procedure on the Azure IoT Explorer
    Check that it receives telemetry messages from the IoT Edge Device.
    1. Install the Azure IoT Explorer.
      Download the installer from https://github.com/Azure/azure-iot-explorer/releases/tag/v0.14.1.
      18px <translate> Note:</translate> Use v0.14.1 because v0.14.7(latest version) does not receive any telemetry messages.
    2. Launch the Azure IoT Explorer.
    3. Get the "Primary Connection String" for the iothubowner.
      Go the IoT Hub page on the Azure Portal, click your "IoT Hub", "Shared access policies" from the side menu, and then click "iothubowner". Next, copy the "Primary Connection string".
      Azure-iot-exp-1.png
    4. Register your IoT Hub to the IoT Explorer
      Select the "IoT hubs" from the side menu of the Azure IoT Explorer, and click "+ Add connection".
      Paste the "Primary Connection string" you copied into the "Connection string" text box, finally click the "Save".
    5. Receive telemetry messages
      Select the "Telemetry" from the side menu, and click "Start".
      When a message is received, the following log is displayed.
      Azure-iot-exp-3.png