What is a Yocto recipe and how can I make one?

Published on September 3, 2015

Archived Notice

This article has been archived and may contain broken links, photos and out-of-date information. If you have any questions, please Contact Us.

This is a continuation of a previous blog post. Here I will show how to add your own content to an existing image.

Recipe Making Guide

The Yocto manual covers how to make a recipe very well. So well, in fact, that it blows this simple tutorial out of the water. I don't want to re-invent the wheel here, so if you're looking to learn how to do something big, read through the chapter in their manual here.

If you're looking to create QT application recipes, I've found this to be a short and concise guide on how to do that. So read through that if you're looking to create QT recipes.

Add a project recipe

This is where you really need to read through everything and get a good knowledge of how everything works. However, for bare-bones introduction the Yocto manual includes several really good examples in this chapter.

Hello World

A simple C code "hello world" application recipe can be seen here

Autotools

If you have a project that can be built using autoconf and automake, making recipes is extremely easy like their example here.

We have a simple application up on our github that daemonizes an application, the source code can be seen here. This project can be built using autotools, so an example recipe to build that would go in sources/meta-boundary-tutorial/recipes-boundary/daemonize/daemonize.bb and would look like this:

# Copyright (C) 2014 Boundary Devices SUMMARY = "Daemonize" SECTION = "base" LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=5003fa041d799dd5dd5f646b74e36924" S = "${WORKDIR}/git" SRC_URI = "git://github.com/boundarydevices/daemonize.git;branch=${SRCBRANCH}" SRCBRANCH = "master" SRCREV = "9c08934f6cbf3cf4bfbdeb92d411072e5d2f7ad0" inherit autotools-brokensep

As you can see here, bitbake knows what to do with autotools recipes and this recipe is pretty simple. If you add the daemonize recipe to IMAGE_INSTALL_append in your ~/fido/core-image-sato/conf/local.conf, then re-run the bitbake process you would include this daemonize tool in your image.

Makefile

If your source code depends on other libraries and is built using a Makefile, then this example illustrates how to do that.