====== Renesas RZ/G1M iwg20m build instructions ======
===== How to build the latest CIP Kernel for iwg20m =====
The Renesas RZ/G1M iWave Qseven development kit (iwg20m) is supported in the [[https://gitlab.com/cip-project/cip-kernel/linux-cip|CIP SLTS Kernel]]. The instructions below describe how to build the CIP SLTS Kernel for the iwg20m platform using the Renesas RZ/G toolchain.
==== Build Steps ====
1. Checkout CIP Kernel
$ cd [your working directory]
$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/bwh/linux-cip.git
$ cd linux-cip
$ git fetch origin # Not needed if a fresh clone
$ git checkout origin/linux-4.4.y-cip
2. Configure compiler environment
If using the [[civilinfrastructureplatform:ciptesting:cipreferencehardware:iwg20m:iwg20mbuildinstructions#how-to-builduse-the-sdk|Renesas SDK]]:
$ source /opt/poky/2.0.1/environment-setup-cortexa15hf-vfp-neon-poky-linux-gnueabi
$ unset LDFLAGS
3. Configure uImage load address
$ export LOADADDR="0x40008000"
4. Configure Linux config for iwg20m platform
$ make shmobile_defconfig
5. Build the Kernel and device tree
$ make uImage
$ make dtbs
==== Build Output ====
Output file locations:\\
- Kernel: arch/arm/boot/uImage\\
- Device tree: arch/arm/boot/dts/r8a7743-iwg20d-q7.dtb\\
- Device tree: arch/arm/boot/dts/r8a7743-iwg20d-q7-dbcm-ca.dtb (when using camera/HDMI add-on board)
===== How to build the full iwg20m BSP from Renesas =====
This section contains information on how to build a CIP based Yocto BSP for the Renesas RZ/G1M iWave Qseven development kit (iwg20m).
Full instructions can be found in the "Yocto Start-Up Guide" that can be downloaded from the Renesas RZ/G Marketplace:\\
https://mp.renesas.com/en-eu/rzg/marketplace/document/R01US0227EJ.html
==== Supported Linux Host Distributions ====
Ubuntu 14.04 LTS
==== Build Steps ====
1. Install the required host packages
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm
2. Download the required files (poky, meta-openembedded, meta-linaro, meta-renesas) by git-clone
$ export WORK=
$ mkdir $WORK
$ cd $WORK
$ git clone git://git.yoctoproject.org/poky
$ git clone git://git.openembedded.org/meta-openembedded
$ git clone git://git.linaro.org/openembedded/meta-linaro.git
$ git clone https://github.com/renesas-rz/meta-renesas
3. Checkout correct revisions
$ cd $WORK/poky
$ git checkout -b tmp 3b223f75eec1738fbc913858e8e11c8305e3edcb
$ cd $WORK/meta-openembedded
$ git checkout -b tmp dc5634968b270dde250690609f0015f881db81f2
$ cd $WORK/meta-linaro
$ git checkout -b tmp 12993e6bc8658ee37d303d8d59007f8dd9ab2b30
$ cd $WORK/meta-renesas
$ git checkout certified-linux-v2.0.6
4. Install proprietary software packages (graphics, multimedia)
Download packages (Kernel version CIP3) from the RZ/G Marketplace:\\
America: https://mp.renesas.com/en-us/rzg/marketplace/linux_package/rzg-vlp-eva.html\\
Europe: https://mp.renesas.com/en-eu/rzg/marketplace/linux_package/rzg-vlp-eva.html\\
Asia: https://mp.renesas.com/en-sg/rzg/marketplace/linux_package/rzg-vlp-eva.html\\
Japan: https://mp.renesas.com/ja-jp/rzg/marketplace/linux_package/rzg-vlp-eva.html
$ mkdir $WORK/proprietary
$ cp RZG_Series_Evaluation_Software_Package* $WORK/proprietary
$ cd $WORK/meta-renesas/meta-rzg1
$ sh copy_mm_software_lcb.sh $WORK/proprietary
$ sh copy_gfx_software_rzg1m.sh $WORK/proprietary
5. Execute source command
$ cd $WORK
$ source poky/oe-init-build-env
6. Copy build configuration files
$ cp $WORK/meta-renesas/meta-rzg1/templates/iwg20m/* $WORK/build/conf/
7. Build with bitbake
$ cd $WORK/build
$ bitbake core-image-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/iwg20m.
===== How to build/use the SDK =====
This section contains information on how to build and use the Renesas RZ/G SDK.
Full instructions can be found in section 5 of the "Yocto Start-Up Guide" that can be downloaded from the Renesas RZ/G Marketplace:\\
https://mp.renesas.com/en-eu/rzg/marketplace/document/R01US0227EJ.html
==== 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 ?= "x86_64"
SDKMACHINE ?= "i686"
3. Build SDK with bitbake
$ cd $WORK/build
$ bitbake core-image-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-sdkcortexa15hf-vfp-neon-toolchain-2.0.1.sh).
==== Using the SDK ====
1. Install the toolchain on host PC
$ sudo poky-glibc-[x86_64|i686]-core-image-weston-sdk-cortexa15hf-vfp-neon-toolchain-2.0.1.sh
[sudo] password for (INSTALL person): [enter password of your account]
Enter target directory for SDK (default: /opt/poky/2.0.1): [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.0.1/environment-setup-cortexa15hf-vfp-neon-poky-linux-gnueabi
# When you use “ld” directly but not via gcc (in case of building Kernel, Driver or u-boot), disable LDFLAGS:
$ unset LDFLAGS
3. Build application
$ $CC [your source code].c [optional FLAGs etc.]