Setting up Yocto/Poky for Beagleboard-xM/Beagleboard/Beaglebone

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.

Clone the poky repository with git

git clone git://git.yoctoproject.org/poky

Enter the poky directory and clone the “meta-ti” layer. This layer will be required for Beagle specific builds.

git clone git://git.yoctoproject.org/meta-ti meta-ti

Clone the meta-openembedded, openembedded-core and meta-qt5 layers, while in the poky directory

git clone git://git.openembedded.org/openembedded-core openembedded-core

git clone git://git.openembedded.org/meta-openembedded meta-openembedded

git clone git://github.com/meta-qt5/meta-qt5 meta-qt5

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.

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.

So, now your beagle directory will have two directories inside poky, poky-build. The poky directory will have the various meta layers.

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.

Open the conf/bblayers.conf file with an editor like nano or gedit. Add the required entries to have this file exactly as below.

# 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 \
  "

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.

# 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"

Now go to the meta-openembedded directory in poky. Make a conf directory and add a layer.conf file as below.

# 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"

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.

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 \
              "

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.

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.

http://layers.openembedded.org/layerindex/branch/master/recipes/

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.

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.

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.

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

SAVANNAH_GNU_MIRROR = “http://download-mirror.savannah.gnu.org/releases”
SAVANNAH_NONGNU_MIRROR = “http://download-mirror.savannah.nongnu.org/releases”

A patch for the poky tree to do the above is below, which you can apply with git.

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"
 

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.

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.

https://www.yoctoproject.org/downloads/bsps/dora15/beagleboard

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.

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.

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

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s