How to find Software Packages and Versions

The Renesas BSP is distributed as a Yocto 3.1 Dunfell build. Any software packages with Yocto 3.1 Dunfell compatible recipes can be used.

To find what software packages and package versions are available for Yocto 3.1 Dunfell, please visit: https://layers.openembedded.org/layerindex/branch/master/recipes/

Then, simply search and find the package that you were looking for and click on the link to bring you to that package's information page. On the bottom of that new page in the 'Other branches' section, you can see what package version was supported for Yocto 3.1 Dunfell.


Online vs Offline Yocto build

The RZ/G VLP download includes a number of packages named 'OSS package xxx' that contain most of the source code that will be used during the Linux BSP build. The user can download those packages and then run an 'offline' Yocto build, which means that Yocto won't download any source code during the build. However, dealing with the 'OSS' packages is quite inconvenient - the user needs to download 10 to 15 large binary files, then merge them into one very large file, and then transfer that file to the build environment. There are also some limitations to the 'offline' build, for example some packages cannot be built that way.

For that reason we recommend doing an 'online' Yocto build, which is the most typical way those builds are done. There is no need to download the 'OSS' packages in this case. The only thing that is required is checking your local.conf file and making sure that a couple of variables are set correctly. The two variables are 'DL_DIR' - needs to be commented out, and BB_NO_NETWORK - needs to be set to 0.

#DL_DIR = "${TOPDIR}/oss_packages"BB_NO_NETWORK = "0" 
BB_NO_NETWORK = "0"

Hello World Example

Yocto has an example of how to create a simple Hello World application using the SDK that you created/installed on your machine.

https://www.yoctoproject.org/docs/2.4/sdk-manual/sdk-manual.html#sdk-working-projects

Helpful Packages to Include

These packages are not part of the default Yocto BSP build, but they might be helpful to add to your build. Simple add them to your local.conf file.

devmem2 can be used to read RZ/G registers from command line

IMAGE_INSTALL_append = " devmem2"

i2c-tools can be used to read/write to I2C devices from the command line

IMAGE_INSTALL_append = " i2c-tools"

libgpiod can be used to read/write to GPIOs from the command line and from application code

IMAGE_INSTALL_append = " libgpiod" 


Making the Yocto SDK and the '-sdk' root filesystem images smaller

When building the Yocto SDK or one of the '-sdk' images, e.g. 'core-image-weson-sdk', the default configuration includes the source code for most packages which makes the generated images install very big. Generally, you don't need this code outside of Yocto build environment, but some of the Renesas BSP recipes include it. Adding this line below will make your SDK much smaller.

# Do not include "dbg-pkgs" in SDK Installs 
SDKIMAGE_FEATURES_remove = " dbg-pkgs" 

If the SDK is not going to be used for building out-of-tree kernel modules, the kernel source code does not need to be included in it. Removing that reduces the size of the SDK significantly. The line below also removes the 'ltp' package, which is a Linux testing framework that is not needed in most cases.

IMAGE_INSTALL_remove = " kernel-devsrc ltp"  


Common Yocto Build Issues

1) Fixing build issues It often happens that some packages fail while building, e.g.:

ERROR: python3-pytorch-1.5.0-r0 do_configure: oe_runmake failed 
ERROR: python3-pytorch-1.5.0-r0 do_configure: Function failed: do_configure (log file is located at ...) 
ERROR: Logfile of failure stored in: ... 

This kind of errors can be easily fixed by cleaning up :

bitbake –c cleansstate python3-pythorch 

And retrying.

2) Fix bitbake error Invoking bitbake may result in a weird error:

OSError: Cannot initialize new instance of inotify, Errno=Too many open files (EMFILE) 

It is possible to overcome this error by giving this command:

sudo sh -c "echo 8192 > /proc/sys/fs/inotify/max_user_instances" 


Build DTB only with Yocto

If you have modified your Device Tree Source file (.dts) and just want to rebuild only that file (not the entire kernel) to create a new Device Tree Binary (.dtb) file, you can do the following steps.
Open a "development shell" for the Linux kernel:

bitbake linux-renesas -c devshell

Once in the shell, enter this command to have the kernel rebuild the Device Tree Binaries:

make dtbs 

You can find the complied Device Tree Blob (.dtb) files using this command:

find $GIT_CEILING_DIRECTORIES -name '*.dtb'

To exit the 'devshell' window, just type exit.

exit

Even though you have rebuilt your device files inside the devshell, the output files are still located deep inside the Yocto directories (build/tmp/work/hihope_rzg2m-poky-linux/linux-renesas/xxx/xxx/xxx/xxx)
Therefore, execute the following command (outside of devshell) in order to copy them to the default "deploy" directory.

bitbake linux-renesas -fc deploy

Sometimes, Yocto will not copy the files to the deploy directory, even if you specify "-fc deploy". The reason is not known. In this case, if you want to be certain your modified Device Tree has been build and copied, you can do these steps below which rebuild the entire kernel (but will will 100% of the time).

bitbake linux-renesas -fc compile
bitbake linux-renesas -fc deploy

Using Header Files and Shared Libraries in Applications

When you add a library to your Yocto build such as libgpio ( IMAGE_INSTALL_append = " libgpiod" ) and then build an SDK with it (bitbake core-image-weston-sdk -c populate_sdk), the appropriate share library file (.so) and header files (.h) will be added to the 'sysroot' directory in you toolchain.

For example:

$ find /opt/poky/2.4.3 -name gpiod.h
/opt/poky/2.4.3/sysroots/aarch64-poky-linux/usr/include/gpiod.h

$ find /opt/poky/2.4.3 -name "libgpiod.*"
/opt/poky/2.4.3/sysroots/aarch64-poky-linux/usr/lib64/libgpiod.so
/opt/poky/2.4.3/sysroots/aarch64-poky-linux/usr/lib64/libgpiod.so.0
/opt/poky/2.4.3/sysroots/aarch64-poky-linux/usr/lib64/libgpiod.so.0.3.1

Then in your application, you can add #include <gpiod.h> to have access to those library functions.

However, when you build your application with gcc, you need to: 1) Tell gcc where to find the header file.

Use the gcc option " -I " to add an include patch to your gcc command line.

"SDKTARGETSYSROOT" will be defined by the yocto SDK.

-I $SDKTARGETSYSROOT/usr/include

2) Tell gcc that the share library libgpio is required by the application using the -l argument. For libgpio, that would be "-lgpio"

For example:

aarch64-poky-linux-gcc -lgpiod -march=armv8-a -mtune=cortex-a57.cortex-a53 --sysroot=$SDKTARGETSYSROOT -I $SDKTARGETSYSROOT -O2 -pipe -g -feliminate-unused-debug-types -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed hello1.c -o hello1

Building Webviewer

Webviewer is the RZ/G2 lightweight GPU optimized browser we recommend for HTML5 GUIs. It is not included in the VLP by default but you need Gecko to be there as pre-requisite (see VLP release note about how to add it).

git clone https://github.com/webdino/meta-browser

in the user_work directory (or whenever the other VLP meta layers are). Change the local.conf (/user_work/build/conf) to have "firefox" replaced with "webviewer":

IMAGE_INSTALL_append = “ webviewer “ 
IMAGE_INSTALL_append = “ ttf-sazanami-gothic ttf-sazanami-mincho “ 
PACKAGECONFIG_append_pn-webviewer = “ egl “ 
PACKAGECONFIG_append_pn-webviewer = “ openmax “ 
PACKAGECONFIG_append_pn-webviewer = “ webgl “ 
PACKAGECONFIG_append_pn-webviewer = “ canvas-gpu “ 
PACKAGECONFIG_append_pn-webviewer = “ stylo “ 

Add the meta-layer to the bblayers.conf:

BBLAYERS += " ${TOPDIR}/../meta-browser " 
Optionally you can include the Gem Tanzanite demo: 
BBLAYERS += " ${TOPDIR}/../meta-gecko-embedded/meta-demo " 

And in the local.conf:

IMAGE_INSTALL_append = " gem-tanzanite " 

The file /usr/bin/gem-tanzanite.sh shall be modified as well, replacing firefox with webviewer. Then the demo can then be started by typing the command:

gem-tanzanite

Note that the demo can be navigated only by using a touch-enabled monitor (no mouse). If you know what you're doing you can hack the app.js in the js folder to turn the touch events into mouse events.

How to add any files in rootfs with yocto

If you have a file or files and you want this file to be present on the root file system. There are two steps for this:

1. Create a recipe
2. Add this recipe into your local.conf file

There are different ways to add new recipes to Yocto. One way is to simply create a new recipe_version.bb file within one of the existing layers used by Yocto. Another preferred method for adding recipes to the build environment is to place them within a new layer.

For this post, let's consider you want to copy a script file to bin folder of root file system. Also create your own layer to add recipe to the build.

1. Create your own layer called "meta-custom" using the bitbake-layers create-layer command.

$cd build
$bitbake-layers create-layer ../meta-custom

The command automates layer creation by setting up a subdirectory with a layer.conf configuration file, a recipes-example subdirectory that contains an example.bb recipe, a licensing file, and a README.

../meta-custom
├── conf
│   └── layer.conf
├── COPYING.MIT
├── README
└── recipes-example
    └── example
        └── example_0.1.bb

After that you can add the newly created layer to the Yocto Project environment in conf/bblayers.conf:

${TOPDIR}/../meta-custom \

There is also a command to add a new layer to bblayer.conf: bitbake-layers add-layer.

But this includes the meta layer with absolute paths, which can be avoided by adding it manually.


2. Create your recipe called 'recipes-app' folder inside your own 'meta-custom' layer


3. In 'recipes-app' folder create a new folder named as per your requirement, for example 'echo-hello-world'


4. cd into the 'echo-hello-world' and then create a folder named 'files' into that


5. copy your script file "hello.sh" into the files folder. Also add a licensing file.

#!/bin/bash
var="Hello World"
# print it 
echo "$var"

6. cd back to the 'echo-hello-world' folder and create a file named 'echo-hello-world_1.0.bb'(recipe_version.bb)

../meta-custom
├── conf
│   ├── bitbake-cookerdaemon.log
│   └── layer.conf
├── COPYING.MIT
├── README
├── recipes-app
│   └── echo-hello-world
│       ├── echo-hello-world_1.0.bb
│       └── files
│           ├── COPYING
│           └── hello.sh
└── recipes-example
    └── example
        └── example.bb

7. copy the recipe in echo-hello-world_1.0.bb

SUMMARY = "Hello World echo script"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://COPYING;md5=a70b80ed7aa06ee4bc60901a9e98d373"

SRC_URI = " \
file://COPYING \
file://hello.sh \
"

S = "${WORKDIR}"

do_install () {
    # create the /usr/bin folder in the rootfs with default permissions
    install -d ${D}${bindir}
    # install the application into the /usr/bin folder
    install -m 0755 ${S}/hello.sh ${D}${bindir}
}
RDEPENDS_${PN} += "bash"

8. Add the following line into local.conf :

IMAGE_INSTALL_append = " echo-hello-world"


After board boot up, you can see your script file in /usr/bin as:

root@hihope-rzg2m:/usr/bin# ls | grep hello.sh 
hello.sh
root@hihope-rzg2m:/usr/bin# ./hello.sh 
Hello World

Example of Overlay Copy

  • If you just want a layer/recipe that will just copy any files and directories you want, you can follow the instructions below.

1. Add this line to the end your build/conf/bblayers.conf file.

BBLAYERS += " ${TOPDIR}/../meta-overlay"

2. Add this line to the end your build/conf/local.conf file.

IMAGE_INSTALL_append = " overlay-files"

3. Make the directory "meta-overlay" in the base of your Yocto directory

meta-overlay/
├── conf
│   └── layer.conf
├── COPYING.MIT
├── README
└── recipes-overlay-files
    └── overlay-files
        ├── files
        │   └── rootfs_base
        │       └── home
        │           └── root
        │               └── test.txt
        └── overlay-files_0.1.bb

The contents of overlay-files_0.1.bb as follows:

SUMMARY = "Overlay (copy) files into rootfs"
DESCRIPTION = "Overlay (copy) files into rootfs before making images"

LICENSE = "MIT"
LIC_FILES_CHKSUM ?= "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

# We could use CLOSED in order to avoid setting LIC_FILES_CHKSUM
#LICENSE = "CLOSED"

# All the directories and files under "files/rootfs_base/" directory will be
# installed into the final rootfs

SRC_URI += " file://* "

S = "${WORKDIR}"

do_install () {
    #echo "S = ${S}"
    #echo "D = ${D}"

    install -d ${D}/
    cp -vr ${S}/rootfs_base/* ${D}/
}

# Incluse all those files in the install packages
FILES_${PN} += "/"

DNF (package manager)

DNF is a software package manager that installs, updates, and removes packages on RPM-based Linux distributions. (more information)

Create a DNF repository to install packages

Linux Desktop users have surely used a package management system like apt, yum, opkg, etc. This is a very convenient way to install a missing package that was not part of the default distro.

In case of Yocto there is a relatively easy way to create a package repository using dnf. When a distro build is launched using bitbake, Yocto creates a package feed directory located by default in the build/tmp/deploy/rpm folder. The rpm can be transferred to the target and installed using the good old rpm -i command. However this is a tedious process and it does not check for dependencies. We can create a repository in the rpm folder using the createrepo_c command:

/build/tmp/deploy/rpm$ createrepo_c .
Directory walk started
Directory walk done - 16062 packages
Temporary output repo path: ./.repodata/
Preparing sqlite DBs
Pool started (with 5 workers)
Pool finished

Once the repository has been created, we have to have a simple file HTTP server running from this folder. The easiest way is to use the python HTTP server that does not require any configuration:

/build/tmp/deploy/rpm$ python3 -m http.server 8800

The last step is to configure the target to point at the repository that we have just built. Let's first create the directory supposed to contain the repository configuration file(s):

root@smarc-rzg2l:~# mkdir -p /etc/yum.repos.d

Then create the config file itself:

root@smarc-rzg2l:~# vi /etc/yum.repos.d/mypackages.repo

And then paste this content:

[packages]
name=repos
baseurl=http://SERVER_IP_ADDRESS:8800/
gpgcheck=0
enabled=1
metadata_expire=0

To test the repository is working:

root@smarc-rzg2l:~# dnf repoinfo
repos                                                                                                                                                                     16 MB/s | 4.7 MB     00:00
Last metadata expiration check: 0:00:09 ago on Thu Jan  5 14:44:36 2023.
Repo-id      : packages
Repo-name    : repos
Repo-revision: 1672929083
Repo-updated : Thu Jan  5 14:31:23 2023
Repo-pkgs    : 16062
Repo-size    : 2.8 G
Repo-baseurl : http://192.168.10.118:8800/
Repo-expire  : Instant (last: Thu Jan  5 14:44:36 2023)
Repo-filename: /etc/yum.repos.d/mypackages.repo

Now it should be possible to install a missing package using dnf:

root@smarc-rzg2l:~# dnf install glmark2
repos                                                                                                                                                                    597 kB/s | 3.0 kB     00:00
Dependencies resolved.
=========================================================================================================================================================================================================
 Package                                     Architecture                                Version                                                      Repository                                    Size
=========================================================================================================================================================================================================
Installing:
 glmark2                                     aarch64                                     20191226+0+72dabc5d72-r0                                     packages                                     6.7 M
Installing dependencies:
 libgbm1                                     aarch64                                     2:20.0.2-r0                                                  packages                                      27 k
Transaction Summary
=========================================================================================================================================================================================================
Install  2 Packages
Total download size: 6.8 M
Installed size: 12 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): libgbm1-20.0.2-r0.aarch64.rpm                                                                                                                                     2.5 MB/s |  27 kB     00:00
(2/2): glmark2-20191226+0+72dabc5d72-r0.aarch64.rpm                                                                                                                       11 MB/s | 6.7 MB     00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                     11 MB/s | 6.8 MB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                 1/1
  Installing       : libgbm1-2:20.0.2-r0.aarch64                                                                                                                                                     1/2
  Running scriptlet: libgbm1-2:20.0.2-r0.aarch64                                                                                                                                                     1/2
%post(libgbm1-2:20.0.2-r0.aarch64): scriptlet start
%post(libgbm1-2:20.0.2-r0.aarch64): execv(/bin/sh) pid 366
+ set -e
+ '[' x = x ']'
+ '[' -x /sbin/ldconfig ']'
+ /sbin/ldconfig
%post(libgbm1-2:20.0.2-r0.aarch64): waitpid(366) rc 366 status 0
  Installing       : glmark2-20191226+0+72dabc5d72-r0.aarch64                                                                                                                                        2/2
  Verifying        : glmark2-20191226+0+72dabc5d72-r0.aarch64                                                                                                                                        1/2
  Verifying        : libgbm1-2:20.0.2-r0.aarch64                                                                                                                                                     2/2
Installed:
  glmark2-20191226+0+72dabc5d72-r0.aarch64                                                                  libgbm1-2:20.0.2-r0.aarch64
Complete!

If the package is missing in the repository, of course it can be built using bitbake:

bitbake glmark2

And the repository database need to be refreshed running the createrepo_c command again.

Note: dnf has been disabled in the default latest VLP default configuration (build/conf/local.conf):

# Remove dnf package which causes high CPU workload
PACKAGE_INSTALL_remove = " dnf "

The reason is described in the next paragraph. To bring it back that line shall be commented out.

Disable DNF to Increase Application Performance

  • It has been observed that some services related to DNF periodically update the system. This makes CPU workloads very high (100% load) and affects application processing including the overall frame rate of video streams.
  • If the package management system is not used, disabling the DNF services, your application might show improved performance and lower CPU loads.
  • Below are the command used to stop the DNF services.
systemctl disable dnf-automatic-download.service
systemctl disable dnf-automatic-download.timer
systemctl disable dnf-automatic-install.service
systemctl disable dnf-automatic-install.timer
systemctl disable dnf-automatic-notifyonly.service
systemctl disable dnf-automatic-notifyonly.timer
systemctl disable dnf-makecache.service
systemctl disable dnf-makecache.timer

Save Disk Space by Deleting Temporary Files

Blocked URLS during Yocto Build

During a yocto build IT may block some of the URLS because the URL uses HTTP not HTTPS. This is a common issue with all Yocto environments. Below are some solutions.

Solution 1)

One suggestion is to try to the changing the url http requests to https.

Here is an example for doing this with github. In this example you should changed the url.httlps://github.com and .insteadOf [./git://github.com git://github.com] to your blocking URL.

Solution 2)

For some recipes, solution 1nwill not work. Our Second solution is to manually change the recipe. For these recipes you will need to go into the edit the recipe SRC_URI to use the https protocol.

For example the

SRC_URI = "git://server.com/PATH/TO/ti-linux-kernel.git"

to

SRC_URI = "git://server.com/PATH/TO/ti-linux-kernel.git;protocol=https"

Fix ERROR: Unable to connect to bitbake server

If your build stops/hangs before it completes, or you kill it early, you might not be able to start it back up again and you will get this message:

  • ERROR: Unable to connect to bitbake server, or start one (server startup failures would be in bitbake-cookerdaemon.log).

In that case, do this to start it back up again:

$ cd build
$ rm -rf bitbake.lock

Include the kernel source in the SDK

  • If you want to include the kernel source code in the SDK install, please add the following to your local.conf
TOOLCHAIN_TARGET_TASK_append = " kernel-devsrc"

Multiple Versions of u-boot Error

If you see this error:

ERROR: Multiple versions of u-boot are due to be built ..... Only one version of a given PN should be built in any given build. You likely need to set PREFERRED_VERSION_u-boot to select the correct version or don't depend on multiple versions.

Then add this line into local.conf:

RRECOMMENDS_libubootenv-bin_remove_class-target = " u-boot-default-env"


WIC Images

Yocto can create binary images of the entire system, including partition table information.

The is done in the Renesas BSP in: meta-renesas/tree/dunfell/rz/meta-rz-common/wic

For more information about creating custom WIC images for your own board, and the .wks file syntax, please see:



  • No labels