Some hints on Yocto* builds for IoT devkit - example: adding Java* JRE

Recently someone asked me on more documentation about Yocto builds. In particular the person mentioned facing difficulties adding Java to an own IoT Yocto build. This conversation triggered the following post:

Why you don't need Yocto builds on your own

First of all: in order to work with the IoT devkit you don't in general have to touch the Yocto build. The devkit provides a prebuilt SD card boot image to  put on your Intel® Galileo board. And off you go. Additionally there is a package repository from where you can install further packages to your image, i.e. after adding following lines subtituting the version number for <version>:

	# cat >> /etc/opkg/iotdk.conf <<EOF

	src/gz all<version>/ipk/all

	src/gz i586<version>/ipk/i586

	src/gz quark<version>/ipk/quark



to your /etc/opkg/iotdk.conf file as described in (Section "Using the Repository with IOTDL builds") you are ready to use opkg to add further packages from that repository with

	# opkg install <package name>


To get the list of packages you can use

	# opkg list


Apart from that there is a live image on including all setup to compile your own binaries for the Galileo target.

How you can do Yocto builds on your own

However, there might be cases where the before mentioned ways don't fully fit your needs and you might want to customize the image or easily build own ipk packages ...

That's where you might want to run Yocto builds on your own. For Yocto starters I'd like to refer to the online documentation on the Yocto project (currently It's not the place here to teach the Yocto concepts. But what I try to achieve is to share some hints to get you started.

Initial Yocto build

If you want to build an image you should have at least 40 GB of disk space available. You need to have installed various development tools like git in order to start using Yocto. To start with the intel-iot-devkit go to where you can find the git details for a git clone. On my system I do have the Yocto build root on

 YBR = /Quark/meta-intel-iot-devkit/ 


Apart from the master there are other branches.

You may follow the steps down below to build an image:

  1. check ${YBR}/build/conf/local.conf configuration. You might have to modify the settings for parallel builds
  2. setup the Yocto build environment by sourcing
     source ${YBR}/iot-devkit-init-build-env 
  3. This will directly change your pwd to ${YBR}/build. There you can now use bitbake to start building e.g.
     bitbake iot-devkit 
  4. now take a brief (and maybe a coffee) - if there are no issues you will find your ready image in ${YBR}/build/tmp/deploy/images, and the ipk packages in ${YBR}/build/tmp/deploy/ipk resp. Depending on your build system this may take a couple of hours.


Check available layers

Yocto uses various so called layers to organize the packages. Various layers you can find available at

In our case you can find a meta-oracle-java layer which is a good starting point for the Java package we are going to build. We will use and modify this layer using the steps below. For writing your own layers pls check the Yocto manual.

  1. git clone the layer into ${YBR}.
  2. add the layer to the BBLAYERS variable in ${YBR}/build/conf/bblayers.conf
  3. as Oracle Java comes with a proprietary license you have to whitelist the license in ${YBR}/build/conf/local.conf by adding LICENSE_FLAGS_WHITELIST += "oracle_java"
  4. unfortunately the meta-oracle-java layer seems slightly dated - in particular the direct download link for the JRE doesn't work any longer. It seems you need to accept a license first before you can download the JRE from Oracle. Hence I downloaded the tgz and put it on a local folder. Obviously the URI entry in meta-oracle-java/recipes-devtools/oracle-java/ needs to be modified accordingly (In my case SRC_URI = "file:///Quark/meta-intel-iot-devkit/meta-oracle-java/jre-7u51-linux-i586.tgz"). Also the md5 checksums and the LIC_FILES_CHKSUM  license hash in meta-oracle-java/recipes-devtools/oracle-java/ need to be modified accordingly. Easiest to first leave it unchanged and bitbake will print an error message including the correct new hashs.

After that you should see something like

	$ bitbake-layers show-layers

	layer                 path                                      priority


	meta                  /Quark/meta-intel-iot-devkit/meta         5

	meta-oe               /Quark/meta-intel-iot-devkit/meta-oe      6

	meta-iot-devkit       /Quark/meta-intel-iot-devkit/meta-iot-devkit  6

	meta-yocto            /Quark/meta-intel-iot-devkit/meta-yocto   5

	meta-intel            /Quark/meta-intel-iot-devkit/meta-intel   5

	meta-clanton-bsp      /Quark/meta-intel-iot-devkit/meta-clanton-bsp  6

	meta-galileo          /Quark/meta-intel-iot-devkit/meta-galileo  9

	meta-hob              /Quark/meta-intel-iot-devkit/meta-hob     1

	meta-oracle-java      /Quark/meta-intel-iot-devkit/meta-oracle-java  6


And you should be fine to go with

 $ ${YBR}/bitbake oracle-jse-jre-i586 

On success you will find the new package in ${YBR}/build/tmp/deploy/ipk. You can copy over this package to your system and opkg install it.

After successful installation we now can run Java on the target - here using the mandatory starting point Java classes:

	# /usr/jre1.7.0_51/bin/java hello      

	Hello World






Для получения подробной информации о возможностях оптимизации компилятора обратитесь к нашему Уведомлению об оптимизации.