Renesas
RZ/V AI

4.00

The best solution for
starting your AI applications.

Provided by Renesas Electronics Corporation




To keep you updated,
Watch our GitHub repository
Watch



This project is maintained by renesas-rz

Hosted on GitHub Pages — Theme by orderedlist

How to build RZ/V2L AI SDK Source Code



This page explains how to build Linux with RZ/V2L AI SDK Source Code.
Supported version: RZ/V2L AI SDK v2.10

Introduction

AI SDK is a quick and easy AI Application development environment.
It is specifically made for RZ/V2L Evaluation Board Kit with fixed Linux components.
(For more information, please refer to Getting Started and AI SDK.)

To modify Linux component, you need to build AI SDK from source code.
AI SDK Source Code can generate the same Linux environment as AI SDK.

AI Application and AI SDK software

This page explains how to build AI SDK Source Code.
After you have completed this page, you would be able to change the source code and customize Linux environment (i.e., memory map, additional OSS etc...).

Requirement
  1. Users have launched RZ/V2L Evaluation Board Kit according to Getting Started, which means they can run AI Application on the board.
  2. To build Yocto Linux, the below equipment should be prepared.
    Equipment Details
    Linux PC Approximately 110GB free space is necessary.
    OS Ubuntu 20.04 LTS
    64bit OS must be used.

Now you are ready to build your Linux development environment.
Let's get started!!


Step 1: Obtain RZ/V2L AI SDK Source Code

Download the RZ/V2L AI SDK Source Code from the link below.

Download Link

AI SDK Source Code (RTK0EF0160F*_linux-src.zip) contains following files:
File name Description
README.txt README file.
rzv2l_ai-sdk_yocto_recipe_v*.tar.gz Yocto recipe.
Yocto recipes are text files that contains necessary information to build Yocto Linux.
oss_pkg_rzv_v*.7z OSS package.
OSS package is a set of Open Source Software source code used when building the Yocto Linux.
AI SDK Source Code provides this file to reproduce the same Linux environment provided in RZ/V2L AI SDK.


Step 2: Extract RZ/V2L AI SDK Source Code


This step explains how to extract RZ/V2L AI SDK Source Code zip file.

  1. On your Linux PC, check you have already registered the environment variable WORK with the below command.
    printenv WORK

  2. Make the working directory on your Linux PC.
    mkdir -p ${WORK}/src_setup
  3. Move to the working directory.
    cd ${WORK}/src_setup
  4. Extract RZ/V2L AI SDK Sorce Code zip file.
    unzip <Path to the file>/RTK0EF0160F*_linux-src.zip -d ${WORK}/src_setup
  5. Check the working directory to confirm the package contents.
    ls -1 ${WORK}/src_setup
    • If the above command prints followings, the package is extracted correctly.
      README.txt
      oss_pkg_rzv_v2.10.7z 
      rzv2l_ai-sdk_yocto_recipe_v2.10.tar.gz


Step 3: Build RZ/V2L AI SDK Source Code

This step explains how to build Linux environment with RZ/V2L AI SDK Source Code

  1. To install necessary sofware, run the following commands on your Linux PC.
    sudo apt-get update
    sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
    build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \
    xz-utils debianutils iputils-ping libsdl1.2-dev xterm p7zip-full libyaml-dev \
    libssl-dev
  2. Run the following commands and set the user name and email address before starting the build procedure.
    It is needed to avoid errors when using git command to apply patches.
    git config --global user.email "you@example.com"
    git config --global user.name "Your Name"
  3. Register the working directory path to an environment variable.
    export YOCTO_WORK=${WORK}/src_setup/yocto
    mkdir -p ${YOCTO_WORK}
  4. Extract Yocto recipe package.
    cd ${YOCTO_WORK}
    tar zxvf ${WORK}/src_setup/rzv2l_ai-sdk_yocto_recipe_v*.tar.gz
  5. Check the working directory to confirm Yocto recipes content.
    ls -1 ${YOCTO_WORK}
    • If the above command prints followings, Yocto recipes are extracted correctly.
      extra
      meta-gplv2
      meta-openembedded
      meta-qt5
      meta-renesas
      meta-rz-features
      meta-virtualization
      patch
      poky
    Note 1 These Yocto recipes are provided for eSD Bootloader as default.
    When using eMMC Bootloader, run the command to apply a patch file in addition.
    About the difference of these two types, please refer to Step7: Deploy AI Application in RZ/V2L EVK Getting Started.
    cd ${YOCTO_WORK}/meta-renesas
    patch -R -p1 -i ./patch/0001-VLP-v3.0.4-based-smart-rzv2l-eSD-Boot-support.patch
    Note 2 Evaluation version of Graphics Library and Video Codec Library have restriction on their running time.
    If you would like to use unrestricted version of Graphics Library or Video Codec Library, please refer to Appendix: Build Graphics and Video Codec Library for Unrestricted Version.
  6. Initialize a build using the oe-init-build-env script in Poky and set environment variable TEMPLATECONF to the below path.
    cd ${YOCTO_WORK}
    TEMPLATECONF=$PWD/meta-renesas/meta-rzv2l/docs/template/conf/ source poky/oe-init-build-env build
  7. Run the following commands to add necessary layers for AI application to ${YOCTO_WORK}/build/conf/bblayers.conf (configration file for layers).
    bitbake-layers add-layer ../meta-rz-features/meta-rz-graphics
    bitbake-layers add-layer ../meta-rz-features/meta-rz-codecs
    bitbake-layers add-layer ../meta-rz-features/meta-rz-drpai
  8. Run the following commands to extract the OSS package.
    cp ${WORK}/src_setup/oss_pkg_rzv_*.7z ${YOCTO_WORK}
    7z x ${YOCTO_WORK}/oss_pkg_rzv_*.7z -o${YOCTO_WORK}/build
  9. Check the working directory to confirm the package contents.
    ls -1 ${YOCTO_WORK}/build
    • If the above command prints followings, the package is extracted correctly.
      conf
      downloads
  10. Apply a patch file:
    • To add Tesseract Open Source OCR Engine for AI applications.
    • Not to use network connection during the build. (Necessary OSS source codes are already provided in AI SDK Source Code.)
    patch -p1 -i ../patch/0002-no-network-tesseract.patch
  11. Run the following command to build the Linux kernel files.
    (It takes a few hours to finish building depending on the user’s host PC performance)
    MACHINE=smarc-rzv2l bitbake core-image-weston
    All necessary files listed below will be generated by the build command and they will be located in ${YOCTO_WORK}/build/tmp/deploy/images/smarc-rzv2l directory.
    File name Description
    Image-smarc-rzv2l.bin Linux kernel
    Image-r9a07g054l2-smarc.dtb Device tree file
    bl2_bp_esd-smarc-rzv2l_pmic.bin
    bl2-smarc-rzv2l_pmic.bin
    fip-smarc-rzv2l_pmic.bin
    *1 Bootloader generated when using eSD Bootloader
    bl2_bp-smarc-rzv2l_pmic.srec
    fip-smarc-rzv2l_pmic.srec
    Flash_Writer_SCIF_RZV2L_SMARC_PMIC_DDR4_2GB_1PCS.mot
    *1 Bootloader generated when using eMMC Bootloader
    core-image-weston-smarc-rzv2l.tar.bz2 Root filesystem
    Note Either one of bootloaders(*1) will be generated based on your bootloader choice.
  12. Run the following command to build cross compiler installer.
    MACHINE=smarc-rzv2l bitbake core-image-weston -c populate_sdk
    A necessary file listed below will be generated by the build command and the cross compiler installer will be located in build/tmp/deploy/sdk/poky-glibc-x86_64-core-image-weston-aarch64-smarc-rzv2l-toolchain-*.sh.
    File name Description
    poky-glibc-x86_64-core-image-weston-aarch64-smarc-rzv2l-toolchain-*.sh Cross compiler installer
    Note If some errors occurred during the build, please clean the directory and rebuild it after a period of time according to the below commands.
    cd ${YOCTO_WORK}/build
    MACHINE=smarc-rzv2l bitbake core-image-weston -c cleanall
    And run the build command again.
    • For Linux kernel files
      MACHINE=smarc-rzv2l bitbake core-image-weston
    • For cross compiler installer
      MACHINE=smarc-rzv2l bitbake core-image-weston -c populate_sdk
  13. Add setting HD(1280x720) to Weston in root filesystem.
    1. Run the following commands to extract root filesystem.
      sudo mkdir /nfs/tmp -p
      sudo tar xfj ./tmp/deploy/images/smarc-rzv2l/core-image-weston-smarc-rzv2l.tar.bz2 -C /nfs/tmp
    2. Edit /nfs/tmp/etc/xdg/weston/weston.ini file with a text editor.
      1. Before the editing, open it and check that followings are written in the file.
        [core]
        idle-time=0
        require-input=false
        repaint-window=17
      2. Add the following setting to the end of the file.
        [output]
        name=HDMI-A-1
        mode=1280x720
      3. After adding the above, the result will be as shown below.
        [core]
        idle-time=0
        require-input=false
        repaint-window=17
        [output]
        name=HDMI-A-1
        mode=1280x720
      4. Save and close the file.

    3. Run the following commands to recompress the root filesystem.
      cd /nfs/tmp
      sudo tar cvfj ${WORK}/src_setup/core-image-weston-smarc-rzv2l.tar.bz2 *


This is the end of how to build AI SDK Source Code.

You have prepared following files, which is same as the one provided in Step 3: Obtain RZ/V2L AI SDK in Getting Started, and you can run AI Applications according to Getting Started.

Path File name Description
${YOCTO_WORK}/build/tmp/deploy/images/smarc-rzv2l Image-smarc-rzv2l.bin Linux kernel
Image-r9a07g054l2-smarc.dtb Device tree file
bl2_bp_esd-smarc-rzv2l_pmic.bin
bl2-smarc-rzv2l_pmic.bin
fip-smarc-rzv2l_pmic.bin
*1 Bootloader generated when using eSD Bootloader
bl2_bp-smarc-rzv2l_pmic.srec
fip-smarc-rzv2l_pmic.srec
Flash_Writer_SCIF_RZV2L_SMARC_PMIC_DDR4_2GB_1PCS.mot
*1 Bootloader generated when using eMMC Bootloader
${WORK}/src_setup core-image-weston-smarc-rzv2l.tar.bz2 Root filesystem
${YOCTO_WORK}/build/tmp/deploy/sdk poky-glibc-x86_64-core-image-weston-aarch64-smarc-rzv2l-toolchain-*.sh Cross compiler installer
Note 1 Either one of bootloaders(*1) will be generated based on your bootloader choice.
Note 2 For more Yocto Project information, please refer the link below:
https://docs.yoctoproject.org/3.1.21/brief-yoctoprojectqs/brief-yoctoprojectqs.html
Note 3 When customizing Linux development environment, following link may help.
https://docs.yoctoproject.org/


If you have any questions about AI SDK Source Code,
please add new issues to AI SDK GitHub issues.

Go to GitHub issues



Appendix: Prepare Graphics and Video Codec Library for Unrestricted Version

This section explains how to prepare Graphics and Video Codec Library for unrestricted version, intead of evaluation version.

Note Following instruction assumes that you have completed Step 3-5 in How to build AI SDK Source Code.
  1. Download zip files from the link below.
    Note It may take much time to obtain Graphics or Video Codec Library for unrestricted version due to necessary examinations on your business purpose.

  2. After you downloaded the zip files, please move the zip files to "${WORK}/src_setup" on your Linux PC.

  3. Check that zip files are moved to appropriate location.
    cd ${WORK}/src_setup
    ls -1 
    • If the above command prints followings, the package is extracted correctly.
      README.txt
      RTK0EF0045Z14001ZJ-v*_rzv_*.zip
      RTK0EF0045Z16001ZJ-v*_rzv_*.zip
      oss_pkg_rzv_v2.10.7z
      rzv2l_ai-sdk_yocto_recipe_v2.10.tar.gz
      yocto
  4. Run the below command to delete evaluation version.
    • Graphics Library
      rm -rf ${YOCTO_WORK}/meta-rz-features/meta-rz-graphics
    • Video Codec Library
      rm -rf ${YOCTO_WORK}/meta-rz-features/meta-rz-codecs
  5. Run the below command to extract the unristricted version.
    • Graphics Library
      unzip RTK0EF0045Z14001ZJ*.zip
      tar zxvf RTK0EF0045Z14001ZJ*/meta-rz-features_graphics_*.tar.gz -C ${YOCTO_WORK}
    • Video Codec Library
      unzip RTK0EF0045Z16001ZJ*.zip
      tar zxvf RTK0EF0045Z16001ZJ*/meta-rz-features_codec_*.tar.gz -C ${YOCTO_WORK}

After this procedure, please proceed to Step 3-6 in How to build AI SDK Source Code to start building Linux kernel files.