Difference between revisions of "RZ-G/RZG2 yocto"

From eLinux.org
Jump to: navigation, search
(added BSP Differences Between renesas.com Download and Github Version)
(Replaced content with "this page can be deleted")
(Tag: Replaced)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__TOC__
+
this page can be deleted
 
 
= BSP Differences Between renesas.com Download and Github Version =
 
Below are the differences between BSP you download from renesas.com and what is available on public repositories.
 
 
 
'''Public Repository Clones'''<br>
 
* meta-gplv2/
 
* meta-linaro/
 
* meta-openembedded/
 
* meta-qt5/
 
* meta-rzg2/
 
* meta-virtualization/
 
* poky/
 
These directories are direct clones (no modifications) from public repositories. The repository URLs and commit IDs that were used are documented in the [https://github.com/renesas-rz/meta-rzg2/blob/master/README.md README.md] file in the meta-rzg2 directory in the BSP.
 
 
 
 
 
'''Example Layers'''<br>
 
* meta-hmi-custom/
 
* meta-userboard/
 
These directories do not have any functionally. They are simple example templates you can use to make your own customer layers. They are only included in the renesas.com package.
 
 
 
 
 
'''The RZ/G2 BSP'''<br>
 
* meta-rzg2/
 
Basically, all the customizations and patches are located in the directory 'meta-rzg2'.<br>
 
This directory is a clone of the public repository is located here: https://github.com/renesas-rz/meta-rzg2.<br>
 
There are git tags for BSP version that was release.<br>
 
The only difference is that in the renesas.com version, the following lines were added to the local.conf files under docs/sample/conf
 
: DL_DIR = "${TOPDIR}/oss_packages"
 
: BB_NO_NETWORK = "0"
 
Additionally, other configuration files such as bblayers_gecko.conf and local_gecko.con are added to the renesas.com download that are not in the github version.
 
 
 
 
 
'''Non-public Patches'''<br>
 
* extra/
 
This directory is only in the package downloaded from renesa.com<br>
 
It contains patches that are not included in the public the meta-rzg2 repository on github. For example, the patches to enable HDMI on the boards were not posted to github because of potential license issues.
 
 
 
 
 
'''Video and Multi-media Drivers'''<br>
 
* proprietary/
 
This directory is only in the package downloaded from renesa.com<br>
 
This directory contains .zip files which are essentially the propriety closed source video and multimedia drivers. They used to be downloaded separately, but are now included when downloaded the BSP from renesas.com. When following the instructions in the "Renesas Note" that comes with the BSP, users will run the script copy_proprietary_softwares.sh which will unpack these zip files into various directories under meta-rzg2.
 
 
 
 
 
= 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.
 
 
 
<pre>
 
#DL_DIR = "${TOPDIR}/oss_packages"BB_NO_NETWORK = "0"
 
BB_NO_NETWORK = "0"
 
</pre>
 
 
 
= 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
 
<pre>IMAGE_INSTALL_append = " devmem2"</pre>
 
 
 
i2c-tools can be used to read/write to I2C devices from the command line
 
<pre>IMAGE_INSTALL_append = " i2c-tools"</pre>
 
 
 
libgpiod can be used to read/write to GPIOs from the command line and from application code
 
<pre>IMAGE_INSTALL_append = " libgpiod" </pre>
 
 
 
 
 
= 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.
 
<pre>
 
# Do not include "dbg-pkgs" in SDK Installs
 
SDKIMAGE_FEATURES_remove = " dbg-pkgs"
 
</pre>
 
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.
 
<pre>
 
IMAGE_INSTALL_remove = " kernel-devsrc ltp" 
 
</pre>
 
 
 
 
 
= Common Yocto Build Issues =
 
1) Fixing build issues
 
It often happens that some packages fail while building, e.g.:
 
<pre>
 
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: ...
 
</pre>
 
This kind of errors can be easily fixed by cleaning up :
 
<pre>
 
bitbake –c cleansstate python3-pythorch
 
</pre>
 
And retrying.
 
 
 
2)  Fix bitbake error
 
Invoking bitbake may result in a weird error:
 
<pre>
 
OSError: Cannot initialize new instance of inotify, Errno=Too many open files (EMFILE)
 
</pre>
 
It is possible to overcome this error by giving this command:
 
<pre>
 
sudo sh -c "echo 8192 > /proc/sys/fs/inotify/max_user_instances"
 
</pre>
 
 
 
 
 
= Build DTB only with Yocto =
 
To build quickly only the dtb with Yocto:
 
<pre>bitbake linux-renesas -c devshell</pre>
 
Once in the shell:
 
<pre>make dtbs </pre>
 
To get out of the shell:
 
<pre>exit</pre>
 
 
 
= Using Header Files and Shared Libraries in Applications =
 
When you add a library to your Yocto build such as libgpio ( <code> IMAGE_INSTALL_append = " libgpiod"</code> ) and then build an SDK with it (<code>bitbake core-image-weston-sdk -c populate_sdk</code>), the appropriate share library file (.so) and header files (.h) will be added to the 'sysroot' directory in you toolchain.
 
 
 
For example:
 
<pre>
 
$ 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
 
</pre>
 
 
 
Then in your application, you can add <code> #include <gpiod.h> </code> 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.
 
 
 
<code>-I $SDKTARGETSYSROOT/usr/include</code>
 
 
 
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:
 
 
 
<code> aarch64-poky-linux-gcc <span style="color:#FF0000">-lgpiod</span> -march=armv8-a -mtune=cortex-a57.cortex-a53 --sysroot=$SDKTARGETSYSROOT <span style="color:#FF0000"> -I $SDKTARGETSYSROOT</span> -O2 -pipe -g -feliminate-unused-debug-types -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed hello1.c -o hello1 </code>
 
 
 
= 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).
 
<pre>git clone https://github.com/webdino/meta-browser</pre>
 
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":
 
<pre>
 
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 “
 
</pre>
 
Add the meta-layer to the bblayers.conf:
 
<pre>
 
BBLAYERS += " ${TOPDIR}/../meta-browser "
 
Optionally you can include the Gem Tanzanite demo:
 
BBLAYERS += " ${TOPDIR}/../meta-gecko-embedded/meta-demo "
 
</pre>
 
And in the local.conf:
 
<pre>
 
IMAGE_INSTALL_append = " gem-tanzanite "
 
</pre>
 
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:
 
<pre>gem-tanzanite</pre>
 
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.
 

Latest revision as of 13:24, 23 July 2021

this page can be deleted