How to Create Yocto Projects

From RidgeRun Developer Wiki
Revision as of 16:01, 6 August 2024 by Ofallas (talk | contribs) (→‎Create the recipe)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)






Create a Basic Project

On this section we will unify all the information provided about Yocto to create a simple project. First, we will generated a Yocto image, then we will create out own first meta-layer. If you have extra question feel free to

Setting Enviroment

  1. Install Dependencies
    sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat cpio python python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping
  2. Create the Yocto project directory
    mkdir yocto-first-project
    cd yocto-first-project
  3. Get Poky source code
    git clone -b dunfell git://git.yoctoproject.org/poky.git poky
    cd poky
  4. Run Yocto enviroment script.
    source oe-init-build-env

Create a custom meta-layer

  1. Create the meta-rr. Yocto provides a command to create your own meta-layers
    bitbake-layers create-layer meta-rr
  2. Run the following command to include meta-rr into the project meta-layers.
    bitbake-layers add-layer meta-rr
  3. Check meta-rr is active
    bitbake-layers show-layers

Create the Source Code

  1. Create the a directory for the new recipe.
    mkdir -p meta-rr/recipes-example/rrrecipe/files
  2. With your favorite text editor create my_first_recipe.c into the directory previously created and include the following content.
    #include <stdio.h>
    int main()
    {
    	printf("RidgeRun LLC. \n");
    	printf("Embedded Solutions. \n");
    	return 0;
    }

Create the recipe

  1. Run the following command to create the recipe file.
    touch meta-rr/recipes-example/rrrecipe/rr_recipe.bb
  2. With your favorite text editor include the following content.