R-Car/Boards/Yocto-Gen3/v4.1.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
 * Renesas R-Car-H3 Starter Kit Premier (unofficial name - H3ULCB), https://www.renesas.com/us/en/solutions/automotive/adas/solution-kits/r-car-starter-kit.html
 * Renesas R-Car-M3 Starter Kit Pro (unofficial name - M3ULCB), https://www.renesas.com/us/en/solutions/automotive/adas/solution-kits/r-car-starter-kit.html
 * Infotainment Carrier Board For R-Car Starter Kit(Kingfisher)

This version does not support Wayland/weston and Multimedia Packages.

Yocto versions
Poky-3.0.2 is supported with Yocto v4.1.0. Specific commit of meta-openembedded is required.

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 package from Renesas.


 * To download 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-20200910.zip
 * R-Car_Gen3_Series_Evaluation_Software_Package_of_Linux_Drivers-20200910.zip


 * 1) Install required packages
 * Ubuntu and Debian
 * Fedora
 * Refer to Yocto Project Quick Start for more information.
 * 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
 * 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) Start the build
 * 5) 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--.tar.bz2 is the rootfs, modules-.tgz are kernel modules.
 * 1) You can now proceed with running Yocto images
 * 1) Start the build
 * 2) 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--.tar.bz2 is the rootfs, modules-.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--.tar.bz2 is the rootfs, modules-.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:
 * Install SDK by run the following command and follow instructions on the screen:
 * Install SDK by run the following command and follow instructions on the screen:

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.

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 XXXX.dtb from $WORK/build/tmp/deploy/images// 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-*.tar.bz2 into mounted folder. And Copy Image and XXXX.dtb from $WORK/build/tmp/deploy/images// to sd card /boot.
 * 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-*.tar.bz2 into mounted folder. And Copy Image and XXXX.dtb from $WORK/build/tmp/deploy/images// to sd card /boot.
 * 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:

Q&A site
http://renesasrulz.com/r-car-h3-m3-cockpit/

FAQ page
https://elinux.org/R-Car/Boards/Yocto-Gen3-CommonFAQ

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
 * 1) [Known issue] Since kernel cannot boot when eMMC HS400 is enabled, SD/MMC driver supports up to HS200.