Skip to content

Bake 64-bit raspberryPI3 images with Yocto/OpenEmbedded

Overview

RaspberryPI3 SBC and CM come with cortex-a53 based SOC which is 64-bit capable and uses ARM-v8 architecture. Originally RaspberryPI 3 was released with 32bit support alone which is backward compatible with RaspberryPI 2. However, over period of last couple of years a lot of development has gone into enabling 64-bit on ARM in community,  Eric Anholt’s VC4 drivers have matured on 64bit kernels, various userspace packages have been ported by Linaro and other communities.  We have put efforts in integrating all these efforts for full system using OpenEmbedded/Yocto framework. The support is fairly new and therefore there might be some issues still lurking, Here we will go through the steps for building full Graphical images.

Build Setup

Since the support is new, its recommended to use Rocko 2.4 release or newer

mkdir rpi-yocto; cd rpi-yocto
git clone git://git.yoctoproject.org/poky
git clone git://git.openembedded.org/meta-openembedded
git clone git://git.yoctoproject.org/meta-raspberrypi
git clone git://github.com/96boards/meta-96boards

source poky/oe-init-build-env rpi64-build

bitbake-layers add-layer ../meta-raspberrypi
bitbake-layers add-layer ../meta-96boards
bitbake-layers add-layer ../meta-openembedded/meta-oe
bitbake-layers add-layer ../meta-openembedded/meta-python
bitbake-layers add-layer ../meta-openembedded/meta-perl
bitbake-layers add-layer ../meta-openembedded/meta-multimedia 
bitbake-layers add-layer ../meta-openembedded/meta-networking
bitbake-layers add-layer ../meta-openembedded/meta-gnome
bitbake-layers add-layer ../meta-openembedded/meta-xfce

Edit conf/local.conf  to set machine

MACHINE = "raspberrypi3-64"

Build Sato Image ( Yocto Project Reference GUI image )

bitbake core-image-sato

Build XFCE image

If you intend to build a full desktop system like XFCE then build core-image-minimal-xfce

bitbake core-image-minimal-xfce

Prepare SD-Card

sudo dd if=tmp/deploy/images/raspberrypi3-64/core-image-sato-raspberrypi3-64.rpi-sdimg of=/dev/sdX

where X is the letter a,b,c which your build machine would have mounted the Micro-SD card on you can check that with

dmesg | tail -10

Resize SD-Card

Add in local.conf

CORE_IMAGE_EXTRA_INSTALL_append = " 96boards-tools "

build the image again and flash it to SD-Card, this will expand the rootfs to span over complete SD card.

Using MUSL C library

Musl is a light weight alternative to glibc which is fully supported in OpenEmbedded-core and Yocto project. In order to use musl instead of glibc add ( in local.conf )

TCLIBC = "musl"

Using Clang Compiler

Clang is supported via a layer of its own, if you intend to use clang to compile the packages, you have to add meta-clang to layer mix.

cd rpi-yocto; git clone git://github.com/kraj/meta-clang

bitbake-layers add-layer ../meta-clang

If clang should be used as default compiler then add following in local.conf

TOOLCHAIN ?= "clang"

Please note that there is a small number of packages which still would use gcc to build. e.g. for core-image-sato we still build following packages with gcc

  • pixman
  • linux-kernel
  • glibc( if you use it)
  • elfutils
  • tcp-wrappers
  • busybox

Status

What works

  • Ethernet
  • Graphics
  • USB
  • Keyboard/mouse
  • HDMI

TO-DO

  • Validate bluetooth
  • Validate on board WiFi
  • Video playback
  • Sound

Need Help ?

Please ask questions on IRC or mailing lists

irc.freenode.net#yocto
irc.freenode.net#oe

Mailing lists

yocto@yoctoproject.org
openembedded-devel@lists.openembedded.org

9 thoughts on “Bake 64-bit raspberryPI3 images with Yocto/OpenEmbedded”

  1. This is cannot work! Buddies are (copy/paste) professionals.
    bitbake-layers add-layer ../meta-openembedded/meta-xfce
    bitbake-layers add-layer ../meta-openembedded/meta-gnome
    For those layers at least x11 layer is required, indeed 😉

    1. Its not clear from your comment but I guess you meant the dependencies were not ordered. I have changed the layer adding order which hopefully addresses the problem.

  2. Hello Khem,
    i am very new to Yocto, i just followed all your steps and got following error

    WARNING: gcc-source-7.3.0-7.3.0-r0 do_fetch: Failed to fetch URL file://0008-c99-snprintf.patch, attempting MIRRORS if available

    ERROR: gcc-source-7.3.0-7.3.0-r0 do_fetch: Fetcher failure: Unable to find file file://0008-c99-snprintf.patch anywhere. The paths that were searched were:

    /home/user/yocto_project/meta-openembedded/openembedded-core/meta/recipes-devtools/gcc/gcc-7.3/poky
    and many other relevant Paths.

    ERROR: gcc-source-7.3.0-7.3.0-r0 do_fetch: Fetcher failure for URL: ‘file://0008-c99-snprintf.patch’. Unable to fetch URL from any source.
    ERROR: gcc-source-7.3.0-7.3.0-r0 do_fetch: Function failed: base_do_fetch
    ERROR: Logfile of failure stored in: /home/user/yocto_project/rpi64-build/tmp/work-shared/gcc-7.3.0-r0/temp
    /log.do_fetch.14280
    ERROR: Task (/home/user/yocto_project/meta-openembedded/openembedded-core/meta/recipes-devtools/gcc/gcc-source_7.3.bb:do_fetch) failed with exit code ‘1’

    then i picked this named 0008-c99-snprintf.patch file from the following link:
    http://git.openembedded.org/openembedded-core/diff/

    ERROR: gcc-source-7.3.0-7.3.0-r0 do_patch: Command Error: ‘quilt –quiltrc /home/user/yocto_project/rpi64-build/tmp/work-shared/gcc-7.3.0-r0/recipe-sysroot-native/etc/quiltrc push’ exited with 0 Output:
    Applying patch 0008-c99-snprintf.patch
    can’t find file to patch at input line 5
    Perhaps you used the wrong -p or –strip option?
    The text leading up to this was:
    ————————–
    |diff –git a/meta/recipes-devtools/gcc/gcc-7.3.inc b/meta/recipes-devtools/gcc/gcc-7.3.inc
    |index d968c32..faf0622 100644
    |— a/meta/recipes-devtools/gcc/gcc-7.3.inc
    |+++ b/meta/recipes-devtools/gcc/gcc-7.3.inc
    ————————–
    No file to patch. Skipping patch.
    1 out of 1 hunk ignored
    The next patch would delete the file meta/recipes-devtools/gcc/gcc-7.3/0008-c99-snprintf.patch,
    which does not exist! Applying it anyway.
    patching file meta/recipes-devtools/gcc/gcc-7.3/0008-c99-snprintf.patch
    Hunk #1 FAILED at 1.
    1 out of 1 hunk FAILED — rejects in file meta/recipes-devtools/gcc/gcc-7.3/0008-c99-snprintf.patch
    Patch 0008-c99-snprintf.patch does not apply (enforce with -f)
    ERROR: gcc-source-7.3.0-7.3.0-r0 do_patch: Function failed: patch_do_patch
    ERROR: Logfile of failure stored in: /home/user/yocto_project/rpi64-build/tmp/work-shared/gcc-7.3.0-r0/temp/log.do_patch.20838
    ERROR: Task (/home/user/yocto_project/meta-openembedded/openembedded-core/meta/recipes-devtools/gcc/gcc-source_7.3.bb:do_patch) failed with exit code ‘1’

    1. the instructions suggest to use master branch, its possible that there were some internet access hitches when you tried it. Can you try either by using sumo ( 2.5 ) release branch and see if you can build it you need to add

      git clone git://git.yoctoproject.org/poky -b sumo
      git clone git://git.openembedded.org/meta-openembedded -b sumo
      git clone git://git.yoctoproject.org/meta-raspberrypi -b sumo
      git clone git://github.com/96boards/meta-96boards -b sumo

      to checkout cmds.

  3. Small error in dd, You need to reference raspberrypi3-64:
    sudo dd if=tmp/deploy/images/raspberrypi3-64/core-image-sato-raspberrypi3-64.rpi-sdimg of=/dev/sdX

Leave a Reply

Your email address will not be published. Required fields are marked *