Build the AWS AI at the Edge Demo Image
Introduction
The AWS AI at the Edge demonstration is built on top of the Torizon Cloud. Nevertheless, some degree of customization is done to the TorizonCore image:
- Greengrass Core Software is added and runs on the base image.
- The deep learning inference engine runs on the base image.
- Docker compose files and systemd services to control them are added for the conteinerized applications.
The preferred method for using the AWS AI at the Edge demonstration is by installing the image from the Toradex Easy Installer online feeds. The alternative way - to build the image by yourself - is documented in this article.
This article complies with the Typographic Conventions for Torizon Documentation.
Prerequisites
You must have already set up a Yocto build environment for TorizonCore. You can follow the instructions from:
For instance, to only configure but don't build:
the following instruction is a hint, but it does not replace going through the instructions from the Build TorizonCore With Yocto article.
$ cd ${HOME}
$ mkdir yocto-workdir
$ docker run --rm -it --name=crops -v ${HOME}/yocto-workdir:/workdir torizon/crops-toradex --workdir=/workdir --cmd="MACHINE=apalis-imx8 startup-tdx-torizon.sh"
Setup the meta-pasta-demo layer
With the setup already configured for a TorizonCore build, clone the meta-pasta-demo layer to the layers directory:
$$ cd <layers directory>
$$ git clone https://github.com/toradex/meta-pasta-demo.git
Enter the meta-pasta-demo directory and run the config.sh script. It applies patches to other layers, fetches extra layers, configures a sample local.conf and adds meta-pasta-demo and the extra layers to bblayers.conf:
$$ cd meta-pasta-demo
$$ ./config.sh
$$ cd ../../build-torizon
Make sure to accept the FSL_EULA, since the accept variable is commented in the sample file. The EULA is at layers/meta-freescale/EULA and you should have already read it during the setup of the Yocto environment:
ACCEPT_FSL_EULA="1"
Add Greengrass Core Device Credentials - Optional
Add the greengrass core device credentials to recipes-aws/aws-iot-greengrass-core-software/files/core-device-secret.tar.gz and add aws-iot-greengrass-core-software-device-credentials
to recipes-images/images/pasta-demo.bb.
if you skip this section, you can add the credentials after the image is installed on the target.
Add OTA Credentials - Optional
Add Aktualizr OTA credentials to recipes-sota/aktualizr/files/credentials.zip and uncomment related lines at conf/local.conf.example and recipes-images/images/pasta-demo.bb.
this is only useful if you plan to update components from the base image. For containers and/or AWS Greengrass, there are other options.
Build the pasta-demo Image
The AWS AI at the Edge demo image is named pasta-demo, as a reference to the pasta detection application. Build the image:
$$ bitbake -k pasta-demo
If you skip the optional steps above, a warning will be printed for each. It is safe to ignore them:
WARNING: /workdir/torizon/build-torizon/conf/../../layers/meta-pasta-demo/recipes-sota/aktualizr/aktualizr-pasta-demo.bb: Unable to get checksum for aktualizr-pasta-demo SRC_URI entry credentials.zip: file could not be found
WARNING: /workdir/torizon/build-torizon/conf/../../layers/meta-pasta-demo/recipes-aws/aws-iot-greengrass-core-software/aws-iot-greengrass-core-software-device-credentials.bb: Unable to get checksum for aws-iot-greengrass-core-software-device-credentials SRC_URI entry core-device-secret.tar.gz: file could not be found
The binary image will be available in deploy/images/apalis-imx8.