R-Car/Boards/Yocto-Gen3/v3.21.0

Introduction
This page contains information on building and running Yocto on: NOTE: USE OFFICIAL DOCUMENTATION provided with R-Car BSPs FOR H3SK/M3SK boards See also:
 * Renesas R-Car-H3 Starter Kit Premier (unofficial name - H3ULCB)
 * Renesas R-Car-M3 Starter Kit Pro (unofficial name - M3ULCB)
 * https://www.renesas.com/us/en/products/automotive-products/automotive-system-chips-socs/r-car-h3-m3-starter-kit
 * Latest version R-Car/Boards/Yocto-Gen3
 * Stable version R-Car/Boards/Yocto-Gen3-stable

Host PC
Ubuntu 16.04 LTS (64bit) is recommended as OS. 32bit version is not supported.

Required packages

 * 1) Download evaluation version of proprietary graphics and multimedia drivers from Renesas.
 * To download Multimedia and Graphics library and related Linux drivers, please use the following link:
 * https://www.renesas.com/us/en/application/automotive/r-car-h3-m3-h2-m2-e2-documents-software
 * Download two files:
 * R-Car_Gen3_Series_Evaluation_Software_Package_for_Linux-20190722.zip
 * R-Car_Gen3_Series_Evaluation_Software_Package_of_Linux_Drivers-20190722.zip
 * Graphic drivers are required for Wayland. Multimedia drivers are optional.
 * 1) Install required packages
 * Ubuntu and Debian
 * Fedora
 * Refer to Yocto Project Quick Start for more information.
 * Fedora
 * Refer to Yocto Project Quick Start for more information.
 * Refer to Yocto Project Quick Start for more information.

Building the BSP for Renesas H3 Starter Kit, M3 Starter Kit
NOTE: to have ADAS View and HAD Solution kits supported follow instructions: R-Car Yocto Gen3 ADAS

Build using script
This example is for H3ULCB board. If you use other board, you need to modify the script.
 * 1) Directory Structure
 * 2) Build script(build.sh)
 * 3) build
 * If the build completes successfully, all the necessary files are generated in a following directory:
 * 1) build
 * If the build completes successfully, all the necessary files are generated in a following directory:
 * If the build completes successfully, all the necessary files are generated in a following directory:

Build using manual steps

 * 1) Create a directory and switch to it
 * Warning! Yocto builds require a lot of disk space (up to 100 GB). Make sure you have got enough before starting the build.
 * 1) Clone basic Yocto layers:
 * 2) Switch to proper branches/commits (2021/08/03 updated)
 * Another versions are not tested for compatibility.
 * Legacy BSP instruction can be found here R-Car Yocto Gen3 legacy
 * 1) Download proprietary driver modules to $WORK/proprietary folder
 * You should see the following files:
 * 1) Populate meta-renesas with proprietary software packages.
 * 2) Setup build environment
 * 3) Prepare default configuration files.
 * 4) (Edit $WORK/build/conf/local.conf to enable/disable graphics and multimedia proprietary drivers support)
 * 5) Edit local.conf with evaluation packages requirements:
 * 6) Start the build
 * 7) Building image can take up to a few hours depending on your host system performance. After the build has been completed successfully, you should see the output similar to:
 * and the command prompt should return.
 * 1) Bitbake has generated all the necessary files in ./tmp/deploy/images directory. You can verify its content:
 * Image is a Kernel image, *.dtb is a blob file, core-image-weston-h3ulcb.tar.bz2 is the rootfs, modules-h3ulcb.tgz are kernel modules.
 * 1) You can now proceed with running Yocto images
 * 1) Edit local.conf with evaluation packages requirements:
 * 2) Start the build
 * 3) Building image can take up to a few hours depending on your host system performance. After the build has been completed successfully, you should see the output similar to:
 * and the command prompt should return.
 * 1) Bitbake has generated all the necessary files in ./tmp/deploy/images directory. You can verify its content:
 * Image is a Kernel image, *.dtb is a blob file, core-image-weston-h3ulcb.tar.bz2 is the rootfs, modules-h3ulcb.tgz are kernel modules.
 * 1) You can now proceed with running Yocto images
 * 1) Bitbake has generated all the necessary files in ./tmp/deploy/images directory. You can verify its content:
 * Image is a Kernel image, *.dtb is a blob file, core-image-weston-h3ulcb.tar.bz2 is the rootfs, modules-h3ulcb.tgz are kernel modules.
 * 1) You can now proceed with running Yocto images
 * 1) You can now proceed with running Yocto images

Build SDK

 * After building BSP you may build SDK:
 * After build finished the SDK installation script may be found in following path:
 * Install SDK by run the following command and follow instructions on the screen:
 * setup environment variables for each compilation on each Host PCs
 * Install SDK by run the following command and follow instructions on the screen:
 * setup environment variables for each compilation on each Host PCs
 * setup environment variables for each compilation on each Host PCs

Running Yocto images
Linux kernel can be booted from microSD card or from TFTP. Root FS can be mounted from micro SD card or via NFS.

Combination of board and dtb file
Please refer to here.

Loading kernel via TFTP and rootfs via NFS
Follow these steps to setup working TFTP and NFS server:
 * 1) Setup a TFTP server.
 * Ubuntu
 * Install tftpd-hpa package along with tftp tools:
 * Fedora
 * 1) Install necessary packages:
 * tftp-server is a part of xinetd. See Fedora manual for more information.
 * 1) Enable TFTP server:
 * Set
 * Save file and exit.
 * 1) Start xinetd:
 * 2) Copy Image and Image-r8a7795-h3ulcb.dtb (for ws2.0 silicon) and/or Image-r8a7795-h3ulcb-4x2g.dtb (for RTP0RC77951SKBX010SA03(DDR 8GiB)) and/or Image-r8a7795-es1-h3ulcb.dtb (for ws1.1) from $WORK/build/tmp/deploy/images/h3ulcb/ to TFTP server root.
 * Ubuntu
 *  Fedora
 * Which version is my H3SK board?
 * 1) Verify that TFTP server is working.
 * 2) Setup NFS server.
 * Debian/Ubuntu
 * 1) Install necessary packages:
 * 2) Start NFS server:
 * Fedora
 * 1) Install necessary packages:
 * 2) Enable and start nfs server:
 * 3) Export root FS to NFS. (Change IMAGE and MACHINE to fit your build).
 * 4) Unpack rootfs to a dedicated directory:
 * 5) Edit /etc/exports:
 * add
 * Save the file and exit.
 * 1) Force NFS server to re-read /etc/exports
 * 2) Verify that NFS is working.
 * 3) Boot into U-Boot command prompt
 * 4) Connect to serial console over microUSB using minicom or picocom.
 * 5) Switch the board on or reset it. Press any key to stop U-Boot automatic countdown.
 * Refer to H3SK board page, M3SK board page for more information.
 * 1) Configure Ethernet, TFTP, and kernel command line in U-Boot:
 * 1) Unpack rootfs to a dedicated directory:
 * 2) Edit /etc/exports:
 * add
 * Save the file and exit.
 * 1) Force NFS server to re-read /etc/exports
 * 2) Verify that NFS is working.
 * 3) Boot into U-Boot command prompt
 * 4) Connect to serial console over microUSB using minicom or picocom.
 * 5) Switch the board on or reset it. Press any key to stop U-Boot automatic countdown.
 * Refer to H3SK board page, M3SK board page for more information.
 * 1) Configure Ethernet, TFTP, and kernel command line in U-Boot:
 * 1) Boot into U-Boot command prompt
 * 2) Connect to serial console over microUSB using minicom or picocom.
 * 3) Switch the board on or reset it. Press any key to stop U-Boot automatic countdown.
 * Refer to H3SK board page, M3SK board page for more information.
 * 1) Configure Ethernet, TFTP, and kernel command line in U-Boot:


 * Replace  with the proper IP address for the board. Replace  with the IP address of your computer, where tftp and nfs servers are installed. Replace  with the exported path of the root FS. For example:
 * You can also use
 * command to obtain information from DHCP server.
 * Note: You can always see the environment with printenv command. Refer to U-Boot manual for details.
 * 1) Verify the connection over Ethernet from U-Boot:
 * You should see:
 * 1) Reset the board by pushing reset button
 * Refer to H3SK board page, M3SK board page for more information.
 * 1) The board should boot the kernel:
 * You should see:
 * 1) Reset the board by pushing reset button
 * Refer to H3SK board page, M3SK board page for more information.
 * 1) The board should boot the kernel:
 * 1) The board should boot the kernel:

Loading kernel and rootfs via eMMC/SD card
This section describes steps that are necessary for preparing and booting from SD card.

Preparing eMMC/SD card
In order to prepare you SD card, follow these instructions on host machine:
 * 1) Partion your SD card to set 1 partition and ID=83 (Linux)
 * Make sure the SD card doesn't contain any important files.
 * WARNING! These steps may erase the SD card completely. All files my be lost.
 * 1) Format this partition to ext3 (or ext4)
 * 2) Mount this partition on your host to any directory and upack the core-image-weston-*.tar.bz2 into mounted folder. And Copy Image and Image-r8a7795-h3ulcb.dtb (for ws2.0 silicon) and/or Image-r8a7795-h3ulcb-4x2g.dtb (for RTP0RC77951SKBX010SA03(DDR 8GiB)) and/or Image-r8a7795-es1-h3ulcb.dtb (for ws1.1) from $WORK/build/tmp/deploy/images/h3ulcb/ to sd card /boot.  In case of m3ulcb copy dtb from $WORK/build/tmp/deploy/images/m3ulcb/.
 * NOTE: probably you need to be a root user, hence use "sudo"
 * 1) Mount this partition on your host to any directory and upack the core-image-weston-*.tar.bz2 into mounted folder. And Copy Image and Image-r8a7795-h3ulcb.dtb (for ws2.0 silicon) and/or Image-r8a7795-h3ulcb-4x2g.dtb (for RTP0RC77951SKBX010SA03(DDR 8GiB)) and/or Image-r8a7795-es1-h3ulcb.dtb (for ws1.1) from $WORK/build/tmp/deploy/images/h3ulcb/ to sd card /boot.  In case of m3ulcb copy dtb from $WORK/build/tmp/deploy/images/m3ulcb/.
 * NOTE: probably you need to be a root user, hence use "sudo"
 * NOTE: probably you need to be a root user, hence use "sudo"

Configure U-Boot to boot from SD card

 * Proper U-Boot command to boot from SD:
 * Note from user:
 * When I created my image with mkfs.ext3, and booted with rootfstype=ext3, the kernel could not find mount the filesystem.
 * The kernel boot gave an error message:
 * "EXT4-fs (mmcblk1p1): couldn't mount as ext3 due to feature incompatibilities".
 * I switched to 'rootfstype=ext4' in my bootargs, and the kernel booted OK.
 * Example of U-Boot environment variables:
 * To verify the SD card, type the following in U-Boot prompt:
 * To verify the SD card, type the following in U-Boot prompt:
 * To verify the SD card, type the following in U-Boot prompt:

Audio
Ex) playback Ex) record

Video
Ex) Playback

How do I increase USB bandwidth

 * 1) Download:
 * M3SK [[File:M3v10_usb20_iso_mode.zip]]
 * H3SK WS1.1 (RTP0RC7795SKBX0010SA00) [[File:H3v11_usb20_iso_mode.zip]]
 * H3SK WS2.0 (RTP0RC77951SKBX010SA00) [[File:H3v20_usb20_iso_mode.zip]]
 * 1) Setting

How do access to USB memory from U-boot(Yocto v3.13.0 or later)

 * 1) Some USB memory may not be recognized.
 * 2) [How to fix] Set the "usb_pgood_delay 2000" variable
 * 1) [How to fix] Set the "usb_pgood_delay 2000" variable

Known issues and limitations

 * 1) [SW limitation] Yocto v3.4.0 or later doesn't support RTP0RC7795SKBX0010SA00(H3 v1.1 Starter Kit).
 * Please use the H3 v2.0 or v3.0 SK
 * 1) [Known issue] If you encounter a kernel hang-up while using Yocto v3.4.0 or later, please refer to the following pages.
 * H3 SK: No.1 of R-Car/Boards/H3SK
 * M3 SK: No.2 of R-Car/Boards/M3SK