The basic concepts of layers

Let's dive into the basic concepts of layers:

Theory

A layer, in the technical sense of the term, has some properties. They are as follows:

  • Name: This usually starts with the string meta- (mandatory for better comprehension).
  • Priority: This is the value used by BitBake to decide which recipe to use and the order in which the .bbappend files should be joined. It means that if two layers include the same recipe (.bb) file, the one with the higher priority is used.

Note

For example, a layer with a priority value set to 6 has a higher chance of its recipe being used than one with a priority value set to 5.

Furthermore, each layer is listed according to its functionality on this page:

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

Theory

  • The software layer: This layer provides software families that can be used on any architecture (x86_64, ARM, PPC, MIPS, and so on). For example, we have meta-java (for Java support), meta-efl (for the Enlightenment environment), meta-qt5 (Qt support), meta-webserver (provides support for building web servers), meta-browser, and so on.
  • Miscellaneous: If your layer doesn't fall into any other category, you can choose this type; however, there shouldn't be too many miscellaneous layers-it may be an indication that the purpose isn't well defined or that you should consider splitting the layer.
  • Machine (BSP): These are layers specific to a machine (such as meta-raspberrypi, meta-fsl-arm, and meta-ti). They contain machine configuration files and recipes to configure packages for the machines.
  • Distribution: These are layers adding a distribution to the environment (such as meta-ivito add in-vehicle infotainment (IVI) support, meta-angstrom, and so on).

At this stage, we know how the layers are distributed within the Yocto Project. Now, we will see how these layers are composed.

The software layer

For this example, we will take as an example the meta-qt5 layer. This layer has a directory tree, as follows:

pjtexier@amplitude:~ $ ls -l meta-qt5/
total 28
drwxrwxr-x  2 pjtexier pjtexier 4096 avril 22 19:20 classes
drwxrwxr-x  3 pjtexier pjtexier 4096 avril 22 19:20 conf
-rw-rw-r--  1 pjtexier pjtexier 1035 avril 22 19:20 COPYING.MIT
drwxrwxr-x  2 pjtexier pjtexier 4096 avril 22 19:20 licenses
-rw-rw-r--  1 pjtexier pjtexier 1189 avril 22 19:20 README
drwxrwxr-x  4 pjtexier pjtexier 4096 avril 22 19:20 recipes-devtools
drwxrwxr-x 10 pjtexier pjtexier 4096 avril 22 19:20 recipes-qt

README and COPYING

Inside this directory, there are two important files; they are as follows:

  • README: This file specifies mostly the outer layers that depend on the target layer, any configuration instructions, the address to send patches to, and contact details of the maintainers.
    • This layer depends on the following:

URI: git://github.com/openembedded/oe-core.git 
branch: master 
revision: HEAD 
 
URI: git://github.com/openembedded/meta-oe.git 
layers: meta-ruby 
branch: master 
revision: HEAD 
 
When building stuff like qtdeclarative, qtquick, qtwebkit, make  sure thatyou have required PACKAGECONFIG options enabled in qtbase build,  see qtbase.inc  for detail.Send pull requests to [email protected]  with '[meta-qt5]' in the subject' 
 
When sending single patches, please using something like: 
'git send-email -M -1 --to openembedded- [email protected] --subject-prefix=meta-qt5][PATCH'You are encouraged to fork the mirror on github[1] to share your  patches. This is preferred for patch sets consisting of more than one  patch. Other services like gitorious, repo.or.cz or self hosted  setups  are of course accepted as well, 'git fetch <remote>' works the same on  all of them. We recommend github because it is free, easy to use, has  been proven to be reliable and has a really good web GUI.1. https://github.com/meta-qt5/meta-qt5/ 
 
Main layer maintainers: 
Martin 'JaMa' Jansa <[email protected]> 
Otavio Salvador <[email protected]> 
  • COPYING: This file contains licensing information (MIT license in this case).

The classes folder

The classes folder holds .bbclass files. Here is a sample classes folder:

pjtexier@amplitude:~ $ ls -l classes/
total 24
-rw-rw-r-- 1 pjtexier pjtexier 1721 avril 22 19:20 cmake_qt5.bbclass
-rw-rw-r-- 1 pjtexier pjtexier 2001 avril 22 19:20
populate_sdk_qt5.bbclass
-rw-rw-r-- 1 pjtexier pjtexier 7633 avril 22 19:20
qmake5_base.bbclass
-rw-rw-r-- 1 pjtexier pjtexier  219 avril 22 19:20 qmake5.bbclass
-rw-rw-r-- 1 pjtexier pjtexier 1935 avril 22 19:20
qmake5_paths.bbclass

The conf folder

The conf folder should provide configuration (.conf) files. The layer.conf file inside this folder contains some important variables, for example, the variable concerning the priority (BBFILE_PRIORITY):

# Define the priority for recipes (.bb files) from this layer,
# choosing carefully how this layer interacts with all of the
# other layers.
BBFILE_PRIORITY_qt5-layer = "7" 

To verify the priority value, we can use the following command:

$: bitbake-layers show-layers

The recipes-* directory

The recipes-* directory contains some recipes. For example, in the meta-qt5 layer, we have recipes-qt, which include some metadata (such as Qt5).

The machine (BSP) layer

For this presentation, we will take the example of the BSP layer specific to our hardware: the meta-raspberrypi BSP layer. This directory (folder) should contain a file list similar to the following:

pjtexier@amplitude:~ $ ls -l meta-raspberrypi/ classes
conf
custom-licenses
recipes-bsp
recipes-core
recipes-devtools
recipes-graphics
recipes-kernel
recipes-multimedia
COPYING.MIT
README

When we use a BSP layer, there are some differences. The first is in the conf folder. Now, we have a new folder inside this directory, which is machine.

This folder contains some configuration files to handle our specific hardware (Raspberry Pi and Raspberry Pi 2 among others). For example, there is an important file (rpi-base.inc) located at:

  • machine

* raspberry.conf (configuration file for Raspberry Pi)

* raspberry2.conf (configuration file for Raspberry Pi2)

  • Include

* rpi-base.inc

The rpi-base.inc file looks like this:

include conf/machine/include/rpi-default-settings.inc 
include conf/machine/include/rpi-default-versions.inc 
include conf/machine/include/rpi-default-providers.inc 
 
SOC_FAMILY = "rpi" 
include conf/machine/include/soc-family.inc 
 
IMAGE_FSTYPES ?= "tar.bz2 ext3 rpi-sdimg" 
 
SERIAL_CONSOLE = "115200 ttyAMA0" 
 
XSERVER = "  
    xserver-xorg  
    xf86-input-evdev  
    xf86-input-mouse  
    xf86-input-keyboard  
    xf86-video-fbdev  
    " 
 
# Really supported starting from linux-raspberrypi 3.18.y only 
KERNEL_DEVICETREE ?= "  
    bcm2708-rpi-b.dtb  
    bcm2708-rpi-b-plus.dtb  
    bcm2709-rpi-2-b.dtb  
     
    ds1307-rtc-overlay.dtb  
    hifiberry-amp-overlay.dtb  
    hifiberry-dac-overlay.dtb  
    hifiberry-dacplus-overlay.dtb  
    hifiberry-digi-overlay.dtb  
    iqaudio-dac-overlay.dtb  
    iqaudio-dacplus-overlay.dtb  
    lirc-rpi-overlay.dtb  
    pcf8523-rtc-overlay.dtb  
    pps-gpio-overlay.dtb  
    w1-gpio-overlay.dtb  
    w1-gpio-pullup-overlay.dtb  
    " 
KERNEL_IMAGETYPE ?= "Image" 
 
MACHINE_FEATURES = "kernel26 apm usbhost keyboard vfat ext2 screen touchscreen alsa bluetooth wifi sdio" 
 
# Raspberry Pi has no hardware clock 
MACHINE_FEATURES_BACKFILL_CONSIDERED = "rtc" 
 
MACHINE_EXTRA_RRECOMMENDS += " kernel-modules" 
 
# Set Raspberrypi splash image 
SPLASH = "psplash-raspberrypi" 
 
IMAGE_BOOT_FILES ?= "bcm2835-bootfiles/*  ${KERNEL_IMAGETYPE};${SDIMG_KERNELIMAGE}"

It is in this file that we set some essential variables, including the following:

  • SERIAL CONSOLE specifies the speed and device for the serial console to attach to. It is passed to the kernel as a console parameter, for example, 115200 ttyAM0.
  • IMAGE FSTYPES specifies the format of the root filesystem images to be created.
  • KERNEL IMAGETYPE specifies the type of kernel image to build (uImage or zImage).

Note

If you want to know more about the BSP layer, you can visit http://www.yoctoproject.org/docs/1.8/bsp-guide/bsp-guide.html.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.221.113