by

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 Mender 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 Mender OS was. I asked nicely on Coral website if the tooling to generate Mender 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: Initialize repo manifest: Fetch layers in manifest: Clone meta-coral: Setup the environment: Add the meta-coral layer to bblayers.conf: Start baking: After the build has finished you should now have a WIC image:
  • tmp/deploy/images/coral-dev/core-image-base-coral-dev.wic.gz
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,
Boot modeSwitch 1Switch 2Switch 3Switch 4
SD CardONOFFONON
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: 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 Happy testing and feel free to reach out if you are interested in getting involved.

Write a Comment

Comment

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

This site uses Akismet to reduce spam. Learn how your comment data is processed.

11 Comments

  1. Awesome work I was planning on trying to get yocto running on this a few months ago and never had the time. I have some ML stuff running tensorflow lite and yocto, so this might be a natural extension of that.

    • Cool, I am not really in the ML space and my expertise is in getting hardware running :). If you end up with some examples that can shared it would be cool to include that in the meta-coral layer.

      I do plan to move over the demos from Mendel OS, eventually.

  2. I build on ubuntu 16 desktop and meeet a error as below, it seems not found u-boot-nodtb.bin, any suggestion to fix this issue? thanks.

    ======================================================
    ERROR: imx-boot-0.2-r0 do_compile: Function failed: do_compile (log file is located at /home/vmuser/projects/coral/build/tmp/work/coral_dev-fslc-linux/imx-boot/0.2-r0/temp/log.do_compile.28103)
    ERROR: Logfile of failure stored in: /home/vmuser/projects/coral/build/tmp/work/coral_dev-fslc-linux/imx-boot/0.2-r0/temp/log.do_compile.28103
    Log data follows:
    | DEBUG: Executing shell function do_compile
    | NOTE: 8MQ/8MM boot binary build
    | NOTE: Copy ddr_firmware: lpddr4_pmu_train_1d_imem.bin from /home/vmuser/projects/coral/build/tmp/deploy/images/coral-dev -> /home/vmuser/projects/coral/build/tmp/work/coral_dev-fslc-linux/imx-boot/0.2-r0/git/iMX8M
    | NOTE: Copy ddr_firmware: lpddr4_pmu_train_1d_dmem.bin from /home/vmuser/projects/coral/build/tmp/deploy/images/coral-dev -> /home/vmuser/projects/coral/build/tmp/work/coral_dev-fslc-linux/imx-boot/0.2-r0/git/iMX8M
    | NOTE: Copy ddr_firmware: lpddr4_pmu_train_2d_imem.bin from /home/vmuser/projects/coral/build/tmp/deploy/images/coral-dev -> /home/vmuser/projects/coral/build/tmp/work/coral_dev-fslc-linux/imx-boot/0.2-r0/git/iMX8M
    | NOTE: Copy ddr_firmware: lpddr4_pmu_train_2d_dmem.bin from /home/vmuser/projects/coral/build/tmp/deploy/images/coral-dev -> /home/vmuser/projects/coral/build/tmp/work/coral_dev-fslc-linux/imx-boot/0.2-r0/git/iMX8M
    | cp: cannot stat ‘/home/vmuser/projects/coral/build/tmp/deploy/images/coral-dev/imx-boot-tools/u-boot-nodtb.bin’: No such file or directory
    | WARNING: exit code 1 from a shell command.
    | ERROR: Function failed: do_compile (log file is located at /home/vmuser/projects/coral/build/tmp/work/coral_dev-fslc-linux/imx-boot/0.2-r0/temp/log.do_compile.28103)
    ERROR: Task (/home/vmuser/projects/coral/sources/meta-freescale/recipes-bsp/imx-mkimage/imx-boot_0.2.bb:do_compile) failed with exit code ‘1’
    NOTE: Tasks Summary: Attempted 1639 tasks of which 1031 didn’t need to be rerun and 1 failed.
    NOTE: Writing buildhistory

    Summary: 1 task failed:
    /home/vmuser/projects/coral/sources/meta-freescale/recipes-bsp/imx-mkimage/imx-boot_0.2.bb:do_compile
    Summary: There was 1 ERROR message shown, returning a non-zero exit code.

    • I believe that I have also seen this and seems to be a race condition in imx-boot recipe. The quick workaround is just to run:

      • This workaround is not worked for me, It seems we generate wrong file name for build/tmp/deploy/images/coral-dev/imx-boot-tools/u-boot-nodtb.bin-coral-dev-sd, I rename it to build/tmp/deploy/images/coral-dev/imx-boot-tools/u-boot-nodtb.bin, the build process is continued.
        I’m not familiar with yocto, may be there is some error in one recipe to generate this u-boot-nodtb.bin.

          • Do you remember how to fix this bug? 🙂 thanks.

          • I believe I just worked around it with a manual edit (same as you).

            To fix it properly, I would need to do some more research as the recipe is used by many boards.

  3. Great Job! I have a very basic question about formatting sd-card. What kind of format did you use? I was successful to make images. But Can’t not boot from sd-card. Can I see that prompt from HDMI? Thanks.