User Tools

Site Tools


civilinfrastructureplatform:ciptesting:cipreferencehardware:hihope-rzg2m:hihope-rzg2mbuildinstructions

Renesas RZ/G2M hihope-rzg2m build instructions

This page describes how to build following images/tools for Renesas RZ/G2M hihope-rzg2m.

  • the latest CIP kernel
  • the full hihope-rzg2m BSP from Renesas (including loader, U-Boot, kernel based on CIP kernel and rootfs)
  • SDK (cross compiler, kernel sources, kernel headers and rootfs)
  • the RZ/G2 flash writer

How to build the latest CIP Kernel for hihope-rzg2m

The Renesas RZ/G2M HopeRun HiHope RZ/G2M (hihope-rzg2m) is supported in the CIP SLTS Kernel. The instructions below describe how to build the CIP SLTS Kernel for the hihope-rzg2m platform using the Renesas RZ/G2 toolchain.

Build Steps

1. Checkout CIP Kernel

$ cd [your working directory]
$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/cip/linux-cip.git kernel
$ cd kernel
$ git fetch origin  # Not needed if a fresh clone
$ git checkout origin/linux-4.19.y-cip

2. Configure compiler environment

If using the Renesas SDK:

$ source /opt/poky/2.4.3/environment-setup-aarch64-poky-linux
$ unset LDFLAGS

3. Configure Linux config for Renesas arm64 RZ/G2 platforms

$ cd ..
$ git clone https://gitlab.com/cip-project/cip-kernel/cip-kernel-config.git
$ cd kernel
$ cp ../cip-kernel-config/4.19.y-cip/arm64/renesas_defconfig arch/arm64/configs/renesas_defconfig
$ make renesas_defconfig

4. Build the Kernel and device tree

$ make
$ make dtbs

Build Output

Output file locations:

  • Kernel: arch/arm64/boot/Image
  • Device tree: arch/arm64/boot/dts/renesas/r8a774a1-hihope-rzg2m.dtb
  • Device tree: arch/arm64/boot/dts/renesas/r8a774a1-hihope-rzg2m-ex.dtb (when using expansion board)

How to build the full hihope-rzg2m BSP from Renesas

This section contains information on how to build a CIP based Yocto BSP for the Renesas RZ/G2M HopeRun HiHope RZ/G2M (hihope-rzg2m).

BSP type Supported features Proprietary Packages
core-image-bsp basic BSP support without window system Not required
core-image-westonBSP with weston and proprietary HW codecs support Required

Full instructions and the instructions for the other BSP types can be found in section 3 of he “RZ/G2 Yocto recipe Start-Up Guide” that can be downloaded from the Renesas RZ/G Marketplace:

Supported Linux Host Distributions

Ubuntu 16.04 LTS

Build Steps

1. Install the required host packages

$ sudo apt install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm cpio python python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping libssl-dev

2. Download the required files (poky, meta-openembedded, meta-linaro, meta-renesas) by git-clone

$ export WORK=<path-to-your-working-directory>
$ mkdir $WORK
$ cd $WORK
$ git clone git://git.yoctoproject.org/poky
$ git clone git://git.linaro.org/openembedded/meta-linaro.git
$ git clone git://git.openembedded.org/meta-openembedded
$ git clone https://github.com/renesas-rz/meta-rzg2.git
$ git clone http://git.yoctoproject.org/cgit.cgi/meta-gplv2

3. Checkout correct revisions

$ cd ${WORK}/poky
$ git checkout -b tmp 7e7ee662f5dea4d090293045f7498093322802cc
$ cd ${WORK}/meta-linaro
$ git checkout -b tmp 75dfb67bbb14a70cd47afda9726e2e1c76731885
$ cd ${WORK}/meta-openembedded
$ git checkout -b tmp 352531015014d1957d6444d114f4451e241c4d23
$ cd ${WORK}/meta-gplv2
$ git checkout -b tmp f875c60ecd6f30793b80a431a2423c4b98e51548
$ cd ${WORK}/meta-qt5
$ git checkout -b tmp c1b0c9f546289b1592d7a895640de103723a0305
$ cd ${WORK}/meta-rzg2
$ git checkout BSP-1.0.1-update1 # latest BSP version is better if exist: BSP-1.0.2, BSP-1.0.3, ...

4. (Only for core-image-weston/core-image-weston-sdk) Install proprietary software packages (graphics, multimedia)

Download packages from the RZ/G Marketplace:

$ mkdir ${WORK}/proprietary
$ cp RZG2_Group_Evaluation_Software_Package* $WORK/proprietary
$ cd ${WORK}/meta-rzg2
$ sh docs/sample/copyscript/copy_proprietary_softwares.sh $WORK/proprietary

5. Execute source command

$ cd ${WORK}
$ source poky/oe-init-build-env

6. Copy build configuration files

$ cp ${WORK}/meta-rzg2/docs/sample/conf/hihope-rzg2m/linaro-gcc/*.conf ${WORK}/build/conf/

7. Build with bitbake

$ cd $WORK/build
$ bitbake core-image-[bsp|weston]

NOTE: The build may take several hours to complete depending on the Linux Host PC performance and the network environment.

Build Output

Once the build is completed, the Kernel, device tree and RFS are located in $WORK/build/tmp/deploy/images/hihope-rzg2m.

# Filename Description Note
1 bootparam_sa0.srec Loader (Boot parameter) S-record format
2 bl2-hihope-rzg2m.srec Loader (Trusted firmware-A BL2) S-record format
3 cert_header_sa6.srec Loader (Certification) S-record format
4 bl31-hihope-rzg2m.srec Trusted fimrware-A BL31 S-record format
5 u-boot-elf-hihope-rzg2m.srec U-Boot symbolic link to the latest image, S-record format
6 Image Linux kernel image symbolic link to the latest image
7 r8a774a1-hihope-rzg2m.dtb Device tree blob for hihope-rzg2m without the expansion board symbolic link to the latest dtb
8 r8a774a1-hihope-rzg2m-ex.dtb Device tree blob for hihope-rzg2m with the expansion board symbolic link to the latest dtb

How to build/use the SDK

This section contains information on how to build and use the Renesas RZ/G SDK.

base image for SDK Supported features Proprietary Packages
core-image-minimal minimal SDK (cross compiler and the other build tools) Not required
core-image-weston SDK with weston and proprietary multimedia features supportRequired

Full instructions can be found in section 6 of he “RZ/G2 Yocto recipe Start-Up Guide” that can be downloaded from the Renesas RZ/G Marketplace:

Build Steps

1. Follow the BSP build instructions above, steps 1-6

It doesn't matter if step 7 has already been run or not.

2. Configure host PC architecture

It is possible to build the SDK to run on a host PC using a different environment to the PC building the SDK.

In $WORK/build/conf/local.conf:

# This variable specified the architecture to build SDK/ADT items for and means
# you can build the SDK packages for architectures other than the machine you are
# running the build on (i.e. building i686 packages on an x86_64 host.)
# Supported values are i686 and x86_64
#SDKMACHINE ?= "i686"
SDKMACHINE ?= "x86_64"

3. Build SDK with bitbake

$ cd {$WORK}/build
$ bitbake core-image-[minimal|weston-sdk] -c populate_sdk

Build Output

Once the build is completed, the toolchain will be located in the $WORK/build/tmp/deploy/sdk/ directory (poky-glibc-[x86_64|i686]-core-image-[weston-sdk|minimal]-aarch64-toolchain-2.4.3.sh).

Using the SDK

1. Install the toolchain on host PC

$ sudo poky-glibc-[x86_64|i686]-core-image-[weston-sdk|minimal]-aarch64-toolchain-2.4.3.sh
[sudo] password for (INSTALL person): [enter password of your account]
Enter target directory for SDK (default: /opt/poky/2.4.3): [enter new location or just key enter]
Extracting SDK...done
Setting it up...done
SDK has been successfully set up and is ready to be used.

2. Set up environment variables for build

$ cd [your working directory]
$ source /opt/poky/2.4.3/environment-setup-aarch64-poky-linux

# When you use “ld” directly but not via gcc (in case of building Kernel, Driver or u-boot), disable LDFLAGS:
$ unset LDFLAGS

# When you use 'make menuconfig' or other tools related to ncurses, set PKG_CONFIG_PATH and disable PKG_CONFIG_SYSROOT_DIR:
$ export PKG_CONFIG_PATH=$OECORE_NATIVE_SYSROOT/usr/lib/pkgconfig
$ unset PKG_CONFIG_SYSROOT_DIR

3. Build application

$ $CC [your source code].c [optional FLAGs etc.]

How to build the RZ/G2 flash writer

This chapter describes how to build the RZ/G2 flash writer. For further build options, please refer to README of the RZ/G2 Flash Writer:

Prepare the compiler

Get cross compiler from linaro or setup the Yocto SDK.

Linaro toolchain:

cd ~/
wget https://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-elf/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-elf.tar.xz
tar xvf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-elf.tar.xz

Yocto SDK:

source /opt/poky/2.4.3/environment-setup-aarch64-poky-linux

Prepare the source code

Get the source code of RZ/G2 flash writer.

cd ~/
git clone https://github.com/renesas-rz/rzg2_flash_writer.git
cd rzg2_flash_writer
git checkout -b v1.01 v1.01

Build the RZ/G2 flash writer

S-record file will be built by the following command.

Linaro toolchain:

make -f makefile.linaro clean
CROSS_COMPILE=~/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-elf/bin/aarch64-elf- make -f makefile.linaro BOARD=HIHOPE

Yocto SDK:

make clean
make BOARD=HIHOPE

Output image will be available in the following directory.

  • ./AArch64_output/AArch64_Flash_writer_SCIF_DUMMY_CERT_E6300400_hihope.mot
civilinfrastructureplatform/ciptesting/cipreferencehardware/hihope-rzg2m/hihope-rzg2mbuildinstructions.txt · Last modified: 2020/01/20 06:07 by kanechikay