Ariaboard Renesas G2L Software Guide: Difference between revisions

From Ariaboard Wiki
Jump to navigation Jump to search
(Created page with "==Hardware Spec== {| class="wikitable" | CPU || Dual Cortex®[email protected] |- | GPU || Mali G31 |- | RAM || 1024M DDR4 |- | USB || 1xUSB 2.0 OTG, 1xUSB 2.0 |- | Video Output ||...")
 
Line 25: Line 25:
===Fetch RZ/G2L Linux SDK===
===Fetch RZ/G2L Linux SDK===
<pre>
<pre>
git clone https://git.g77k.com/supercatexpert/rzg2-linux-sdk.git -b rzg2l
git clone ####.git -b rzg2l
cd rzg2-linux-sdk
cd rzg2-linux-sdk
git submodule update --init
git submodule update --init

Revision as of 02:46, 10 November 2021

Hardware Spec

CPU Dual Cortex®[email protected]
GPU Mali G31
RAM 1024M DDR4
USB 1xUSB 2.0 OTG, 1xUSB 2.0
Video Output 1xHDMI(From RGB), 2xLVDS
Ethernet RGMII 1Gbps x2
External port N/A
Storage eMMC 4G, SD Card slot

Image Installation

Ubuntu 20.04 pre-install apts

apt install git build-essential flex bison

Fetch RZ/G2L Linux SDK

git clone ####.git -b rzg2l
cd rzg2-linux-sdk
git submodule update --init

Build RZG2L Flash Burner

cd rzg2-flash-writer
./build-g2l-emmc.sh
cd ..

Build U-Boot

cd renesas-u-boot-cip
./build-g2l.sh
cd ..

Build ARM Trusted Firmware

ARM Trusted Firmware should be built after the u-boot one.

cd arm-trusted-firmware
./build.sh

Boot Flash Burner from serial port

Set serial port of PC to 115200bps, 8N1. Set boot mode of board to download mode. Connect Debug port of board to the serial port of PC. Power on the board, then something like "please send !" will be printed on terminal.

Upload file rzg2-flash-writer/AArch64_output/Flash_Writer_SCIF_RZG2L_SMARC_DDR4_2GB.mot with ASCII mode. After uploading, prompt ">" will appear in terminal.

Install ARM Trusted Firmware & U-Boot

Filename Program Top Address eMMC Save Partition eMMC Save Sectors Description
arm-trusted-firmware/deploy/g2l/bl2_bp.srec 00011E00 boot partition1 000001 Loader (BL2)
arm-trusted-firmware/deploy/g2l/fip.srec 00000000 boot partition1 000100 Loader (BL31 + U-Boot)

Use EM_W command to write S-record file into eMMC. e.g:

>EM_W
EM_W Start --------------
---------------------------------------------------------
Please select,eMMC Partition Area.
 0:User Partition Area   : 30535680 KBytes
  eMMC Sector Cnt : H'0 - H'03A3DFFF
 1:Boot Partition 1      : 16384 KBytes
  eMMC Sector Cnt : H'0 - H'00007FFF
 2:Boot Partition 2      : 16384 KBytes
  eMMC Sector Cnt : H'0 - H'00007FFF
---------------------------------------------------------
  Select area(0-2)>1                                         <<<< Enter "1" here
-- Boot Partition 1 Program -----------------------------
Please Input Start Address in sector :1                   <<<< Enter "1" here
Please Input Program Start Address : 00011E00                <<<< Enter "00011E00" here
Work RAM(H'50000000-H'50FFFFFF) Clear....
please send ! ('.' & CR stop load)
SAVE -FLASH.......
EM_W Complete!

eMMC Boot Settings

Please note that for eMMC booting, the following EXT_CSD registers need to be modified:

EXT_CSD[B1] = 0x02
EXT_CSD[B3] = 0x08

Use EM_SECSD command to modify EXT CSD registers:

>EM_SECSD
  Please Input EXT_CSD Index(H'00 - H'1FF) :b1
  EXT_CSD[B1] = 0x00
  Please Input Value(H'00 - H'FF) :2
  EXT_CSD[B1] = 0x02

>EM_SECSD
  Please Input EXT_CSD Index(H'00 - H'1FF) :b3
  EXT_CSD[B1] = 0x00
  Please Input Value(H'00 - H'FF) :8
  EXT_CSD[B1] = 0x08

Check Bootloader

Power off the board. Set boot mode to eMMC boot. Then power on. It should be able to boot into u-boot:

NOTICE:  BL2: v2.5(release):v2.5/rzg2l-1.00-15-g9eb221438
NOTICE:  BL2: Built : 17:28:47, Nov  2 2021
NOTICE:  BL2: eMMC boot from partition 1
NOTICE:  BL2: Load dst=0x1c7c0 src=(p:1)0x20000(256) len=0x10(1)
NOTICE:  BL2: eMMC boot from partition 1
NOTICE:  BL2: Load dst=0x1c960 src=(p:1)0x20010(256) len=0x28(1)
NOTICE:  BL2: eMMC boot from partition 1
NOTICE:  BL2: Load dst=0x44000000 src=(p:1)0x20090(256) len=0x6069(49)
NOTICE:  BL2: eMMC boot from partition 1
NOTICE:  BL2: Load dst=0x1c7c0 src=(p:1)0x20000(256) len=0x10(1)
NOTICE:  BL2: eMMC boot from partition 1
NOTICE:  BL2: Load dst=0x1c960 src=(p:1)0x20010(256) len=0x28(1)
NOTICE:  BL2: Load dst=0x1c960 src=(p:1)0x20038(256) len=0x28(1)
NOTICE:  BL2: eMMC boot from partition 1
NOTICE:  BL2: Load dst=0x50000000 src=(p:1)0x26100(304) len=0xa2975(1302)
NOTICE:  BL2: Booting BL31
NOTICE:  BL31: v2.5(release):v2.5/rzg2l-1.00-15-g9eb221438
NOTICE:  BL31: Built : 17:28:50, Nov  2 2021


U-Boot 2020.10-g2579e8a259-dirty (Oct 25 2021 - 12:04:40 +0900)

CPU: Renesas Electronics E rev 16.15
Model: rzg2l-novotech
DRAM:  896 MiB
MMC:   sh-sdhi: 0, sh-sdhi: 1
Loading Environment from MMC... *** Warning - bad CRC, using default environment

In:    serial@1004b800
Out:   serial@1004b800
Err:   serial@1004b800
Net:   
Error: ethernet@11c20000 address not set.
No ethernet found.

Hit any key to stop autoboot:  0

Build Linux Kernel

cd linux-cip
./build-g2l.sh

Create Linux root filesystem

Prepare a SD card with capacity of 16GB or more. Use partition tool like fdisk, create 2 partitions on SD card: first partition should be FAT16/32, with size at least 64MiB, secord partition should be ext4, size should be at least 8GiB. Copy files below into first partition (replace /dev/sdb1 to the first partition of your real SD card device path):

sudo -s
mount /dev/sdb1 /mnt
cp -v linux-cip/deploy/g2l/Image /mnt
cp -v linux-cip/deploy/g2l/r9a07g044l2-smarc.dtb /mnt
cp -v linux-cip/deploy/g2l/modules.tar.gz /mnt
umount /dev/sdb1
exit

Then create Debian 11 (Bullseye) rootfs:

sudo -s
apt-get install qemu-user-static debootstrap schroot

mkdir debian-rootfs
cd debian-rootfs
export ROOTFS="$(pwd)"
qemu-debootstrap --arch arm64 --variant buildd --include=ca-certificates,apt,wget,sudo,debootstrap,isc-dhcp-client,nano,network-manager bullseye "${ROOTFS}" http://deb.debian.org/debian

chroot "${ROOTFS}"
passwd root
#Input your root password

exit

tar -xf ../linux-cip/deploy/g2l/modules.tar.gz
tar -czpf ../debian-bullseye-rootfs.tar.gz .

exit

Mount and extract rootfs to the second partition of your SD card (replace /dev/sdb2 to your one).

sudo -s
mount /dev/sdb2 /mnt
tar -xpzf debian-bullseye-rootfs.tar.gz -C /mnt

# Copy rootfs to SD card so that you can install it to eMMC (Optional):
cp -v debian-bullseye-rootfs.tar.gz /mnt

umount /dev/sdb2
exit

Boot kernel & rootfs from SD card

At u-boot auto booting count down, press enter to break into u-boot command-line. Use commands below to boot from SD card:

run sdboot

The device path of SD card is /dev/mmcblk1, and the path of eMMC is /dev/mmcblk0. Kernel and rootfs can be written into eMMC with the same partition structure as SD card.