How bitbake searches for recipe in build process? - yocto

I am trying to find out that how bitbake search for recipe in build process ?
For example,
I have a recipe something like below:
DESCRIPTION = "PetaLinux GSTREAMER supported packages"
inherit packagegroup
GSTREAMER_PACKAGES = " \
gstreamer1.0 \
gstreamer1.0-python \
gstreamer1.0-meta-base \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad \
gstreamer1.0-rtsp-server \
gst-shark \
gstd \
gst-perf \
gst-interpipes \
"
GSTREAMER_PACKAGES_append_zynqmp = " gstreamer1.0-omx"
RDEPENDS_${PN} = "${GSTREAMER_PACKAGES}"
When I searched gstreamer1.0 related recipe in yocto layers, I found two recipe, one of them is gstreamer1.0_1.16.1.bb in meta layer, and the other is gstreamer1.0_%.bbappend in meta-petalinux layer.
Both of these layers was added to the BBLAYERS in bblayers.conf file and the priorities that spesified with BBFILE_PRIORITY_* in related layer's layer.conf file is same.
So,
Which recipe will be used in build process in that case ?
What is the recipe lookup rules in yocto ?
I changed somethings to understand the behaviour:
For example,
I entered the invalid github URL that spesified in gstreamer1.0_%.bbappend recipe. When I tried to build the linux system, I encountered with an error. Thats fine.
Then I corrected the github URL in this recipe and entered invalid source code address that spesified in gstreamer1.0_1.16.1.bb recipe. When I tried to build linux system, process finished successfully.
Then I increased the priority of meta layer. I supposed to encounter with an error in this case but again build process finished successfully.
Could you please help me to understand this behaviour ?
Thanks.

You have two different files: a .bb and a .bbappend.
A .bb is the base recipe of one (or multiple) packages. It generally describe how to fetch, configure, compile, install files in a package for your target.
A .bbappend file is an 'append' file. It allows a meta (here meta-petalinux) to modify an existing recipe in another meta without copying it. A .bbappend can modify any steps of the bb file: source fetch, configure, compile, install...
You can for example create your own bbappend of Gstreamer, to enable pango (disbaled by default on my Yocto). The bbappend filename is gstreamer1.0-plugins-base_%.bbappend and only contains PACKAGECONFIG_append = "pango"
The Yocto Manual can give you more information on bbappend files here.

Related

Patch for device tree

I am trying to configure and update my device tree by adding a node to it using a patch file created using quilt and building it with yocto.
made the bbappend recipe of the one already present in the BSP layer of the kernel directory.
patches are getting compiled but failing to update the source code and the node I am trying to create on my board is not reflected running kernel.
#this recipe is used to modify the kernel files
DESCRIPTION = "Patch file for kernel"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI_append = " \
file://001-adding-headers-msm8909-mdss-panels-dtsi.patch \
file://001-SPI3-Node-msm8909-pinctrl-dtsi.patch \
file://001-adding-node-to-config-msm8909-dtsi.patch \
file://001-spi0-i2c-node-msm8909-mtp-dtsi.patch \
"
whereas patch files also point to the exact source code I am trying to modify.
What is the area I am missing over it? The data I am trying to add with help of a patch is working fine if I directly paste it to the source code of the device tree. but trying to add it with help of a patch because not want to modify BSP-layer doing the changes within my local layer.

Yocto: Data file clashes build error while enabling libvirt

While enabling libvirt in yocto, I am seeing below data file clash issue while building yocto image,
Below are the packages I am trying to append install to my yocto image
IMAGE_INSTALL_append = " \
packagegroup-core-boot \
qemu \
libvirt \
libvirt-libvirtd \
libvirt-virsh \
kernel-module-kvm \
kernel-module-kvm-intel \
"
But I see below issue, when I build image enabling above packages,
`Collected errors:
check_data_file_clashes: Package iptables wants to install file /-/-/-/rootfs/etc/ethertypes
But that file is already provided by package * ebtables`
FYI: I see that libvirt has both iptables and ebtables dependency.
can someone help on understanding this and how to resolve?
I tried to remove ebtables with PACKAGECONFIG_remove = "ebtables" and image is built but I when starting libvirtd service it is always in dead mode and I see some issue related to socket.
Actually, this is a problem that has no solution except:
Remove one of the packages (ebtables or iptables)
Remove the file ethertypes from one of the recipes
libvirt depends on iptables on compile time only, so I did not know why iptables is present in the image ?
Anyways, it has a config on ebtables and from your comment when you removed it from PACKAGECONFIG it failed to work. So:
I suggest check if iptables is required by other package at run time, if not remove it.
If both are required in your case, then go for the second solution which is removing the file from one of the recipes, using a bbappend file for one of them:
The block that you may need to add is:
do_install_append() {
rm ${D}/etc/ethertypes
}
either to:
meta-custom/recipes-filter/ebtables/ebtables_%.bbappend
or to:
meta-custom/recipes-extended/iptables/iptables_%.bbappend
NOTE
If you go for the second solution, you need to make sure that the file is not present in the FILES variable of the recipe that you will remove the file from, FILES_ebtables or FILES_iptables.

No recipes available (meta-wandboard-ap)

I have already built an image for wandboard using fsl-community-bsp-platform manifest and dunfell branch. I use bitbake core-image-minimal to make the build.
The idea is that I want to turn Wandboard into a wireless access point using meta-wandboard-ap. I followed all the instructions and add the layer to BBLAYERS in build/conf/bblayers.conf.
When I attempt to run the bitbake command to create the image, I get the following error message:
sami#sami-deepevent:~/fsl-community-bsp-dunfell/wandboard$ bitbake core-image-minimal
WARNING: Layer wandboard-ap should set LAYERSERIES_COMPAT_wandboard-ap in its conf/layer.conf file to list the core layer names it is compatible with.
WARNING: Layer wandboard-ap should set LAYERSERIES_COMPAT_wandboard-ap in its conf/layer.conf file to list the core layer names it is compatible with.
Loading cache: 100% |##########################################################| Time: 0:00:00
Loaded 3269 entries from dependency cache.
Parsing recipes: 100% |########################################################| Time: 0:00:00
Parsing of 2177 .bb files complete (2176 cached, 1 parsed). 3269 targets, 267 skipped, 0 masked, 0 errors.
ERROR: No recipes available for:
/home/sami/fsl-community-bsp-dunfell/sources/meta-wandboard-ap/recipes-kernel/linux-firmware/linux-firmware_git.bbappend
Summary: There were 2 WARNING messages shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
That's the content of the linux-firmware_git.bbappend file:
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI_append = " \
file://fw_bcm4329_apsta.bin \
file://fw_bcm4330_apsta_bg.bin \
"
do_install_append () {
install -m 644 ${WORKDIR}/fw_bcm4329_apsta.bin ${D}/lib/firmware/brcm/brcmfmac4329-ap-sdio.bin
install -m 644 ${WORKDIR}/fw_bcm4330_apsta_bg.bin ${D}/lib/firmware/brcm/brcmfmac4330-ap-sdio.bin
}
FILES_${PN}-bcm4329 += " \
/lib/firmware/brcm/brcmfmac4329-ap-sdio.bin \
"
FILES_${PN}-bcm4330 += " \
/lib/firmware/brcm/brcmfmac4330-ap-sdio.bin \
"
ALTERNATIVE_TARGET_linux-firmware-bcm4329[brcmfmac4329-sdio.bin] = "${BRCM_FWDIR}/brcmfmac4329-ap-sdio.bin"
ALTERNATIVE_PRIORITY_linux-firmware-bcm4329[brcmfmac4329-sdio.bin] = "90"
ALTERNATIVE_TARGET_linux-firmware-bcm4330[brcmfmac4330-sdio.bin] = "${BRCM_FWDIR}/brcmfmac4330-ap-sdio.bin"
ALTERNATIVE_PRIORITY_linux-firmware-bcm4329[brcmfmac4330-sdio.bin] = "90"
What could be the reason for this error? How to make it find the files and recipes?
In Yocto, when creating a .bbappend file, the original .bb file must exist in one of the layers in bblayers.conf.
The problem is that Yocto parsing stage will try to append the content of linux-firmware_git.bbappend to linux-firmware_git.bb.
That failed, which means that you have no linux-firmware_git.bb recipe.
But the linux-firmware recipe exists in meta layer of poky. You can check in this link.
The recipe exists in dunfell under version: linux-firmware_20211027.bb
So, just change linux-firmware_git.bbappend to:
linux_firmware_%.bbappend
with that, it will match the highest version available for linux-firmware.
Also, make sure meta is present in your bblayers.conf.

Yocto recipes not found

I'm learning Yocto and to try it I'm following a very detailed example.
When I try to build the image (qt5.image) it returns a couple of errors after parsing recipes:
$bitbake qt5-image
...
ERROR: No recipes available for:
/home/dev/yocto/poky/meta-raspberrypi/recipes-bsp/u-boot/u-boot_2019.07.bbappend
/home/dev/yocto/poky/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.16%.bbappend
The error is pretty clear, but because those meta- are not mine, but downloaded from the official repository git://git.yoctoproject.org/meta-raspberrypi I'm not sure why this error may happen.
Is there something I can fix by myself?
UPDATE:
Here the content of bblayer.conf I've adjusted the paths but it's the same file of the example linked above:
$ cat conf/bblayers.conf
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
${HOME}/yocto/poky/meta \
${HOME}/yocto/poky/meta-poky \
${HOME}/yocto/poky/meta-openembedded/meta-oe \
${HOME}/yocto/poky/meta-openembedded/meta-multimedia \
${HOME}/yocto/poky/meta-openembedded/meta-networking \
${HOME}/yocto/poky/meta-openembedded/meta-perl \
${HOME}/yocto/poky/meta-openembedded/meta-python \
${HOME}/yocto/poky/meta-qt5 \
${HOME}/yocto/poky/meta-raspberrypi \
${HOME}/rpi/meta-rpi \
"
What the error message is telling you is that meta-raspberrypi layer is trying to modify recipes that it expects to exist in another layer. In this case the u-boot and gstreamer1.0-omx recipes come from "meta" (so the yocto/openembedded main layer).
You should check that your layers are all using the same branches (and are all up-to-date). I'm guessing that your meta layer (typically from poky git) is on some release branch and your meta-raspberrypi is using master. In that case the build would fail like yours does (e.g. gstreamer1.0-omx would be version 1.14.4 and the bbappend would look for another version).
I had the same issue, what I did is to checkout meta-raspberrypi with branch corresponding to the poky branch:
git clone -b warrior git://git.yoctoproject.org/poky
cd poky
git clone -b warrior git://git.yoctoproject.org/meta-raspberrypi
source oe-init-build-env
Add layer to conf/bblayers.conf
Change MACHINE in conf/local.conf
bitbake rpi-basic-image
Can you make sure 'meta-raspberrypi' is included in bblayers.conf file. You can check this layer included in
build-*/conf/bblayers.conf
If it is not included, add this layer into bbpath in bblayers.conf and rebuild it.
If it's still available could you please send the complete logs for the error?

Using PREMIRRORS in Bitbake configuration

How do I use PREMIRRORS in Bitbake local configurations or recipes?
I want to provide my own download locations for some slow or inaccessible third-party URLs, but the official PREMIRRORS documentation is vague and lacks examples.
Note: These results are based on experimentation with Yocto 2.3, but probably apply to 2.5 as well.
A simple example
Suppose that your recipe file contains this target URL:
SRC_URI = "http://download.example.com:8080/foo/bar/baz-1.0.tar.gz"
Then in your local.conf, you can define your custom download location as:
PREMIRRORS_prepend = "http://download\.example\.com:8080/.* http://my-mirror.example.com/copies/\n"
In this default case (with no special placeholders) Bitbake does not include the additional /foo/bar path elements, and instead tries to download just the filename from http://my-mirror.example.com/copies/baz-1.0.tar.gz
Advanced examples
These samples use special predefined placeholders, which are detailed in the next section.
HTTP/HTTPS with same file structure
Recipe: SRC_URI = "https://example.com:1234/foo/bar.zip"
Setting: PREMIRRORS_prepend = "http(s)?://example\.com(:\d+)?/.* http://mirror.local/PATH\n"
Attempts: http://mirror.local/foo/bar.zip
HTTP/HTTPS with flat structure
Recipe: SRC_URI = "https://example.com:1234/foo/bar.zip"
Setting: PREMIRRORS_prepend = "http(s)?://example\.com(:\d+)?/.* http://mirror.local/MIRRORNAME\n"
Attempts: http://mirror.local/example.com.1234.foo.bar.zip
Just switch the hostname
Recipe: SRC_URI = "ftp://example.com:1234/foo/bar.zip"
Setting: PREMIRRORS_prepend = "(\w+)://example\.com(:\d+)?/.* TYPE://mirror.local/PATH\n"
Attempts: ftp://mirrors.local/foo/bar.zip
Placeholders in replacement URI
PREMIRRORS parses all matched URIs and provides five special placeholder values in the target URI. Supposing the matched URI is http://host.example.com:1234/foo/bar/baz.txt:
TYPE https
HOST host.example.com%3A1234
PATH foo/bar/baz.txt
BASENAME baz.txt
MIRRORNAME host.example.com.1234.foo.bar.baz.txt
Altering the PREMIRRORS variable
The PREMIRRORS variable consists of series of lines (separated by \n) each with a regular expression to match a URI, and then a replacement string, with both portions separated by a space.
Bitbake tries them in order of appearance, and you generally want your private mirrors to take priority, so prepend onto PREMIRRORS, ex:
PREMIRRORS_prepend = "http://original/location/.* http://alternate/location/\n"
What file should I edit?
You can add entries to PREMIRRORS inside your bitbake recipes, but it is not recommended, since a major use of PREMIRRORS is for people reusing your recipe in some other context or location.
Instead, you can put it inside your local.conf file in an existing build directory. Alternately, edit the source template which Poky script use when creating a new local.conf in a fresh build-directory.
Other questions
What about SOURCE_MIRROR_URL?
The SOURCE_MIRROR_URL is a quick way to add a series of PREMIRROR entries for all supported protocols. For example, this setting:
INHERIT += "own-mirrors"
SOURCE_MIRROR_URL = "TYPE://mirror.local/PATH"
is the same as writing:
PREMIRRORS_prepend = "\
cvs://.*/.* TYPE://mirror.local/PATH \
svn://.*/.* TYPE://mirror.local/PATH \
git://.*/.* TYPE://mirror.local/PATH \
gitsm://.*/.* TYPE://mirror.local/PATH \
hg://.*/.* TYPE://mirror.local/PATH \
bzr://.*/.* TYPE://mirror.local/PATH \
p4://.*/.* TYPE://mirror.local/PATH \
osc://.*/.* TYPE://mirror.local/PATH \
https?$://.*/.* TYPE://mirror.local/PATH \
ftp://.*/.* TYPE://mirror.local/PATH \
npm://.*/?.* TYPE://mirror.local/PATH \
"
It seems the INHERIT+SOURCE_MIRROR_URL directives will still work if used in your local.conf (as opposed to a particular recipe.) However, Bitbake will emit warnings, so it may not be the intended use-case. Ex:
WARNING: Invalid protocol in PREMIRRORS: ('cvs://.*/.*', 'TYPE://mirror.local/PATH')
How can I check and debug my settings?
The -D debug flag will cause bitbake to emit information about what URLs it attempts to download from. You can also use -C do_fetch, which will force it to try the fetch step and re-download anything needed for the given recipe.
bitbake -D -C do_fetch software-recipe-name-here
Here's some example debug output, showing the PREMIRROR URL it attempts to access:
DEBUG: some-software-1.0 do_fetch: Trying PREMIRRORS
DEBUG: some-software-1.0 do_fetch: Fetcher accessed the network with the command /usr/bin/env wget -t 2 -T 30 -nv --passive-ftp --no-check-certificate -P /home/user/build_foo/DL_DIR 'http://mirror.local/path/to/the/filename.ext
If you need to experiment and run bitbake many times, it will be faster to temporarily put your new PREMIRRORS_prepend directive into a particular test-recipe, as opposed to modifying the local.conf. This is because Bitbake won't need to re-parse all the other recipes whenever you change it.
What if I want to isolate a port-number, e.g. http://host:123/foo?
Apparently there's no easy way to get the 123 on its own. While PREMIRRORS allows you to match with regular expressions, it does not seem to support using captured text from the match inside the replacement URI.
The port number is present inside HOST and MIRRORNAME, but there's no standard mechanism to split those values apart.
Fllow up. What if I want to isolate a port-number, e.g. http://host:123/foo?
Maybe you can use captured.
like:
org: "http://somewhere.org:1234/somedir1/somedir2/somefile_1.2.3.tar.gz"
reg: "http://somewhere.org(:\d+)?/.*"
sub: "http://somewhere2.org\1/somedir3"
result: "http://somewhere2.org:1234/somedir3/somefile_1.2.3.tar.gz"