Skip to content
Peter Saunderson edited this page Aug 18, 2016 · 6 revisions

Home / Tutorial Index / Getting started

Initial Setup Creating the SD Card

Configuring the Linux distribution

In the previous step the parallella-yoctobuild submodule was populated with various folders and submodules from the Yocto project and community. The basic principle of Yocto is that there are recipes built in layers with increasing priority. By defining a new layer (meta-example) in this case, we can inherit build steps from other layers to construct a Linux distribution that is taylored to our own requirements. Because we inherit most of the complex build steps we only have to override a few details to build our system. Look in parallella/parallella-yoctobuild/meta-example/conf/layer.conf to see that we are adding recipes from our .bb files from any folder named recipes* under meta-example. (Tip: meta-example is not in the file system? fear not and look at the last section on this page)

BBFILES := "${BBFILES} ${LAYERDIR}/recipes*/*/*.bb"
BBFILES += " ${LAYERDIR}/recipes*/*/*.bbappend"

This layer.conf file is the way that the build scripts (bitbake) find our image definition file at parallella/parallella-yoctobuild/meta-example/recipes/images/hdmi-image-example.bb. In the image definition file hdmi-image-example.bb I have given some examples of packages that might be added to the distribution, try adding i2c-tools to the list by specifying the addition of i2c-tools:

IMAGE_INSTALL += "i2c-tools"

This will instruct the build scripts (bitbake) to look for, and add the receipe found in parallella/parallella-yoctobuild/poky/meta/recipes-devtools/i2c-tools/i2c-tools_3.1.1.bb.

Configuring the Linux Kernel

The layer configuration file parallella/parallella-yoctobuild/meta-example/conf/layer.conf also causes the build scripts (bitbake) to read our linux .bbappend file found at parallella/parallella-yoctobuild/meta-example/recipes-kernel/linux/linux-analogdevicesinc_3.19.bbappend. Look at the contents of that file and see that we are adding to the SRC_URI the kernel config snippet parallella/parallella-yoctobuild/meta-example/recipes-kernel/linux/files/hdmikernelConfigAdditions-example.cfg. That file at present is empty, however if you add, for example a xilinx dma block to the FPGA, you may want to add the necessary kernel config to include the xilinx drivers. Two other kernel config snippets are provided (perf.cfg and stap.cfg) to show you that the normal kernel config commands are added to these files.

Updating the device tree

The device tree files are found in parallella/parallella-yoctobuild/meta-example/conf/machine/boards/parallella and these are included in the device tree by the device-tree.bbappend file at parallella/parallella-yoctobuild/meta-example/recipes-bsp/device-tree/device-tree.bbappend. So adding for example a xilinx dma block to the FPGA will require and update, or additional device tree dts / dtsi file to be added.

I will cover this further in a future tutorial.

Updating the bitstream

Adding a new bitstream to the build is also performed by an update to the .bbappend file found at parallella/parallella-yoctobuild/meta-example/recipes-bsp/bitstream/parallella-hdmi-bitstream.bbappend. The bitstream is loaded from a git repository that could be a local bare repository for example:

SRC_URI = "git://~/parallella/examples.git"

and the appropriate git commit ID is specified in the SRCREV definition.

Preparing to build linux

Now you have had a very quick overview of the files that define the distribution it is time to actually sit back and wait for the build machine to build Linux.

In the folder parallella/parallella-yoctobuild/meta-example prepare the yocto environment and move to the build_parallella folder by typing

$ cd parallella/parallella-yoctobuild/meta-example
$ source prepareexampleyoctobuild.sh

Do the Yocto build

$ bitbake hdmi-image-example

Then create the SD card from the files in folder parallella/parallella-yoctobuild/build_parallella/tmp/deploy/images/parallella-hdmi.

Other options

Depending on the branch that you have selected the meta-example layer might not have appeared in parallella/parallella-yoctobuild/meta-example. Fear not! Each of the branches has a perpareyoctobuild.sh script in parallella/parallella-yoctobuild that you can use. The overrides that are provided by meta-example are not present, but it should be possible to create the linux distribution.

Look for files that contain "IMAGE_INSTALL" to get an idea of the available images you can create:

$ cd parallella/parallella-yoctobuild
$ grep -ir IMAGE_INSTALL * | grep .bb | grep -v .bbclass
  • meta-parallella/recipes-parallella/images/hdmi-image.bb is an image that I provide that will build the Epipany SDK from source (bitbake hdmi-image)
  • meta-parallella/recipes-epiphany/images/core-image-epiphany.bb will create an image with the official Epiphany SDK binaries (bitbake core-image-epiphany)
  • poky/meta/recipes-sato/images/core-image-sato.bb will create a full gui image with X11 support

The hidden magic here is that the build folder that is created has a config file (parallella/parallella-yoctobuild/build_parallella/conf/local.conf) that contains the magic line:

MACHINE ?= "parallella-hdmi"

Provided this line has not been overridden by the recipes then the parallella-linux with hdmi support will be built even if you build a "standard" yocto image like core-image-sato.

If you have read and understood and tried this out then congratulate yourself because you have begun to understand a bit about the power and flexibility of the yocto build system! If you want to read more about yocto then start with my yocto wiki page Basic syntax that contains links to other places.

Initial Setup Creating the SD Card