Running a Yocto generated distribution on Google Coral Dev Board
Last week I got my hands on a Google Coral Dev Board and finally got some time to play with it.
If you are not familiar with this board please read this article and also pay the official product site a visit for more technical details.
But in short it is a Linux based System-on-Module called Edge TPU Module that is mounted on a development board which contains some additional peripherals.
Some key hardware features of the EDGE TP Module:
i.MX8MQ SoC with integrated GPU
1 GB LPDDR4
8 GB eMMC
Google Edge TPU coprocessor (used to accelerate ML models)
WiFI / Bluetooth
The Coral Dev Board serves as an evaluation board for the Edge TPU Module but it can also be used as a single-board computer similar to Rasbperry Pi 3 boards.
The Coral Dev Board comes with Linux distribution called Mendel OS which is Debian derivative. The board did not actually contain the Mendel OS pre-programmed, and I had to flash the board to get started. But this was relativity easy as they do provide pre-built OS images and well documented procedure how to flash the board. You can find the getting started guide here,
As I spend a lot of time building Linux distributions using Yocto/OE-core and Linux distributions on embedded Linux devices in general are of interest to me, I had to dig deeper in what Mendel OS was.
I asked nicely on Coral website if the tooling to generate Mendel OS was available publicly, and I received a prompt response that it was and I got this link:
By following the outlined documentation above, I was able to fetch the source code of all the components for further inspection. There where no real surprises when I started looking closer and soon realized that that Mendel OS was built upon fairly standard components coming from the NXP i.MX BSP for the i.MX8 SoC.
With this information I realized that I would be fairly easy to port this and I set out to create a Yocto BSP layer to be able to build something that boots on the Coral Dev Board. I only needed to implement three things in this layer to get it to boot:
Recipe for U-boot fork
Recipe for Linux kernel fork
Created a recipe to deploy a boot.scr, and the source for the script I copied from Mendel OS
To build an image with Yocto you can use the following steps,
Create directory where you want to store the environment and change the shell to that location:
This is an image that you can write either to the eMMC or an SD card to get a booting system.
To simplify things I changed boot mode of the Coral Dev Board to boot from SD card instead of eMMC which is the default, and to do this I adjusted the boot switches to the following,
Here is a picture of the boot switches in “SD card mode”
Since we already built our image, we can now write it to a SD card:
Insert the SD card and boot the system, we should now end up at login prompt of a Yocto build distribution:
FSLC Wayland2.7coral-dev ttymxc0
I have not yet done much testing of the different peripherals, but the basic components (HDMI, Ethernet, USB) should work as I am using the same Linux kernel as Mendel OS. I know of a couple of things that need some more work as it depends on user-space components, and here is a very short list:
WiFi and Bluetooth (need to install correct firmware files)
Google Edge TPU coprocessor (would be fun to get the ML demo from Mendel OS running in Yocto)
The source code of the Yocto/OE-core BSP layer for Google Coral Dev can be found here