RZ-G/RZG2 yocto

From eLinux.org
< RZ-G
Revision as of 08:12, 2 November 2020 by Cbrandt (talk | contribs) (initial page)
Jump to: navigation, search

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

To build quickly only the dtb with Yocto:

bitbake linux-renesas -c devshell

Once in the shell:

make dtbs 

To get out of the shell:

exit

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.