How to add a new layer in YOCTO?

  • To add a new layer in YOCTO, need to create a meta layer in “sources” folder

  • Before using the bitbake command, DISTRO command should be used to create a build folder

  • First create the new layer with below command:
    $ bitbake-layers create-layer ../sources/meta-mycustom

  • This will generate a layer “meta-mycustom” in sources directory, including the conf files and an example recipe
    ../sources/meta-mycustom/
    ├── conf
    │ └── layer.conf
    ├── COPYING.MIT
    ├── README
    └── recipes-example
    └── example
    └── example_0.1.bb

    3 directories, 4 files

  • Now, to add this new layer to the build, use the below command:
    build$ bitbake-layers add-layer ../sources/meta-mycustom

  • The above command adds the custom layer to “conf/bblayers.conf” file.

  • If the meta layer is readily available, then copy the meta layer to “sources” directory.

  • Use the “add-layer” command to add the layer to build.