Task #10 - How to create a custom layer

Document created by Daiane Angolini Employee on Aug 5, 2013Last modified by ebiz_ws_prod on Dec 13, 2017
Version 5Show Document
  • View in full screen mode

One of the most important features of Yocto is its ability to handle sublayers. To understand the sublayers please Yocto Project Development Manual


Start creating meta-custom folder, then create the other folders. For example:



├── conf

│   └── layer.conf


├── recipes-core

│   └── helloworld

│       ├── helloworld

│       │   └── hello_world.c

│       └── helloworld_0.0.bb

└── recipes-daiane

    └── images

        └── dai-image-hello.bb


It´s possible to create recipes-kernel and place there your defconfig, or create a bbappend to apply your patches to kernel, or even create a recipes-multimedia and place there custom application for gstreamer, for example.


Here, the custom application example is a helloworld application.


One important tip:

Yocto see recipes name as PACKAGENAME_VERSION.bb, It means, yocto uses "_" (underline) to separate the package name from package version on a recipe file name. So, if you call your helloworld application as hello_world_1.0.bb Yocto will think your application is called "hello" and the version is something around "world_1.0"


Please, be careful.




This is the file that gives new layer live. Find the content of mine layer.conf below:


# We have a conf and classes directory, add to BBPATH



# We have a packages directory, add to BBFILES

BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \





BBFILE_PRIORITY_daiane = "4"



As soon as the new custom layer is created, it MUST include it to  conf/bblayers.conf file. Please see the example:





BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}"




  ${BSPDIR}/sources/poky/meta \

  ${BSPDIR}/sources/poky/meta-yocto \


  ${BSPDIR}/sources/meta-openembedded/meta-oe \


  ${BSPDIR}/sources/meta-fsl-arm \

  ${BSPDIR}/sources/meta-fsl-arm-extra \

  ${BSPDIR}/sources/meta-fsl-demos \


  ${BSPDIR}/sources/meta-daiane \



Please, find the tarball with sample meta layer attached to this document.


It includes one image that will install the Hello World application:


$ bitbake dai-image-hello


When the content of image tar ball is extracted, hello_world was installed and it was for ARM:


$ find -name hello*



$ file ./usr/bin/hello_world

./usr/bin/hello_world: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, stripped


Go to Yocto Training - HOME

Go to Task #9 - How to add bad/ugly

Original Attachment has been moved to: meta-daiane.tar.gz