Creating a Custom Yocto Layer

Creating a product layer, and why vendor layers should stay untouched across BSP updates.

Creating your own Yocto layer

For serious projects, we should avoid modifying vendor layers directly.

Instead, create a custom layer.

For example:

meta-my-project/
├── conf/
│   └── layer.conf
├── recipes-apps/
├── recipes-core/
├── recipes-kernel/
└── recipes-images/

The custom layer can contain project-specific modifications.

For example:

meta-my-project
      |
      +-- custom application
      |
      +-- configuration
      |
      +-- patches
      |
      +-- image recipe
      |
      +-- systemd services

This keeps our modifications separate from vendor code.

Why not modify vendor layers?

Suppose we directly modify:

meta-vendor/

Everything works.

Six months later we update the vendor BSP.

Our modifications may be overwritten or become difficult to merge.

Instead:

Vendor layers, custom layer and product configuration stack Vendor Layers Custom Layer Our Product
The custom layer sits on top of the vendor layers, so an SDK update is never merged by hand.

This makes upgrades much easier.