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.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

We need Open Source ISA and methods for Chip design and Hardware

The open source phenomenon has swept the software industry in past few decades, and Linux based Operating Systems have taken the software world by storm. The Linux foundation has published studies where the worth of Linux is estimated at billions of dollars, but to me as an individual, it is priceless. High quality open source Compilers and tools for various language runtimes are readily available with source code. Ready to install OS distributions are a common thing. We have learnt that if we want to build something sustainable and scalable, open source development is a proven methodology and has become the primary choice.

Large organizations have embraced open source software tools and technologies, and have started open source software offices for helping the organization with adopting open source. Research and development budget is shifting an increasing portion to do open source software development. If we look into pie-charts of software composition in products, the open source share is even-increasing piece year after year. We have become more comfortable in collaborating in open ways where it is serving the common good, and keep the competition to where value is added.

Open source has certainly helped software in so many ways. Open collaboration alone has reduced the cost, and time to market. There has never been so much knowledge shared freely available to community. We have arrived at golden era of software development and it’s not limited to only a privileged few. The Internet has enabled us to share technology across the world.  The next whiz-kid sitting in remote corner of the world is not at disadvantage anymore. We should all be proud of this achievement. Recently I met with youngsters from the Caribbean, who were learning ins and out of full software stack on the Raspberry PI.  The real software revolution has just begun.

Can we apply Open Source techniques to chip & hardware design

My interaction with kids from the Caribbean turned into an interesting discussion when we started to talk about graphics stacks and how the low level software was coming in the way of their learning since they did not have source code for it.

Hardware is viewed as a brick, cast in stone, because it comes from a chosen few and they get to decide what to make. Secondly, customization costs are enormous, design cycles are looong. Today, all someone needs is a computer to unleash the software design ingenuity. This is not the case for hardware. Someone who has a great idea to solve a problem for the next Internet of things (IoT) wave does not have tools and techniques available as of today to implement it in hardware. Today, different kinds of demands for computing is taking us beyond general purpose computing, to application specific computer design.  We will need different hardware to solve new problems where existing system architectures are proving to be inefficient. There is a need for tools and techniques to do hardware design on par with the cost and pace of software. Software has blazed the trail using Open Source techniques, and hardware design will follow these footsteps.

As an example, IoT will require more chips and different kind of chips than ever at a scale that has never been seen before. The sensors will be required to be doing more computing yet get cheaper in price. ESP8266 drastically low priced WiFi chip with full TCP/IP stack has been adopted widely and has changed the low-cost WiFi space. Bluetooth LE mesh is another promising connectivity technology for IoT, and I imagine we are not far from designing a 25 cents BLE mesh chip low cost solution and transform the BLE markets forever. However, this will require a completely different way of thinking about design and manufacturing, since incremental design and manufacturing  process will not cut the bill.

Architectures (like RISC-V) which are completely open source from the ground up, and available to academia and industry, are the first steps in realizing this dream for hardware design.  These technologies are  accessible to everyone from schools to the semiconductor industry. In the future I hope a whiz-kid from remote corners of the world will be able to design the hardware with same access and tooling we have for software design today. That is going to unleash innovation like never before. When an optimized solution consists of efficient software running on efficient hardware, yet sharing the common good across hardware and software, we can really present technology as a compelling solution to fix enormous problems that humanity is facing. There is tremendous interest developing around Open Instruction Set Architectures ( ISA).  An openly licenced ISA would enable anyone to design a custom CPU yet be able to reuse the software ecosystem since the ISA would remain common. This would also make the instruction set architecture robust as it will be developed with constraints from different applications. This added excitement  is a good sign, back when Linux was in infancy, things were exactly same.

                            Hardware designers, Welcome On-board !!

PS: A big Thanks to Cliff Brake for adding data-points and reviews