Hints on yocto builds for Intel IoT developer kit

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:

Published Date
17 - Mar - 2015
| Last Updated
23 - Apr - 2015
Hints on yocto builds for Intel IoT developer kit

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(R) 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

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


3. src/gz all https://iotdk.intel.com/ipk/all


5. src/gz i586 https://iotdk.intel.com/ipk/i586


7. src/gz clanton https://iotdk.intel.com/ipk/clanton


9. EOF

to your /etc/opkg/iotdk.conf file as described in https://software.intel.com/sites/default/files/managed/f1/49/building_yocto_and__ipks.pdf (Section "Using the Repository with IOTDL builds") you are ready to use opkg to add further packages from that repository with

1. # opkg install <package name>
To get the list of packages you can use
2. # opkg list
Apart from that there is a live image on https://software.intel.com/en-us/iotdevkit 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 https://www.yoctoproject.org/docs/1.5.1/dev-manual/dev-manual.html). 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 https://git.yoctoproject.org/cgit/cgit.cgi/meta-intel-iot-devkit/ where you can find the git details for a git clone. On my system I do have the Yocto build root on

1. 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
1. 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.
1. 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 athttps://layers.openembedded.org/layerindex/branch/master/layers/.

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/oracle-jse-jre-i586_1.7.0.bb 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/oracle-jse.inc 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

1. $ bitbake-layers show-layers


3. layer path priority


5. ==========================================================================


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


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


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


13. meta-yoct/Quark/meta-intel-iot-devkit/meta-yocto   5


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


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


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


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


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

And you should be fine to go with
1. $ ${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:
1. # /usr/jre1.7.0_51/bin/java hello      


3. Hello World

For more such intel IoT resources and tools from Intel, please visit the Intel® Developer Zone

Source: https://software.intel.com/en-us/blogs/2014/04/04/some-hints-on-yocto-builds-for-iot-devkit-example-adding-java-jre

DMCA.com Protection Status