Woodrow Barlow
Woodrow Barlow

Reputation: 9097

How to re-use configuration/includes from another layer?

Suppose I am using a third-party Yocto layer, and I have also created my own layer.

The third party layer has lots of config files (for instance, machine configurations) which all include one common file.

In my own layer, I'd like to create my own configuration, which will be much like the third-party ones. Can I include that common file, without hard-coding the other layer's path?

For a real-world example, see the meta-intel-fpga layer:

https://git.yoctoproject.org/meta-intel-fpga/tree/recipes-kernel/linux?h=kirkstone

If I created a new layer (which depends on meta-intel-fpga) I would expect to be able to create a new recipe for a new kernel version (one not already supported by meta-intel-fpga), and ideally avoid duplicating the .inc file.

Upvotes: 1

Views: 1441

Answers (2)

Livius
Livius

Reputation: 463

For including you should use include recipes-kernel/linux/linux-socfpga.inc in your bbappend.

Upvotes: 2

Antoine
Antoine

Reputation: 73

Usually we create bbappend files to modify existing recipes (e.g. if you only want to change a few things in that recipe). This is the preferred method as it avoids duplicating recipes, and you will get the updates coming from that layer.

If you want to create your own recipe using the .inc files provided by the third-party layer (e.g. to use a version that is not provided by the third-party layer), you'll need to include it and specify the path using something like require recipes-kernel/linux/linux-socfpga.inc in your new recipe.

Note that if you do this you may need to set a PREFERRED_VERSION or give your layer a higher priority to ensure your recipe is used instead of the ones provided in the third-party layer.

Upvotes: 1

Related Questions