---
author: Sanchayan Maity
title: Setting up Yocto/Poky for Beagleboard-xM/Beagleboard/Beaglebone
tags: yocto, poky, beagleboard, qt5
---

<p style='text-align: justify;'>I have used Buildroot before for setting up environment for Beagleboard, but OpenEmbedded or Yocto gives much more power with regard to the number of packages you can build or do your own customizations. From here on I am assuming that you have a separate beagle directory in which you are doing this. A knowledge of git and your smartness ;-) is assumed.</p>

Clone the poky repository with git

```bash
$ git clone git://git.yoctoproject.org/poky
```

<p style='text-align: justify;'>Enter the poky directory and clone the "meta-ti" layer. This layer will be required for Beagle specific builds.</p>

```bash
$ git clone git://git.yoctoproject.org/meta-ti meta-ti
```

<p style='text-align: justify;'>Clone the meta-openembedded, openembedded-core and meta-qt5 layers, while in the poky directory</p>

```bash
$ git clone git://git.openembedded.org/openembedded-core openembedded-core
```

```bash
$ git clone git://git.openembedded.org/meta-openembedded meta-openembedded
```

```bash
$ git clone git://github.com/meta-qt5/meta-qt5 meta-qt5
```

<p style='text-align: justify;'>In each of the git cloned repositories, select the branch you want to work with. If you do not select a branch, all of them will be with the default **master** branch. For example, you can select the **dora** or **daisy** branch.</p>

<p style='text-align: justify;'>While in the beagle directory, run **source poky/oe-init-build-env poky-build** . The **poky-build** directory is where all your build will take place, downloads will happen and all the packages and images will reside.</p>

<p style='text-align: justify;'>So, now your beagle directory will have two directories inside **poky, poky-build**. The poky directory will have the various meta layers.</p>

<p style='text-align: justify;'>After running the **source** command above, do not exit the terminal or switch to a different terminal or directory. The script which was run did the necessary task of setting up the environment variables required for the build.</p>

<p style='text-align: justify;'>Open the **conf/bblayers.conf** file with an editor like nano or gedit. Add the required entries to have this file exactly as below.</p>

```c
# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
LCONF_VERSION = "6"

BBPATH = "${TOPDIR}"
BBFILES ?= ""

BBLAYERS ?= " \
  /home/sanchayan/beagle/poky/meta \
  /home/sanchayan/beagle/poky/meta-yocto \
  /home/sanchayan/beagle/poky/meta-yocto-bsp \
  /home/sanchayan/beagle/poky/meta-ti \
  /home/sanchayan/beagle/poky/meta-qt5 \
  /home/sanchayan/beagle/poky/openembedded-core \
  /home/sanchayan/beagle/poky/meta-openembedded/meta-ruby \
  /home/sanchayan/beagle/poky/meta-openembedded/meta-oe \
  "
BBLAYERS_NON_REMOVABLE ?= " \
  /home/sanchayan/beagle/poky/meta \
  /home/sanchayan/beagle/poky/meta-yocto \
```

<p style='text-align: justify;'>Open a different terminal and go to the **openembedded-core** in **poky** directory.  Make a **conf **directory and add a **layer.conf** file as below.</p>

```c
# We have a conf and classes directory, append to BBPATH
BBPATH .= ":${LAYERDIR}"

# We have a recipes directory, add to BBFILES
BBFILES += "${LAYERDIR}/recipes*/*/*.bb ${LAYERDIR}/recipes*/*/*.bbappend"

BBFILE_COLLECTIONS += "openembedded-core"
BBFILE_PATTERN_openembedded-core := "^${LAYERDIR}/"
BBFILE_PRIORITY_openembedded-core = "4"
```

<p style='text-align: justify;'>Now go to the **meta-openembedded** directory in **poky**. Make a **conf** directory and add a **layer.conf** file as below.</p>

```c
# We have a conf and classes directory, append to BBPATH
BBPATH .= ":${LAYERDIR}"

# We have a recipes directory, add to BBFILES
BBFILES += "${LAYERDIR}/recipes*/*/*.bb ${LAYERDIR}/recipes*/*/*.bbappend"

BBFILE_COLLECTIONS += "meta-openembedded"
BBFILE_PATTERN_meta-openembedded := "^${LAYERDIR}/"
BBFILE_PRIORITY_meta-openembedded = "5"
```

<p style='text-align: justify;'>Go to the terminal in which you got into the **poky-build** directory after running **source/oe-init-build-env**. Add the following to the **conf/local.conf**.</p>

```c
BB_NUMBER_THREADS = "4"
PARALLEL_MAKE = "-j 4"
INHERIT += "rm_work"
IMAGE_INSTALL_append = " \
            packagegroup-core-x11 \
            libx11 \            
            qtbase \
            qt3d \
            qtconnectivity \
            qtmultimedia \             
            qtserialport \            
            qtwebsockets \
            qtsvg \
            qtx11extras \
              "
```

<p style='text-align: justify;'>The BB_NUMBER_THREADS and PARALLEL_MAKE in my **local.conf** is as per the fact that I have a quad core machine. Set it as per your machine configuration. Also, set the **MACHINE** variable in the file. I set it to **MACHINE ?= "beagleboard"**. Just add this line below the default. The IMAGE_INSTALL_append will add the packages specified to any image we build and we are going to do a minimal build. You can add the packages you like.</p>

<p style='text-align: justify;'>First look for a specific package you like at the below link. Do select the relevant branch as per your branch selection in the start of the tutorial.</p>

[http://layers.openembedded.org/layerindex/branch/master/recipes/](http://layers.openembedded.org/layerindex/branch/master/recipes/)

<p style='text-align: justify;'>After this, check the layer in which that package recipe resides. Clone the layer in the same way we added the **meta-ti** or **meta-qt5** layers and add them to the **bblayers.conf** file. If the layer has a dependency you need to clone and add the relevant dependency layer too. I wanted to build qt5, so I added the meta-qt5 layer. If you want to build cherokee, you need to add the meta-webserver layer in which the cherokee recipe resides.</p>

<p style='text-align: justify;'>Some packages fail due to a fetch failure. This is because a particular define for a url is not there in Yocto which Openembedded uses.</p>

<p style='text-align: justify;'>Add the following to **meta/classes/mirrors.bbclass** and **meta/conf/bitbake.conf** in the **poky** source tree respectively. Make sure you add it at the right place.</p>

```c
${SAVANNAH_GNU_MIRROR} http://download-mirror.savannah.gnu.org/releases
${SAVANNAH_NONGNU_MIRROR} http://download-mirror.savannah.nongnu.org/releases

SAVANNAH_GNU_MIRROR = "http://download-mirror.savannah.gnu.org/releases"
SAVANNAH_NONGNU_MIRROR = "http://download-mirror.savannah.nongnu.org/releases"
```

<p style='text-align: justify;'>A patch for the **poky** tree to do the above is below, which you can apply with **git**.</p>

```c
diff --git a/meta/classes/mirrors.bbclass b/meta/classes/mirrors.bbclass
index 1fd7cd8..1dd6cd6 100644
--- a/meta/classes/mirrors.bbclass
+++ b/meta/classes/mirrors.bbclass
@@ -19,8 +19,10 @@ ${DEBIAN_MIRROR}    ftp://ftp.si.debian.org/debian/pool \n \
 ${DEBIAN_MIRROR}    ftp://ftp.es.debian.org/debian/pool \n \
 ${DEBIAN_MIRROR}    ftp://ftp.se.debian.org/debian/pool \n \
 ${DEBIAN_MIRROR}    ftp://ftp.tr.debian.org/debian/pool \n \
-${GNU_MIRROR}    ftp://mirrors.kernel.org/gnu \n \
+${GNU_MIRROR}        ftp://mirrors.kernel.org/gnu \n \
 ${KERNELORG_MIRROR}    http://www.kernel.org/pub \n \
+${SAVANNAH_GNU_MIRROR} http://download-mirror.savannah.gnu.org/releases \n \
+${SAVANNAH_NONGNU_MIRROR} http://download-mirror.savannah.nongnu.org/releases \n \
 ftp://ftp.gnupg.org/gcrypt/     ftp://ftp.franken.de/pub/crypt/mirror/ftp.gnupg.org/gcrypt/ \n \
 ftp://ftp.gnupg.org/gcrypt/     ftp://ftp.surfnet.nl/pub/security/gnupg/ \n \
 ftp://ftp.gnupg.org/gcrypt/     http://gulus.USherbrooke.ca/pub/appl/GnuPG/ \n \
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index b3786a7..29ed3d3 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -568,6 +568,8 @@ KERNELORG_MIRROR = "http://kernel.org/pub"
 SOURCEFORGE_MIRROR = "http://downloads.sourceforge.net"
 XLIBS_MIRROR = "http://xlibs.freedesktop.org/release"
 XORG_MIRROR = "http://xorg.freedesktop.org/releases"
+SAVANNAH_GNU_MIRROR = "http://download-mirror.savannah.gnu.org/releases"
+SAVANNAH_NONGNU_MIRROR = "http://download-mirror.savannah.nongnu.org/releases"
 
 # You can use the mirror of your country to get faster downloads by putting
 #  export DEBIAN_MIRROR = "ftp://ftp.de.debian.org/debian/pool"
diff --git a/meta/recipes-core/images/core-image-minimal.bb b/meta/recipes-core/images/core-image-minimal.bb
index 9716274..13f9127 100644
--- a/meta/recipes-core/images/core-image-minimal.bb
+++ b/meta/recipes-core/images/core-image-minimal.bb
@@ -8,5 +8,5 @@ LICENSE = "MIT"
 
 inherit core-image
 
-IMAGE_ROOTFS_SIZE ?= "8192"
+#IMAGE_ROOTFS_SIZE ?= "8192"
```

<p style='text-align: justify;'>Now, you can build an image for your board by doing **bitbake core-image-minimal**. The generated files and images will be in **poky-build/****tmp/deploy/images/beagleboard**.</p>

<p style='text-align: justify;'>Follow this link and transfer the files to the SD card. I don't know why but putting the **uImage** in **boot** directory doesn't work. Put the **uImage** in the **boot** directory which is in the **root** filesystem.</p>

[https://www.yoctoproject.org/downloads/bsps/dora15/beagleboard](https://www.yoctoproject.org/downloads/bsps/dora15/beagleboard)

<p style='text-align: justify;'>Now, plug in the SD card and boot. It boots very quickly. You are supposed to be connected to the debug serial port. For some reason Ethernet and all USB ports don't work. I am trying to figure out why, will update as soon as I do. X also doesn't seem to work on running startx.</p>

<p style='text-align: justify;'>If you would like to setup qtcreator and use qt5, build **meta-toolchain-qt5** and follow the below link. The link is not exactly for qt5, but, can be used for qt5 setup for beagle. No need to follow the relocation related stuff on the link.</p>

[http://developer.toradex.com/how-to/how-to-set-up-qt-creator-to-cross-compile-for-embedded-linux](http://developer.toradex.com/how-to/how-to-set-up-qt-creator-to-cross-compile-for-embedded-linux)
