Yocto Build Systems
Introduction
Folder overview in Yocto for RDK-B:
For more details on how to add new component to yocto build system refer: Integration Guide for third-party applications into RDK-B stack – RDK – RDK Central Wiki
This document focuses on the example of the RDKB openvswitch module. Openvswitch is utilized for software-defined networking and virtual switching functionalities. It plays a crucial role in enabling network virtualization and providing advanced networking capabilities within the RDKB platform.
openvswitch comes under these layers: meta-cmf-broadband, meta-cmf-raspberrypi, meta-rdk-broadband, meta-virtualization
Module Structure
openvswitch module is structured as:
meta-virtualization
| └── recipes-networking
| └── openvswitch
| ├── openvswitch_git.bb
| └── openvswitch.inc
meta-cmf-raspberrypi
└── recipes-networking
└── openvswitch
└── openvswitch_git.bbappend
The main recipe for building the openvswitch package is represented by “openvswitch_git.bb“. This recipe contains the necessary instructions, dependencies, and configurations to compile and construct the Open vSwitch package from the corresponding source code within the RDKB environment.
Additionally, there is an “openvswitch.inc” file, which is an include file that provides common build settings and variables used in the openvswitch module. It helps streamline the build process and ensures consistency across different recipes and components related to openvswitch.
For openvswitch, certain overrides exist in other meta layers, which can be device specific, here we are focusing on raspberrypi device, there are dedicated append files specific to the ‘raspberrypi’.
Recipe Parameters
Below are some of the important parameters present in the recipes:
Parameters | Description |
---|---|
SRC_URI/SRCREV | URI of source code, patches and extra files to be used to build packages. Uses different fetchers based on the URI/ specify the revision or commit ID of the source code or repository to be used for building a software package. |
DEPENDS/RDEPENDS | Build time and run time package dependencies, where ${PN} represents the package name defined in the recipe. |
PACKAGECONFIG | used to enable or disable specific features or configurations during the build process. |
EXTRA_OEMAKE | It is used to add extra options or arguments to the build command (typically make) during the build process. |
do_install() | Responsible for installing the built software into the target filesystem. It is automatically called during the build process after the compilation stage. |
Parameters in append file-
This .bbappend
file modifies the original openvswitch recipe by removing and adding dependencies, enabling SSL support, disabling the autostart of a particular service, and configuring the package to exclude SSL support. These modifications tailor the build and behavior of the openvswitch package to the specific requirements.
Parameters present in the .bbappend file are mentioned below:
Parameters | Description |
---|---|
DEPENDS_remove/DEPENDS_append_class–target | are used in recipe files (e.g., .bb or .bbappend files) to modify the dependency information, either to remove or to add additional dependencies to the existing list of dependencies for a specific class-target combination. |
EXTRA_OECONF | allows you to add extra command-line arguments or configuration options to the configuration command that is executed during the build of a recipe. |
SYSTEMD_SERVICE | SYSTEMD_SERVICE refers to a service unit configuration file that is used by systemd to define and manage a specific system service. |
In this example, we are referring to the above mentioned append file. Similarly, if we need to include any additional modifications to the recipe, we can do so by adding them in the append file within the SOC and OEM layers.
Building the Module
To build the openvswitch module, execute the following command with Bitbake:”bitbake openvswitch“
We can add the Install task bitbake command, which can be helpful if modifications have been made to the openvswitch source code and there is a need to copy the resulting binaries and libraries from the openvswitch build directory to the target system. The following command can be used:
Install bitbake -c install -f openvswitch
If someone needs to execute a task-wise module, the following commands can be used:
Actions | Bitbake command |
---|---|
Configure | bitbake -c configure -f lib32-openvswitch |
Compilation | bitbake -c compile -f lib32-openvswitch |
cleanall | bitbake -c cleanall lib32-openvswitch |
cleansstate | bitbake -c cleansstate lib32-openvswitch |
Yocto Build Images
- All the components are built using individual recipes. There shall be a main image recipe (example , rdk-generic-image) which includes all other required recipe and create the final RFS
- Package groups recipe is one support a image recipe to select the set of packages
- The recipes will be called in sequence- opensource components, Kernel, SDK, RDKB, MSO, Packaging and create final image.
- The final linux and RFS image will be created under build_folder/tmp/deploy/images
Target image name:-
Image name | Description |
---|---|
rdk-oss-image | An RDK image based on open-source software components, providing flexibility and customization options. |
rdk-generic-broadband-image | A generic RDK build for broadband gateways, providing standardized software components and configurations for internet connectivity. |
Yocto build Image target names are of format- <RDK vendor>-<profile>-<build-type>-<developer>-image
Example-
rdkb-generic-broadband-image_rdkb-2023q4-dunfell_20240102103224.rootfs.wic
rdkb-generic-broadband-image_rdkb-2023q4-dunfell_20240102103224.rootfs.wic.bz2
rdkb-generic-broadband-image_rdkb-2023q4-dunfell_20240102103224.rootfs.tar.gz
Debugging
When facing errors or failures while executing a bitbake action, such as compilation or configuration errors, the specific log files can be found in the following directory structure:
Path: build-raspberrypi4-64-rdk-broadband/tmp/work/raspberrypi4_64_rdk_broadband-rdk-linux/openvswitch/2.13+AUTOINC+71d553b995-r0/temp/
Example
-
log.do_compile: This file contains the error logs related to the compilation process. It provides information about any issues encountered during the translation of source code into executable or object files.
-
log.do_configure: This file contains the error logs associated with the configuration step. It helps identify any problems encountered while setting up the build configuration, such as missing dependencies or incorrect settings.
ERROR: openvswitch-1.0-r0 do_compile: oe_runmake failed ERROR: Logfile of failure stored in: ~/rpi3/build-raspberrypi-rdk-broadband/tmp/work/raspberrypi_rdk_broadband-rdk-linux-gnueabi/openvswitch/1.0-r0/temp/log.do_compile.1540323
The provided example demonstrates a compilation error in the “openvswitch” package. The details of the error can be found in the specified log file, which can be analyzed by searching for the keyword “error”.
The path provided in the example is specific to the mentioned build environment. In your actual working environment, the paths may differ depending on the build system or project structure you are using.