Making S32G-VNP-EVB Work as a Greengrass Core
AWS IoT Greengrass is a software provided by AWS to extend cloud capabilities to locally connected devices.
This allows local devices to publish/subscribe to a topic even if there is no connectivity with AWS IoT console.
A Greengrass group consists of a Greengrass core, multiple Greengrass devices connected to that core, and lambda functions and other services running on that core.
For more details about AWS IoT Greengrass, refer to
What Is AWS IoT Greengrass.
- AWS Greengrass account
- S32G-VNP-EVB board
- Linux Host (Ubuntu 18.04 was used for this guide)
- Linux Host and S32G target connected to the same LAN
2. Create S32G Image with Greengrass Support
Follow these steps in your Linux host.
If you have previously built a S32G Linux BSP using Yocto, you can skip section 2.1.
2.1 Install Host Dependencies
$ sudo <pkg-mgr> update
$ sudo <pkg-mgr> intall python git curl
$ mdkir ~/bin
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
2.2 Build Greengrass Image
The following steps download the Yocto steps needed to build your image.
$ mkdir <yocto_dir>
$ cd <yocto_dir>
$ repo init -u https://source.codeaurora.org/external/autobsps32/meta-nxp-greengrass
$ repo sync
Setup Host (First time only)
The next step downloads and installs the Yocto dependencies in your host.
Configure Build Directory
Next step creates your build directory and configures the extra layers to use.
The value <machine> can be S32G-VNP-EVB.
$ source nxp-setup-alb.sh -m <machine> -b <build_dir> -e "meta-aws meta-java meta-nxpgreengrass
S32-VNP-RDB only: Install PFE Firmware
Skip this change for the S32G-VNP-EVB board.
The meta-nxp-greengrass layer uses eth0 interface for internet access in the S32G-VNP-EVB and pfe2 in the S32G-VNP-RDB or S32G-VNP-RDB2. To use pfe2, include the following lines in the
Note: PFE firmware is available through Flexera.
DISTRO_FEATURES_append = " pfe"
PFE_LOCAL_FIRMWARE_DIR = "<path_to_pfe_fw_directory>"
The image with Greengrass support is fsl-image-auto-greengrass.
$ bitbake fsl-image-auto-greengrass
2.3 Flash Image and Boot
Insert the SD card in your linux host and perform the following commands.
$ sudo umount /dev/<device mmcblkp* or sdX*>
$ cd tmp/deploy/images/<machine>/
$ sudo dd if=<machine>-fsl-image-auto-greengrass.sdcard of=/dev/mmcblk0 bs=4M status=progress
Insert the SD card in your target and power up.
Stop at U-Boot and change environment variables to use GMAC “eth0” as default ethernet adapter
$ setenv ethact eth_eqos
$ setenv pfeng_mode enable,none,none,rgmii
First Time Boot
When booting for the first time, Greengrass daemon will fail because of missing certificates.
Use the following sections to get and install the certificates and to deploy the cloud configurations to the Greengrass core.
3. Prepare Greengrass Group
Use the following instructions from the AWS IoT Greengrass web page.
4. Deploy Cloud Configurations to a Greengrass Core
In “Configure AWS IoT Greengrass on AWS Iot” you downloaded one file in your host, hash-setup.tar.gz (for example, c6973960cc-setup.tar.gz). This compressed file contains the core device
certificate and cryptographic keys that enable secure communications between AWS IoT Core and the config.json file that contains configuration information specific to your Greengrass
Place hash-setup.tar.gz in target rootfs.
Execute the following command from your Linux host to transfer the .tar.gz file to your target.
$ scp hash-setup.tar.gz root@<target_ip_address>:/
In your target, decompress the file in the /greengrass folder and download the Amazon Root CA 1 certificate.
Once that is done you can reboot.
$ tar -xzvf hash-setup.tar.gz -C /greengrass
$ cd /greengrass/certs/
$ wget -O root.ca.pem https://www.amazontrust.com/repository/AmazonRootCA1.pem
Now, with the correct certificates the Greengrass should start with no errors after reboot:
Deploy could configurations to a Greengrass code device
instructions from step 2 and make sure that the S32G Greengrass core is connected to the internet.
5. Verify the Lambda Function
If you created the Lambda function and used the “HelloWorld” example, follow
Verifiy the Lambda function is running on the core device
to test if it is running as expected.
If the instructions were followed correctly you should see an output like the following:
If you got to this point, you have Greengrass Core running on the S32G.
6. Add ML Frameworks Support
The image built by Yocto supports tensorflow 1.13. To double check, execute the following the below command in the target:
$ python3 -c "import tensorflow as tf; print(tf.__version__)"
The image features libmxnet.so in the rootfs, but the next steps should be executed in the target to support it with Python.
$ cd /mxnet/python
$ python3 setup.py Install
To verify the version, execute the following:
$ python3.7 -c "import mxnet; print(mxnet.__version__)"
To add DLR support, execute the next commands in the target:
$ wget https://neo-ai-dlr-release.s3-us-west-2.amazonaws.com/v1.2.0/a1-aarch64-ubuntu18_04-glibc2_27-libstdcpp3_4/dlr-1.2.0-py2.py3-none-any.whl
$ pip3 install dlr-1.2.0-py2.py3-none-any.whl
After installing DLR, check its version with:
$ python3 -c "import dlr; print(dlr.__version__)"