...
show: bitbake-layers show-layers
It is possible to customize existing meta layers by creating an own meta layer with bitbake append files. In this description the meta layer meta-altera for Intel FPGA devices is used as reference.
For more informations about the operating system used and the sources and versions of yocto project or meta-altera layer, see Yocto KICKstart#Used source files.
Scroll Ignore | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||
Before starting to create a custom meta layer, navigate to the yocto poky directory and initialize the environment with the following commands:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
cd <path_to_yocto>/poky
source |
...
oe-init-build-env |
...
bitbake-layers create-layer <yocto_poky_path>/meta-custom
cd <yocto_poky_path>meta-custom
rm -rf recipes-example
To create a dependency to another meta layer, the layer.conf in meta-custom/conf must be modified as follows:
gedit <yocto_poky_path>/meta-custom/conf/layer.conf
change 'LAYERDEPENDS_meta-custom = "core"' to 'LAYERDEPENDS_meta-custom = "meta-altera"'
for bsp:
mkdir -p recipes-bsp/u-boot
mkdir recipes-bsp/u-boot/files
for kernel:
mkdir -p recipes-kernel/linux
mkdir recipes-kernel/linux/files
---add meta layer to bblayers.conf---
-before start to configure anything, the meta layers must be added to <yocto_poky_path>/build/conf/bblayers.conf:
bitbake-layers add-layer ../meta-altera
bitbake-layers add-layer ../meta-custom
---add parameters to local.conf---
-for linux-altera-lts the provider and the version must be added:
PREFERRED_PROVIDER_virtual/kernel = "linux-altera-lts"
cd .. |
Scroll Ignore | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||
Since the created meta-custom layer should depend on meta-altera, these sources files must be downloaded and added to the yocto project.
Navigate to yocto poky directory and download meta-altera layer:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
cd <path_to_yocto>/poky
git clone -b dunfell https://github.com/kraj/meta-altera.git |
Add meta-altera to yocto project with:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
bitbake-layers add-layer ./meta-altera |
Scroll Ignore | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||
In this example, the created layer is named meta-custom.
Create own layer "meta-<custom_name>" with:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
bitbake-layers create-layer ./meta-custom |
The created layer contains a sample recipes folder, that can be removed:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
rm -rf ./meta-custom/recipes-example |
Make meta-custom dependent on meta-altera:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
sed -i '/LAYERDEPENDS_meta-custom/s/core/meta-altera/g' meta-custom/conf/layer.conf |
Add the meta-custom layer to the yocto project with:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
bitbake-layers add-layer ./meta-custom |
Scroll Ignore | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||
First the variable "MACHINE" must be redefined in the local.conf file. Several machines are defined in the meta-altera layer (see meta-altera/conf/machine for more information). In this example, the machine 'cyclone5' is used.
Remove the default value and add 'cyclone5':
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
sed -i '/^MACHINE/s/MACHINE/#MACHINE/g' conf/local.conf
echo -e '\nMACHINE = "cyclone5"' >> conf/local.conf |
For the linux kernel in the meta-altera layer it's required to define a the preferred provider and version in local.conf (see meta-altera/recipes-kernel/linux for other linux kernel versions):
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
echo -e '\nPREFERRED_PROVIDER_virtual/kernel = "linux-altera-lts"' >> conf/local.conf echo -e 'PREFERRED_VERSION_linux-altera-lts = "5.4%"' >> conf/local.conf |
-comment all MACHINE variables out and add:
MACHINE="cyclone5"
devtool create-workspace workspace
Set the preferred u-boot version for meta-altera in local.conf (see meta-altera/recipes-bsp/u-boot for other u-boot versions):
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
echo -e '\nPREFERRED_VERSION_u-boot-socfpga = "v2021.04%"' >> conf/local.conf |
Scroll Ignore | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||
...
###with devtool
Set up the build environment to modify the source for an existing recipe:
devtool modify linux-altera-lts -O -s
Launch menuconfig, make changes to configuration and exit and save your config:
...
devtool update-recipe linux-altera-lts -a ${PWD}/../meta-custom -O
devtool finish linux-altera-lts ${PWD}/../meta-custom/ -f
###with bitbake
run kernel configuration task:
bitbake linux-altera-lts -c kernel_configme -f
Launch menuconfig, make changes to configuration and exit and save your config:
bitbake linux-altera-lts -c menuconfig
generate the fragment.cfg file (contains only the changes made):
bitbake linux-altera-lts -c diffconfig
copy fragment.cfg to meta-custom/recipes-kernel/linux/files. The full path to the generated fragment.cfg file is displayed in the terminal after running 'bitbake linux-altera-lts -c diffconfig'.
cp <path_to_cfg>/fragment.cfg ~/yocto/poky/meta-custom/recipes-kernel/linux/files
create .bbappend file → file name must be the same as original .bb recipe file but with with .bbappend ending
...
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://fragment.cfg "
...
###with devtool
für meta-altera müssen folgende variablen in build/conf/local.conf eingefügt werden (wird nur für die konfiguration via menuconfig gebraucht, muss danach entfernt werden):
UBOOT_MACHINE=" socfpga_cyclone5_defconfig" → welche für die ausgewählte MACHINE benutzt wird steht in meta-altera/recipes-bsp/u-boot/u-boot-socfpga.inc
UBOOT_CONFIG = ""
Set up the build environment to modify the source for an existing recipe:
devtool modify u-boot-socfpga -O -s
Launch menuconfig, make changes to configuration and exit and save your config:
devtool menuconfig u-boot-socfpga
devtool update-recipe u-boot-socfpga -a ${PWD}/../meta-custom -O
folgende variablen können wieder entfernt werden, nachdem beenden der konfigration von u-boot:
UBOOT_MACHINE=" socfpga_cyclone5_defconfig" → welche für die ausgewählte MACHINE benutzt wird steht in meta-altera/recipes-bsp/u-boot/u-boot-socfpga.inc unter UBOOT_CONFIG[...]=...
UBOOT_CONFIG = ""
checkout other branch
git checkout mybranch
git reset --hard origin/mybranch
...