Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende ÜberarbeitungNächste ÜberarbeitungBeide Seiten der Revision |
software:linux:yocto:layer [2022-09-27 09:02] – Urs Graf | software:linux:yocto:layer [2022-09-28 09:16] – Urs Graf |
---|
Groups of recipes that belong together are grouped into layers. For example ''meta-ost'' is the layer that contains all the things needed to support the our needs for our linux images. | Groups of recipes that belong together are grouped into layers. For example ''meta-ost'' is the layer that contains all the things needed to support the our needs for our linux images. |
| |
===== Setting up the environment ===== | ===== Setting up the Environment ===== |
| |
First, set up a build environment. | First, set up a build environment. If in doubt, follow [[ software:linux:yocto:setup | Setting Up the Build Environment ]]. |
If in doubt, follow [[ software:linux:yocto:setup | Setting Up the Build Environment ]]. | |
This guide will assume that the environment matches the one set up there. | This guide will assume that the environment matches the one set up there. |
| |
===== Creating a custom layer ===== | ===== Creating a Custom Layer ===== |
| |
To create a new layer, create a new directory in the ''yocto'' directory. Since this is the NTB wiki, this guide will use ''meta-ntb''. The directory name can be anything, but it should start with ''meta-''. Now change into that directory and create another folder called ''conf''. In ''conf'', create a file named ''layer.conf'' with the following content: | To create a new layer, create a new directory in the ''yocto'' directory. Since this is the OST wiki, this guide will use ''meta-ost''. The directory name can be anything, but it should start with ''meta-''. Now change into that directory and create another folder called ''conf''. In ''conf'', create a file named ''layer.conf'' with the following content: |
| |
<code> | <code> |
BBFILES := "${BBFILES} ${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bappend" | BBFILES := "${BBFILES} ${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bappend" |
| |
BBFILE_COLLECTIONS += "ntb" | BBFILE_COLLECTIONS += "ost" |
| |
BBFILE_PATTERN_ntb := "^${LAYERDIR}/" | BBFILE_PATTERN_ost := "^${LAYERDIR}/" |
BBFILE_PRIORITY_ntb := "5" | BBFILE_PRIORITY_ost := "5" |
</code> | </code> |
| |
This file configures the layer and where to look for recipes. In this case it will look for file in ''meta-ntb/recipes-<some name>/<some other name>/<file name>.bb''. ''.bb'' is the file extension used by ''bitbake'' the build system used by yocto. Finally, create a folder named ''recipes-ntb'' inside ''meta-ntb''. This folder will store all the recipes for this layer. The directory structure should now look like this: | This file configures the layer and where to look for recipes. In this case it will look for a file in ''meta-ost/recipes-<some name>/<some other name>/<file name>.bb''. ''.bb'' is the file extension used by ''bitbake''. Finally, create a folder named ''recipes-xyz'' inside ''meta-ost''. This folder will store all the recipes for this layer. The directory structure should now look like this: |
| |
* meta-ntb | * meta-ost |
* conf | * conf |
* layer.conf | * layer.conf |
* recipes-ntb | * recipes-xyz |
| |
Finally, add the new layer to the build by adding it to ''build/conf/bblayers.conf'' (see [[ software:linux:yocto:setup | here]] for more info) : | Finally, add the new layer to the build by adding it to ''build/conf/bblayers.conf'' (see [[ software:linux:yocto:setup | here]] for more info) : |
BBLAYERS ?= "\ | BBLAYERS ?= "\ |
... | ... |
/home/ubuntu/meta-ntb \ | /home/ubuntu/meta-ost \ |
" | " |
... | ... |
</code> | </code> |
| |
===== Adding machines ===== | ===== Adding Machines ===== |
| |
Machines are the way to go to set machine/hardware specific settings. | Machines are the way to go to set machine/hardware specific settings. |
| |
This example uses the ''genericx86_64'' (included in poky) as a basis to set everything up for the architecture. | This example uses the ''genericx86_64'' (included in poky) as a basis to set everything up for the architecture. |
While it is possible to set up everything from sratch, that job is best left to the vendor/BSP provider. | While it is possible to set up everything from scratch, that job is best left to the vendor/BSP provider. |
Additionally this machine specifies it's kernel and sets ''KMACHINE'' so bitbake knows what architecture to use for the kernel build. | Additionally this machine specifies it's kernel and sets ''KMACHINE'' so bitbake knows what architecture to use for the kernel build. |
Note that ''KMACHINE'' needs to be suffixed with the machine name, and thus is not part of the ''genericx86_64'' machine. | Note that ''KMACHINE'' needs to be suffixed with the machine name, and thus is not part of the ''genericx86_64'' machine. |