This page contains instructions for setting up Afero Potenco, a secure Linux device that can also function as a hub for Afero enabled Bluetooth® low energy devices.
The instructions on this page explain how to flash the image to the internal eMMC memory slot on a Microchip SAMA5D2 board, and connect the Afero Hardware Security Module (HSM). The OS image can be provided by Afero, or you can build it yourself to include your own customizations, depending on your needs.
This page contains the following sections:
Afero Potenco devices run on a Yocto Linux platform; specifically:
You will need the following pieces of hardware:
You will need to download the firmware image for your development board from Afero. Follow the instructions below to get the correct image:
To install and boot a Potenco Operating System image on the SAMA5D2 development board, follow the instructions below.
Follow the instructions below to build the OS image.
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \ build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \ xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \ xterm
You will need to get the repo
command. On Ubuntu 16.04, type:
$ sudo apt-get install repo -y
Afero Yocto builds an image with the following settings:
These build environment variables are defined in the conf/local.conf
file but can be overridden in the bitbake command line.
Follow the build steps below:
$ mkdir sama5 $ cd sama5
yocto/poky
GitHub repository with the proper branch ready:
$ git clone git://git.yoctoproject.org/poky -b sumo
meta-openembedded
GitHub repository with the proper branch ready:
$ git clone git://git.openembedded.org/meta-openembedded -b sumo
meta-qt5
GitHub repository with the proper branch ready:
$ git clone git://code.qt.io/yocto/meta-qt5.git $ cd meta-qt5 $ git checkout v5.9.6 $ cd ..
meta-atmel
layer with the proper branch ready:
$ git clone git://github.com/linux4sam/meta-atmel.git -b sumo
sama5-hub-manifest
. This clones meta-afero and various sources (hubby, attrd, etc.). The source repos will be put into src_afero
.
$ repo init -u ssh://git@github.com/AferoCE/sama5-hub-manifest.git $ repo sync -j8
poky
directory to configure the build system and start the build process:
$ cd poky
$ cp ~/sama5/meta-afero/scripts/oe-buildenv-internal ~/sama5/poky/scripts/oe-buildenv-internal $ source oe-init-build-env build-microchip
$ cp ~/sama5/meta-afero/conf/bblayers.conf ~/sama5/poky/build-microchip/conf/bblayers.conf $ cp ~/sama5/meta-afero/conf/local.conf ~/sama5/poky/build-microchip/conf/local.conf
Any changes to bblayers.conf or local.conf need to be saved to the meta-afero version. Specifically…
If you change the following files:
~/sama5/poky/build-microchip/conf/local.conf
~/sama5/poky/build-microchip/conf/bblayers.conf
You must copy them and commit the changes to repo:
~/sama5/meta-afero/conf/bblayers.conf
~/sama5/meta-afero/conf/local.conf
$ rm ~/sama5/meta-atmel/recipes-bsp/at91bootstrap/at91bootstrap_3.8.11.bb
$ BUILD_TYPE=prod BUILD_TARGET=debug BUILD_PROFILE=potenco bitbake core-image-minimal
bitbake
cleaning the tmp dir for the Afero source packages. Then compile and build the image for BUILD_TYPE=prod
:
$ bitbake -c cleansstate beetle af-conn af-edge af-ipc af-sec af-util attrd hubby otamgr $ BUILD_TYPE=prod BUILD_TARGET=debug BUILD_PROFILE=potenco bitbake core-image-minimal
The SD card slot on the board is used to connect the Wi-Fi+BT combo chip so we don’t build the image for an SD card. We use the eMMC-based image as we must flash the image to the internal eMMC. The image target we build is sama5d2-xplained-emmc
.
You will need to obtain the SAM-BA software from Microchip to flash the SAMA5D2 image to the eMMC on your SAMA5D2 Potenco. You download this tool, version 3.2.3 (on Linux) from GitHub: https://github.com/atmelcorp/sam-ba/releases.
Make sure you add the path of the executable to your $PATH.
The SAMA5D2 board provides a FTDI-based debug port; namely, the six (6) pins adjacent to the Ethernet port.
/dev/ttyUSBx
Where x
is a number such as 0, 1, etc.
$ picocom -b 115200 /dev/ttyUSB0
$ ll /dev/ttyA* crw-rw---- 1 root dialout 166, 0 Jun 8 17:52 /dev/ttyACM0
$ cat /etc/group | grep dialout dialout:x:20:tina
$ sam-ba -p usb -b sama5d2-xplained -a serialflash -c erase::0x3000 -c writeboot:at91bootstrap-sama5d2_xplained.bin
$ sam-ba -p usb -b sama5d2-xplained -a serialflash -c erase:0x8000:0x70000 -c write:u-boot-sama5d2-xplained-emmc.bin:0x8000
$ sam-ba -p usb -b sama5d2-xplained -a sdmmc -c write:core-image-minimal-sama5d2-xplained-emmc.wic
$ sam-ba -p usb -d sama5d2 -a bootconfig -c writecfg:bscr:valid,bureg0 -c writecfg:bureg0:QSPI0_IOSET1,QSPI1_IOSET1,SPI0_IOSET1,SPI1_IOSET1,NFC_IOSET1,SDMMC0,SDMMC1_DISABLED,UART1_IOSET1,JTAG_IOSET1
$ sam-ba -p usb -d sama5d2 -a bootconfig -c readcfg:bscr -c readcfg:bureg0 -c readcfg:bureg1 -c readcfg:bureg2 -c readcfg:bureg3 -c readcfg:fuse
u-boot.env
file. Set the bootcmd
and save the boot env:
=> setenv bootcmd 'fatload mmc 0:1 0x21000000 sama5d2_xplained.itb; bootm 0x21000000#kernel_dtb#' => saveenv Saving Environment to FAT... writing uboot.env OK
boot
command.The error shown below means you need to open the BOOT_DIS jumper, and try again:
$ sam-ba -p usb -b sama5d2-xplained -a serialflash -c erase::0x3000 -c writeboot:at91bootstrap-sama5d2_xplained.bin Opening serial port 'ttyACM0' Connection opened. /home/user/Downloads/myTools/sam-ba_3.2.3/qml/SAMBA/Applet.qml:232: Error: Could not initialize applet (status: 1) Connection closed.
The SAMA5D2 board has a different I/O connector pinout than the Peaberry board, so it must be manually wired to connector J18 on the board.
In the first diagram below, the Peaberry board is shown with the connector facing up. Connect the four pins shown to connector J18 as follows:
Power VDD to J18 pin 1
GND to J18 pin 2
I2C_SCL to J18 pin 7
I2C_SDA to J18 pin 8
Cape Expansion Headers:
The Potenco SDK is a set of binary packages that you can supply to your customers to develop applications for the Potenco OS, without having access to all the repositories needed to build the entire OS image.
Installation and use of the Potenco SDK is covered in a separate document.
$ cd ~/sama5/ $ source oe-init-build-env build-microchip
$ bitbake -c populate_sdk core-image-minimal
/poky/build-microchip/tmp/deploy/sdk
Download the Afero mobile app, if you haven’t already, and sign in. The Peaberry board should have come with a couple of QR Code stickers, including one on the back of the board. Scan the QR Code in the Afero mobile app to add the Potenco hub to your account. Once online, any Afero BLE devices on your account will use the Potenco hub to connect to the Afero Cloud.
Potenco also acts as an Afero edge device and can communicate with the Afero Cloud as a connected device in addition to acting as a hub. You can create a Potenco profile in the Afero Profile Editor, and attributes that you define in that profile can be accessed via scripts running on the Potenco board.
If you have any questions or issues with Potenco please use the project's GitHub Project Issue Tracker.