Learning Yocto Basics Part 1 [Understanding basics terms]

The five elements of a embedded Linux are

  • Toolchain
  • Kernel
  • Bootloader
  • Root File System
  • Application

 Toolchain: It comprises of the tools or software modules of the compilation stages. Its  the build system. Toolchain is responsible for converting the high level files to the final image or binary file which will be flashed into the hardware. it contains the compiler or cross compiler and assembler linker locator etc. All the other elements are dependent on the toolchain. 

Kernel is the heart of the system which manages the resources of the embedded system. I am still not clear on what a kernel actually is. When i get clear idea ill update it here 

Bootloader is the module which initialises the system and loads the Linux kernel

Root FIle system are libraries and programs which run once the kernel has completed its initialisation. 

Then there is actual application which the embedded system is mainly intended to do.

 

What is Yocto? 

The Yocto Project is an open source collaboration project that helps developers create custom Linux-based systems for embedded products, regardless of the hardware architecture. The project provides a flexible set of tools and a space where embedded developers worldwide can share technologies, software stacks, configurations and best practices which can be used to create tailored Linux images for embedded devices.

If you are new to Yocto like me then you can start from reading this : ClickMe   

In the above image you can see that various Recipies and packages can be combined together to form a custom made embedded linux distribution and build into an image. So Yocto project is not an embedded linux distribution. Yocto project is a collaboration of various embedded system stakeholders where lot of packages and BSPs (we will learn what is BSP in future but it stands for Board supporting Packages) etc so that we can form highly customized embedded linux distributions using plug and play method. You know that embedded system needs high level of customization and linux architecture enabled such customization and plug and play kind of architecture and hence yocto project was formed to make this happen. If you want a sample or reference embedded linux distribution created using yocto project then you can go for poky.


What is Poky? 

Poky is a reference (example) distribution of Yocto project. Yocto is the collaboration. and poky is the sample product. We use poky as reference and we can make changes in that like editing the recepies, adding our application parts etc and build our own customized embedded linux distribution best suited for our existing embedded system and we can flash that image in our hardware. 

Poky is combined repository of below 4 components

  • Bit-bake : bit-bake is a build system to form a embedded linux distro. Each package contains a recipe and the bit-bake reads the recipe and follows its instruction to fetch, build them and incorporate the resulting binary into bootable image. Its a standalone tool-chain managed by Open Embedded and Yocto project. It reads the python scrips and shell scripting language and acts as a task scheduler. This means if you open bit-bake folder all the scripts are either written in python or shell scripting. Know more about Bit-bake from its Wikipedia page
  • OpenEmbedded Core : its a metadata for poky. The Open embedded project and Poky share a common  code metadata and is called OE-Core. If you download a poky then in that there is a folder called as meta. Thos meta itself is known as oe-core.
  • meta-yocto-bsp : A BSP [Board Support Package] is a collection of information which defines how to support the underlying hardware device or hardware arcitecture. So a BSP contains the details about hardware features present, kernel configurations and also any additional hardware drivers required. meta-yocto-bsp maintains several BSPs like beaglebone, edgerouter and general versions of 32bit and 64-bit intel machines. If use yocto on other hardware  we have to compliment Poky with hardware specific yocto layers. 
  • Documentation : It contains the source files used to make the set of user manuals of yocto
You can know more about Poky and download it and get its git repository from this link: ClickMe    

 Poky Distro basically consists of components shown in below diagram:



What is Metadata? 

    Metadata in general means additional data about something. But in Yocto, metadata specifically means those set of  build instructions. What commands and sequence are needed, what software versions and where to download them from, patches etc needed to build our customized distro and final image is called metadata. 
    So we have different types of files in Yocto project which contains a specific type of metadata. They are:
  • Configuration files ( *.conf )
  • Recipes ( *.bb & *.bbappend
  • Classes ( *.bbclass )
  • Includes ( *.inc
    Each of these files contains a specific types of metadata. We will learn about each of these files in detail below.

What are Recipes? 

    If you think of normal English meaning of a recipe, it means the set of instructions to prepare a dish. Like what are the necessary ingredients and steps needed to prepare the dish. In Yocto also the recipes are inspired by this definition only. 
    A Recipe is set of instructions needed to compile an image of a software module. It contains details like where is the source code, what patches to apply, configuration options, how to compile it, license and installation details etc. This recipe is given to the bit-bake build tool which reads this recipe and executes it and compiles the software image and integrates it into embedded Linux kernel final image. So with the help of recipe our software component or application will be part of final image which we can run on the hardware. 

The recipe files have extension *.bb .

 

What are Configuration files? 

    As the name indicates, these files contains the configurations and also the variables. These are the files which hold: Global definition of variables, User defined variables and hardware configuration information. These files tell the build system what to build and put into the image to support a particular platform. 
 
Types of Configuration files:
  • Machine configuration options : Specific to machine on which the image will run like qemuarm, beaglebone or raspberry pi etc. 

  • Distribution configuration  options : Specific for the distro. like poky is a distro. Similarly a conf file for distro will be present. If we want to create our own distro the we have to create this conf file.

  • Compiler tuning options : Specific to underlying compiler architecture. If we are using gcc the all configurations related to gcc compiler will be present here.

  • General common configuration options

  • User configuration options [local.conf in build-->conf folder]

 The configuration files have extension *.conf .


What are Classes? 

    These are the files consisting of classes with functionalities. If you want to re-use these functionalities then just  you can inherit these classes and use the functions. This is done in order to avoid duplicating the same function definitions again and again i multiple packages. 
    Classes are used to abstract common functionalities and share it with multiple recipe(.bb) files. The extension of a class file is *.bbclass
    These class files are located in Classes directory of meta folder in Yocto project.

Comments

Popular posts from this blog

Learning Yocto Basics Part 2 [Getting Started with Poky]