There are tools within bitbake that enable this level of detail.
Creates depends.dot and task-depends.dot files in the current directory. These files show which packages and tasks depend on which other packages and tasks and are useful for debugging purposes.
"bitbake -g -u depexp targetname"
It shows results in a more human-readable GUI style. A simple mount of the resulting root image will show how much storage space is being used.
In addition, the toaster is a new graphical user interface for bitbake that makes these tools much easier to use.
How to overcome github access related error?
To overcome GitHub access-related errors, follow the steps mentioned in the official documentation for adding an SSH key to your GitHub account. Adding a New SSH Key to Your GitHub Account, once you've successfully added the SSH key, you should no longer encounter GitHub access errors.
As with any complex system, the real answer is that it depends, but of course that is not very helpful. The simplest method for adding a single package to your build is to add the below line to conf/local.conf
:
- IMAGE_INSTALL_append = " package"
Use your own package name in place of package. Note the leading space before the package name. If you want to add multiple packages, you can use multiple lines like the above, or list all packages on a single line with:
- IMAGE_INSTALL_append = " package1 package2 package3"
Although if you add in local.conf, that is not permanent change. For permanent addition of that package in final rootfs, you need to be added in image recipe or any package group which is included in the image recipe.
How to prebuilt?
Pre-built images are managed internally by Yocto using the sstate-cache. To utilize a pre-built from a known good build, you can configure your build environment to point to the corresponding cache folder.
- Navigate to the configuration file located in the ./build<buildtype>/conf/ directory.
- Open the relevant configuration file (e.g., local.conf) and specify the path to the sstate-cache where the pre-built images are stored.
- Add or modify the following line to point to your pre-built cache location. SSTATE_DIR = "/path/to/your/sstate-cache"
By setting this cache path, the build system will automatically pick up the pre-built images from the specified location, streamlining the build process.
We can also pull prebuilt from Artifactory and directly install them in rootfs.
Example:
SRC_URI += "https://<artifactoryname>/prebuilts.tar.gz
# Install the necessary files
do_install() {
install -d ${D}/usr/bin
install -m ${WORKDIR}/your-file ${D}/usr/bin
}
What are the commands to build a specific sub-component (WPE, Utopia, etc.)?
In the RDK environment, each sub-component can be built independently using the bitbake command.
- Build a Specific Component: Use the following command, replacing <component> with the name of the desired component: bitbake <component>.
For example, to build the RDK Services, you would run: bitbake rdkservices - Build the Final Image: After building the specific component, you typically need to build the overall image that includes the component. For example, to package the RDK browser into the final image, you would run:
bitbake rdk-generic-<hybrid/mediaclient>-wpe-image
This command generates the final image for hybrid devices, ensuring that only the affected components are rebuilt if nothing has changed.
These are OE metadata variables. Bitbake has preprocessing options where it expands all the local bitbake variables, so you could take advantage of that option to figure it out.
bitbake -e wpewebkit | grep "^S ="
bitbake -e wpewebkit | grep "^WORKDIR ="
It can be used to check for any bitbake variable, alternatively, you can pipe the whole bitbake -e output to a file and inspect the file in your favorite editor.
Why are many components built from external sources in yocto??
Many components are built from external sources to simplify development and enable quick testing of changes. However, this approach is managed by meta-cmf/conf/distro/include/rdk-external-src.inc, which prevents these components from being saved in the sstate cache. As a result, builds can take longer because components are recompiled every time, even if there are no changes.
If you prefer a different approach to save time, you can use the XXX-nosrc.xml manifest file, which is retained after the first build and helps prevent unnecessary recompilation of unchanged components.
How do I locate logs for a particular component in the Yocto/OE folder structure?
You can find log files for each task associated with a recipe in the temp
directory of that recipe. Each log file is named according to the task it corresponds to, such as log.do_compile
for the compile task. Bitbake maintains separate logs for various tasks like fetch, compile, and install.
For example, if you are looking for logs related to the "rdkservices" component on a Raspberry Pi device, you can locate the logs as follows:
The logs for the "rdkservices" recipe would typically be found at:
<build>/tmp/work/<machine>-rdk-linux/rdkservices/1.99+gitAUTOINC+<commit_hash>/temp/
Replace <machine>
and <commit_hash>
with the appropriate values for your build.
Inside the temp
directory, you can find logs for specific tasks. For example: Compile Logs: log.do_compile Fetch Logs: log.do_fetch Install Logs: log.do_install etc.
How to enable/disable kernel/busybox features in Yocto?
To enable or disable kernel or BusyBox features in Yocto, you can modify the recipe metadata by creating a .bbappend file.
- To create a .bbappend file you need to create a file that appends to the existing recipe. The name of the .bbappend file should match the recipe it targets. For example, if you are modifying stblinux.bb, create a file named stblinux_%.bbappend.
- Within the .bbappend file, you can specify the features you want to enable or disable. For example, to enable IPSec, you might create a configuration file named enable_netkey.cfg with the following content: CONFIG_NET_KEY=y
- In your .bbappend file, append the SRC_URI variable to include your configuration file: SRC_URI_append = "file://enable_netkey.cfg"
- If the feature needs to be enabled across all platforms, you can add the .bbappend file to the meta-rdk layer. If it’s specific to a particular platform, place the .bbappend file in the OEM layer corresponding to that platform.
By following these steps, you can effectively manage kernel and BusyBox features in your Yocto builds.
How to enable GDB in build?
The signal core dump that are generated under /tmp can be decoded using gdb.
Procedure:
- In <image>.bbappend file
IMAGE_INSTALL_append = " gdb" - In local.conf
INCOMPATIBLE_LICENSE = "GPL-3.0 LGPL-3.0 AGPL-3.0"
INCOMPATIBLE_LICENSE_pn-gdb = ""
EXTRA_IMAGE_FEATURES += "tools-debug"
EXTRA_IMAGE_FEATURES += "dbg-pkgs" - In <component>.bbappend
CFLAGS += " -D_DEBUG -g " - Compile and flash the binary to device
- Run gdb -c <path to signal dump> <binary>
Bitbake complains about a non-existent path, could not inherit files, invalid environment variable, etc. with "ERROR: Function failed","ERROR: ParseError"? How to resolve this?
The bitbake process terminates after complaining about a non-existent path, could not inherit files or environment variables.
Example:
ERROR: ParseError at /home/<NTID>/kirkstone-nightly20230925-dunfell/meta-cmf-broadband/recipes-ccsp/ccsp/rdk-cellularmanager-mm.bb:26: Could not inherit file classes/pythonnative.bbclass
ERROR: Parsing halted due to errors, see error messages above
To resolve the rdk-cellularmanager-mm Pythonnative error in kirkstone, note that kirkstone uses python3native, while dunfell requires pythonnative. Therefore, you should inherit python3native in your recipe for Kirkstone.
The issue is observed during the setup and machine selection stage, setup-environment script will throw an unexpected error about non-existing layer paths.
Example:
gpsahu01@dvm-wcdcc-tata-001:~/cmf$ source meta-cmf/setup-environment
1) meta-raspberrypi/conf/machine/raspberrypi0.conf 7) meta-rdk-bsp/conf/machine/qemux86hyb.conf
2) meta-raspberrypi/conf/machine/raspberrypi2.conf 8) meta-rdk-bsp/conf/machine/qemux86mc.conf
[…]
Please enter your choice of machine [1..11]: 7
### Shell environment set up for builds. ###
Writing auto.conf ...
Writing versions.txt ...
-bash: cd: ../meta-browser//: No such file or directory
fatal: Not a git repository (or any parent up to mount point /mnt)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
-bash: ../patches/rdk-oe/meta-linaro//*.patch: No such file or directory
-bash: cd: ../meta-openembedded//: No such file or directory
fatal: Not a git repository (or any parent up to mount point /mnt)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Here, if the host PC has set colored terminal output for commands, then it may cause unexpected errors being shown during execution of meta-cmf/setup-environment script. To fix the problem, we can run the following command:
gpsahu01@dvm-wcdcc-tata-001:~/cmf$ alias ls='ls --color=no'
Open-source software related issue:
a) Unable to find revision or branch from upstream: "ERROR: Fetcher failure: Unable to find revision, ERROR: Function failed: Fetcher failure for URL", How to solve this?
When we try to build a very old branch of the code, the manifest file will not be up-to-date, as few of the open-source URLs might not be continuing support of older branches or versions of software.
Example:
WARNING: Failed to fetch URL git://code.qt.io/qt/qtlocation.git;branch=stable, attempting MIRRORS if available
ERROR: Fetcher failure: Unable to find revision f28408346243cf090326f4738fd838219c21e00f in branch stable even from upstream
ERROR: Function failed: Fetcher failure for URL: 'git://code.qt.io/qt/qtlocation.git;branch=stable'. Unable to fetch URL from any source
It is recommended to build with more recent branches, as the code will be well maintained and will have updated features.
b) How to resolve problems caused due to the source URL is no longer available/ site is down with the error "ERROR: Function failed: Fetcher failure for URL?"
An open-source URL is broken either because the website is down temporarily, or it is permanently removed.
Example:
WARNING: Failed to fetch URL http://directfb.org/downloads/Core/linux-fusion/linux-fusion-9.0.3.tar.gz, attempting MIRRORS if available
ERROR: Fetcher failure: Fetch command failed with exit code 4, no output
ERROR: Function failed: Fetcher failure for URL: 'http://directfb.org/downloads/Core/linux-fusion/linux-fusion-9.0.3.tar.gz'. Unable to fetch URL from any source
Temporary workaround: In case of archives (.tar or .zip, etc.), if the file is available from a previously built stack, then it can be copied and an empty file with the name <archive-name>. done has to be created to bypass looking for downloading the file.
Fixing the recipe: If the problematic recipe is available from any other alternative mirror, update the same in SRC_URI part of the recipe. Few components may be available in common mirrors such as github, web.archive.org, oipf.tv etc.
How to enable/disable a FEATURE in build?
To include a specific feature that is not available in base build, enable the feature specific DISTRO flag in platform specific config file. For example, to include WiFi feature in RPi build,
Add the DISTRO specific flag in RPi platform specific conf file.
In File meta-cmf-raspberrypi/conf/distro/include/rdk-rpi.inc
Add DISTRO_FEATURES_append = " wifi" (to include the feature if not there)
DISTRO_FEATURES_remove = " wifi" (to remove the feature)
Make sure the recipe is part of the package build.
Example:
PACKAGECONFIG_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'wifi','wifi', '',d)}"
How to solve error due to RDK_FLAVOR not defined?
ERROR: ParseError at /home/a1602446/build-raspberrypi-rdk-broadband/conf/local.conf:247: Could not include required file conf/distro/include/##RDK_FLAVOR##.inc
The above error occurs intermittently, which can be fixed by retrying the source command for setup_environment file.
In case of RPi, it is
- source meta-cmf-raspberrypi/setup-environment
How to enable or disable any feature using macros?
Please refer Compile-time Build Variants Flags.
How to solve "Invalid md5sum error" (md5sum mismatch in recipe,ERROR: gst-plugins-playersinkbin-noop: md5 data is not matching)?
Bitbake complains about md5sum mismatch when a recipe has retained old md5sum value while the source file is updated.
Example:
ERROR: gst-plugins-playersinkbin-noop: md5 data is not matching for file://gstplayersinkbin.c;md5=0f518921aef846c156f91ce4dd6b7c76
ERROR: gst-plugins-playersinkbin-noop: The new md5 checksum is 958142c8f2783c6c4f357f561585b4da
Update the new md5sum value of the file in recipe. This can be done using the following steps:
:…/meta-rdk/recipes-extended/gst-plugins-playersinkbin/files$ md5sum -t gstplayersinkbin.c
958142c8f2783c6c4f357f561585b4da gstplayersinkbin.c
Now change the above value in recipe accordingly:
LIC_FILES_CHKSUM = "file://gstplayersinkbin.c;md5=958142c8f2783c6c4f357f561585b4da \”
How to solve ”Invalid syntax” error due to python version mismatch during repo commands?
Example:
repo: warning: Python 2 is no longer supported; Please upgrade to Python 3.6+.
Downloading Repo source from https://gerrit.googlesource.com/git-repo
remote: Finding sources: 100% (32/32)
remote: Total 32 (delta 14), reused 32 (delta 14)
Unpacking objects: 100% (32/32), done.
File "/mnt/home /cmf/.repo/repo/main.py", line 79
file=sys.stderr)
^
SyntaxError: invalid syntax
If you're on an older system that doesn't support Python 3.6 or later, you have two options:
- Download an older version of the Repo Launcher that is compatible with Python 2.7.
- Upgrade your Python version to 3.6 or newer.
# create a bin directory
mkdir ~/bin
export PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo-1 > ~/bin/repo
chmod a+x ~/bin/repo