Difference between revisions of "R-Car/Boards/Kingfisher/Android/Android 10"

From eLinux.org
Jump to: navigation, search
(Created page with "{{Template:R-Car-Gen3-Navbox}} {{TOC right}} Category:R-Car Category:R-Car Gen3 == Introduction == This page contains information on building and running Android on:...")
 
m (Flashing images using fastboot)
Line 365: Line 365:
  
 
# 11. Reboot device into bootloader:
 
# 11. Reboot device into bootloader:
$ sudo ./fastboot reboot-bootloader
+
$ sudo ./fastboot reboot bootloader
  
 
# 12. Go to images directory and execute:
 
# 12. Go to images directory and execute:

Revision as of 17:29, 20 October 2021


Introduction

This page contains information on building and running Android on:

This BSP doesn't support H3 v1.1 SK(RTP0RC7795SKBX0010SA00) and M3 SK.
If you want to use M3 v3 SK(RTP8J77961ASKB0SK0SA05A), please use Android P BSP .

See also:

Topic

The new version of R-Car Starter Kit Premier is now on sale !!

  • Equipped with R-Car H3e-2G
    (En) https://www.renesas.com/jp/en/about/press-room/renesas-launches-r-car-gen3e-20-percent-higher-cpu-speed-automotive-infotainment-cockpit-and-digital
    (Zh) https://www.renesas.com/jp/zh/about/press-room/renesas-launches-r-car-gen3e-20-percent-higher-cpu-speed-automotive-infotainment-cockpit-and-digital
    (Jp) https://www.renesas.com/jp/ja/about/press-room/renesas-launches-r-car-gen3e-20-percent-higher-cpu-speed-automotive-infotainment-cockpit-and-digital
  • CPU performance is increased 20% by supporting up to 2GHz frequency over past products.
  • You can buy from here.

SW Release Information

Board name SW name Release date Note
R-Car Starter Kit ( Premier / Pro ) Yocto v5.5.0 (latest) [New!!] 2021/10/01
Yocto v3.21.0 (stable) 2019/07/09 R-Car Starter Kit Pro(RTP8J77961ASKB0SK0SA05A) is supported from 2020/07/10.
meta-renesas was updated on 2021/08/03.
Kingfisher Infotainment Board Yocto v5.5.0 (latest) [New!!] 2021/10/01 To check for latest information, please refer to the meta-rcar/tree/v5.5.0.
Yocto v3.21.0 (stable) 2019/08/07 To check for latest information, please refer to the meta-rcar/tree/v3.21.0.
R-Car Starter Kit Pro(RTP8J77961ASKB0SK0SA05A) is supported from 2020/08/02.
meta-renesas was updated on 2021/08/03.
Android 10 (stable) [New!!] 2021/07/26 R-Car Starter Kit Premier(R-Car H3) + Kingfisher is supported.
R-Car Starter Kit Pro(RTP8J77961ASKB0SK0SA05A) + Kingfisher is also supported from 2021/11/25.
Android P (stable) 2020/09/29 R-Car Starter Kit Premier(R-Car H3) + Kingfisher is supported.
R-Car Starter Kit Pro(RTP8J77961ASKB0SK0SA05A) + Kingfisher is also supported from 2021/03/16.
CCPF-SK Board Yocto v5.1.0 (latest) [New!!] 2021/10/01 Prebuilt binary is availeble in Quick startup guide page.


Host PC

Ubuntu 18.04 LTS (64bit) is recommended as an OS for building Android.
Building Android BSP requires a lot of RAM at least 16GB.
32bit version is not supported.

Required packages

# Install basic dependencies
$ sudo apt-get update
$ sudo apt-get install openjdk-8-jdk git-core gnupg flex bison \
gperf build-essential zip curl zlib1g-dev gcc-multilib ccache \
g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev \
libx11-dev lib32z-dev libgl1-mesa-dev libxml2-utils liblz4-tool \
xsltproc unzip python-networkx python-wand python-crypto liblz4-tool bc wget

Detailed environment configuration description can be found in Google Android setup guide:
https://source.android.com/source/initializing.html#setting-up-a-linux-build-environment

Building the Android BSP for Kingfisher board

Using build script

  1. Directory Structure
    .
    |--build_h3.sh
    `--Gen3_Android_v10_2.0.zip
    
    # Download "Gen3_Android_v10_2.0.zip" from below URL
  2. Build script(build_h3.sh)
    #!/bin/bash
    
    SCRIPT_DIR=$(cd `dirname $0` && pwd)
    DRAM_SIZE_LIST=("4GB" "8GB")
    
    TARGET_BOARD=h3ulcb
    DRAM_SIZE=$1
    
    WORKDIRECTORY=$TARGET_BOARD
    IMAGE_DIR_NAME="images_${TARGET_BOARD}"
    
    Usage () {
        echo "Usage: $0 ${DRAM_SIZE}"
        echo "DRAM_SIZE list"
        for i in ${DRAM_SIZE_LIST[@]}; do echo "  - $i"; done
        exit
    }
    
    # Check Param.
    if ! `IFS=$'\n'; echo "${DRAM_SIZE_LIST[*]}" | grep -qx "${DRAM_SIZE}"`; then
            Usage
    fi
    
    WORKDIRECTORY+="_${DRAM_SIZE}"
    IMAGE_DIR_NAME+="_${DRAM_SIZE}"
    
    mkdir -p ${SCRIPT_DIR}/${WORKDIRECTORY}
    cd ${SCRIPT_DIR}/${WORKDIRECTORY}
    export workdirectory=$(pwd)
    curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ./repo
    chmod +x ./repo
    export PATH=$(pwd):${PATH}
    
    cp ${SCRIPT_DIR}/Gen3_Android_v10_2.0.zip -t ${workdirectory}
    cd ${workdirectory}
    unzip -qo Gen3_Android_v10_2.0.zip
    unzip -qo OSS_Package/Gen3_Android_v10_2.0.zip -d OSS_Package
    unzip -qo Software/SV00_Android_10_2.0.zip -d Software
    unzip -qo OSS_Package/Gen3_Android_v10_2.0/RENESAS_RCH3_Android_10_2020_09E.zip
    
    cd ${workdirectory}/RENESAS_RCH3_Android_10_2020_09E
    export workspace=$(pwd)
    cp -r ${workdirectory}/Software/proprietary/pkgs_dir .
    
    cd ${workspace}
    chmod +x walkthrough.sh
    ./walkthrough.sh H3
    
    # Apply patch to support H3 v3 SK equipped with Single-ranked DDR
    cd ${workdirectory}
    curl -sO https://elinux.org/images/e/ec/H3SK-SingleRankedDDR_for_Android_10_BSP_v1.zip
    unzip -qo H3SK-SingleRankedDDR_for_Android_10_BSP_v1.zip
    cd ${workspace}/mydroid/device/renesas/bootloaders/ipl
    patch -N -p1 < ${workdirectory}/H3SK-SingleRankedDDR_for_Android_10_BSP_v1.diff
    
    cd ${workspace}/mydroid
    export TARGET_BOARD_PLATFORM=r8a7795
    export H3_OPTION=${DRAM_SIZE}
    
    source build/envsetup.sh
    lunch kingfisher-userdebug
    export BUILD_BOOTLOADERS=true
    export BUILD_BOOTLOADERS_SREC=true
    make
    
    export images_dir=$workdirectory/$IMAGE_DIR_NAME
    mkdir ${images_dir}
    cp \
        out/target/product/kingfisher/boot.img \
        out/target/product/kingfisher/dtb.img \
        out/target/product/kingfisher/dtbo.img \
        out/target/product/kingfisher/vbmeta.img \
        out/target/product/kingfisher/system.img \
        out/target/product/kingfisher/vendor.img \
        out/target/product/kingfisher/product.img \
        out/target/product/kingfisher/bootloader.img \
        out/target/product/kingfisher/odm.img \
        out/target/product/kingfisher/ramdisk.img \
        out/target/product/kingfisher/ramdisk-debug.img \
        out/target/product/kingfisher/boot-debug.img \
        out/target/product/kingfisher/super.img \
        out/target/product/kingfisher/super_empty.img \
        out/target/product/kingfisher/bl2.srec \
        out/target/product/kingfisher/bl31.srec \
        out/target/product/kingfisher/bootparam_sa0.srec \
        out/target/product/kingfisher/cert_header_sa6.srec \
        out/target/product/kingfisher/tee.srec \
        out/target/product/kingfisher/u-boot-elf.srec \
        out/target/product/kingfisher/bl2.bin \
        vendor/renesas/utils/fastboot/fastboot.sh \
        vendor/renesas/utils/fastboot/fastboot_functions.sh \
        out/host/linux-x86/bin/adb \
        out/host/linux-x86/bin/mke2fs \
        out/host/linux-x86/bin/fastboot ${images_dir}
    
  3. Build
    # H3 Starter Kit with 4GB DDR
    ./build_h3.sh 4GB
    # H3 Starter Kit with 8GB DDR
    ./build_h3.sh 8GB
    
    If the build completes successfully, all the necessary files are generated in a following directory:
    Ex.) H3SK with 4GB case
    ./h3ulcb_4GB/images_h3ulcb_4GB
    

Manual steps

Downloading repo tool

$ mkdir <your work directory>
$ cd <your work directory>
$ export workdirectory=$(pwd)
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ./repo
$ chmod +x ./repo
$ export PATH=$(pwd):${PATH}

Unpack Android Package

Unpack the Renesas Android package to workspace.
# DL from below URL to your ${workdirectory}

Download file:
  • Gen3_Android_v10_2.0.zip
$ cd ${workdirectory}
$ unzip Gen3_Android_v10_2.0.zip
$ unzip OSS_Package/Gen3_Android_v10_2.0.zip -d OSS_Package
$ unzip Software/SV00_Android_10_2.0.zip -d Software
$ unzip OSS_Package/Gen3_Android_v10_2.0/RENESAS_RCH3_Android_10_2020_09E.zip

Preparing OpenMAX (OMX), Graphics(GFX) library package

Copy Proprietary Software Packages (OMX and GFX) to pkgs_dir:

$ cd ${workdirectory}/RENESAS_RCH3_Android_10_2020_09E
$ export workspace=$(pwd)
$ cp -r ${workdirectory}/Software/proprietary/pkgs_dir . 
pkgs_dir/ 
 |--gfx 
 |  |--INFRTM8RC7795ZGG00Q00JPAQE_1_0_3.zip 
 |  |--RCH3G001A1001ZDO_1_0_3.zip 
 |--omx 
 |  |--RTM8RC0000ZMD0LQ00JPAQE_3_0_23.zip 
 |  |--RTM8RC0000ZMD1LQ00JPAQE_3_0_23.zip 
 |  |--RTM8RC0000ZMD2LQ00JPAQE_3_0_23.zip 
 |  |--RTM8RC0000ZMD4LQ00JPAQE_3_0_23.zip 
 |  |--RTM8RC0000ZMD8LQ00JPAQE_3_0_23.zip 
 |  |--RTM8RC0000ZMD9LQ00JPAQE_3_0_23.zip 
 |  |--RTM8RC0000ZMDALQ00JPAQE_3_0_23.zip 
 |  |--RTM8RC0000ZME0LQ00JPAQE_3_0_23.zip 
 |  |--RTM8RC0000ZME1LQ00JPAQE_3_0_23.zip
 |  |--RTM8RC0000ZME8LQ00JPAQE_3_0_23.zip 
 |  |--RTM8RC0000ZMX0DQ00JFAQE_3_0_23.zip 
 |  |--RTM8RC0000ZMX0LQ00JPAQE_3_0_23.zip

Unpacking Android sources

$ cd ${workspace}
$ chmod +x walkthrough.sh

#For R-Car H3
$ ./walkthrough.sh H3

Apply patch to support H3 v3 SK equipped with Single-ranked DDR

If you don't user H3 v3 SK with Single-ranked DDR, this step can be skipped. Patch file: File:H3SK-SingleRankedDDR for Android 10 BSP v1.zip

cd ${workdirectory}
curl -sO https://elinux.org/images/e/ec/H3SK-SingleRankedDDR_for_Android_10_BSP_v1.zip
unzip -qo H3SK-SingleRankedDDR_for_Android_10_BSP_v1.zip
cd ${workspace}/mydroid/device/renesas/bootloaders/ipl
patch -N -p1 < ${workdirectory}/H3SK-SingleRankedDDR_for_Android_10_BSP_v1.diff

Building the BSP

Please check additional build options and apply any if needed prior to starting the build process.

  1. Set Android build environment
    • For R-Car H3 case:
      $ export TARGET_BOARD_PLATFORM=r8a7795 
      # Please set H3_OPTION variables. 
      # 4GB DDR case
      $ export H3_OPTION=4GB
      # 8GB DDR case
      $ export H3_OPTION=8GB
      
  2. Build
    $ cd ${workspace}/mydroid
    $ source build/envsetup.sh
    $ lunch kingfisher-userdebug
    $ export BUILD_BOOTLOADERS=true
    $ export BUILD_BOOTLOADERS_SREC=true
    $ make
    

Copying images file

$ export images_dir=<your_images_dir>
$ mkdir ${images_dir}
$ cp \
out/target/product/kingfisher/boot.img \
out/target/product/kingfisher/dtb.img \
out/target/product/kingfisher/dtbo.img \
out/target/product/kingfisher/vbmeta.img \
out/target/product/kingfisher/system.img \
out/target/product/kingfisher/vendor.img \
out/target/product/kingfisher/product.img \
out/target/product/kingfisher/bootloader.img \
out/target/product/kingfisher/odm.img \
out/target/product/kingfisher/ramdisk.img \
out/target/product/kingfisher/ramdisk-debug.img \
out/target/product/kingfisher/boot-debug.img \
out/target/product/kingfisher/super.img \
out/target/product/kingfisher/super_empty.img \
out/target/product/kingfisher/bl2.srec \
out/target/product/kingfisher/bl31.srec \
out/target/product/kingfisher/bootparam_sa0.srec \
out/target/product/kingfisher/cert_header_sa6.srec \
out/target/product/kingfisher/tee.srec \
out/target/product/kingfisher/u-boot-elf.srec \
out/target/product/kingfisher/bl2.bin \
vendor/renesas/utils/fastboot/fastboot.sh ¥
vendor/renesas/utils/fastboot/fastboot_functions.sh ¥
out/host/linux-x86/bin/adb ¥
out/host/linux-x86/bin/mke2fs ¥
out/host/linux-x86/bin/fastboot ${images_dir}

Flashing binaries

Flashing IPL

Flashing SREC bootloader files

If you have already installed Android BSP to the board, please erase bootloader on eMMC by executing following commands in U-Boot before flashing IPLs.

=> mmc dev 1 1 
=> mw.b 4f000000 0 200000 
=> mmc write 4f000000 0 1000 
=> mmc dev 1 2 
=> mw.b 4f000000 0 200000 
=> mmc write 4f000000 0 1000

It's needed to update the Loader, ARM Trusted firmware, Certification, OP-Tee and u-boot in the QSPI Flash memory as it's described in following pages:

Note: If U-boot does not boot after flashing IPLs, please power on the Starter Kit while pushing SW4.


Flashing images using fastboot

Note: this step should be done after successful IPL and U-Boot flashing.

# 0. Connect host and board via USB debug port(CN12) on Starter Kit and start minicom:
$ sudo minicom -D /dev/ttyUSB0

# 1. Turn on the device and interrupt autoboot by pressing any key when device starts booting up.

# 2. Erase bootloader in eMMC 
=> mmc dev 1 1 
=> mw.b 4f000000 0 200000 
=> mmc write 4f000000 0 1000 
=> mmc dev 1 2 
=> mw.b 4f000000 0 200000 
=> mmc write 4f000000 0 1000 
=> reset 
# Please interrupt autoboot 

# 3. Reset default environment:
=> env default -a

# 4. Set ethernet hardware address (written on Ethernet port):
=> setenv ethaddr <board MAC addr>

# 5. Set board serial number of R-Car Starter Kit
=> editenv serialno 
Edit: serialno=xxxxxxxx 
# Padding 0 for a total of 8 digits
=> editenv bootargs 
=> video=VGA-1:d init_time=xxxxxxxxxx 
#”video” variable needs to set parameter related to display configuration.
#”init_time” variable needs to set UNIX time. 
#You can get it by executing “date +%s” command on host PC. 
#The board don't have any RTC. 
#If time and date is not accurate, a few issues will be happened. 

# 6. Save changes:
=> saveenv

# 7. And reboot the device:
=> reset

# 8. After reboot activate fastboot mode by running “fastboot” in u-boot environment:
=> fastboot
# Next commands are performed on host side:
$ cd ${images_dir}
$ chmod a+x ./fastboot 
$ chmod a+x ./fastboot.sh 

# 9. Connect host and board via USB port(CN13) on Kingfisher.

# 10. Create GPT table on eMMC:
$ sudo ./fastboot oem format

# 11. Reboot device into bootloader:
$ sudo ./fastboot reboot bootloader

# 12. Go to images directory and execute:
$ sudo ./fastboot.sh --noresetenv

Booting device

1) Connect Monitor to microHDMI(CN4) port in Starter Kit board(Mandatory).
2) Connect Starter Kit board to host PC via debug port(CN12).
3) Connect usb cable to Kingfisher OTG(CN13) for adb debug.
4) (Optional) Connect Ethernet cable(CN7).
5) Power on device.
6) Wait until Android boot is completed.

Tips

Screen configuration

Resolution parameters

By default HWComposer selects resolutions not higher than Full HD with display aspect ratio.

#  Turn on the device and interrupt autoboot using minicom.
# Edit environment variable:
=> editenv bootargs
# Set video resolution:
# for display connected to Starter Kit:
  androidboot.display.res.HDMI2=1280x720-32@60
# for display connected to Kingfisher
  androidboot.display.res.HDMI1=1280x720-32@60
# for LVDS display on Kingfisher
  androidboot.display.res.LVDS=1280x720-32@60
# Save changes:
=> saveenv

Measuring FPS on HWC level

To enable fps show:

$ ./adb shell setprop debug.hwc.showfps 1

Fps values can be found in logcat log like:

...
hwcomposer: fps: 22.0 (23 frame per 1.043099 sec)
...

To disable fps show:

$ ./adb shell setprop debug.hwc.showfps 0

Microphone level amplification

By default, audio volume may be low when recording from the microphone. This can be affected by using a microphone preamplifier integrated into Kingfisher board extension.
Microphone preamplifier is equipped with three switches (SW3, SW4 and SW5 on Kingfisher board). Every switch contains two toggles, responsible for the left and right audio channels. Turning on the toggle will provide the microphone amplification by 20dB.

Known issues

  1. Suspend to RAM is not supported.
  2. UI is displayed with distortions on some displays if an interlaced resolution is set.

See also:

Q&A site

http://renesasrulz.com/r-car-h3-m3-cockpit/

FAQ page

https://en-support.renesas.com/knowledgeBase/category/31363