Timesys Getting Started Guide for Renesas RZG2L Evaluation Kit (Secure Type)

$FILE


Contents

Introduction

This document will describe in detail the procedures for booting a Linux kernel image and mounting a root file system from an SD Card on the Renesas RZ/G2L Evaluation Kit (Secure Type).

Prerequisites

Host Requirements

To properly boot the Renesas RZ/G2L Evaluation Kit (Secure Type) using software from Timesys, your host machine must meet the following requirements:

  • Modern GNU/Linux Distribution. Timesys recommends one of the following distributions:
    • Ubuntu 20.04 / 22.04
  • sudo permission on the Development Host.
  • A copy of the Linux Kernel (Image-5.10-ts-aarch64) and Root File System (rootfs.tar.gz) for the Target Board downloaded from Factory. These are found in the output directory of your online build, or in the directory build_aarch64-timesys-linux-<libc>/images/ on the command line.
  • An available USB port on your Development Host.
  • A SD card slot or adapter on your Development Host.

Target Requirements

To boot the Renesas RZ/G2L Evaluation Kit (Secure Type), you will need the following items:

  • Renesas RZ/G2L Evaluation Kit (Secure Type)
  • SD Card
  • Micro USB Cable
  • USB Type-C cable compatible with USB PD
  • USB PD Charger 15W (5V 3.0A) or more.

Once you have all of the necessary components, you should perform the following steps:

  1. Connect the USB Debug port(CN14) of the board to a USB port of your workstation using the Micro USB Cable.
  2. Connect the power supply to the board's power port (CN6).
  3. Press the red button (SW9) to turn on the power and the LED4 (Carrier PWR On) should illuminate.
  4. Set aside the SD card, you will need to intialize it from the Development Host before booting the board.

Preparing the Target

Configuring Serial Communication

The RZG2L_SECURE uses a serial debug port to communicate with the host machine. The commands discussed in this section are meant to be performed by a privileged user account. This requires the root login or prepending each command with sudo.

Using Minicom

  1. Start minicom on your host machine in configuration mode. As root:

    # minicom -o -s -w

  2. A menu of configuration should appear. Use the Down-arrow key to scroll down and select the Serial port setup option, and press Enter.
  3. Verify that the listed serial port is the same one that is connected to the target board. If it is not, press A, and enter the correct device. This is /dev/ttyUSB0 on most Linux distributions.
  4. Set the Bps/Par/Bits option by pressing the letter E and using the next menu to set the appropriate values. You press the key that corresponds to the value 115200, then press Enter.
  5. Set Hardware flow control to No using the F key.
  6. Set Software flow control to No using the G key.
  7. Press Enter to return to the main configuration menu, and then press Esc to exit this menu.
  8. Reset the board, and wait for a moment. If you do not see output from the board, press Enter several times until you see the prompt. If you do not see any output from the board, and have verified that the serial terminal connection is setup correctly, contact your board vendor.

TIP: If you experience an error similar to Device /dev/ttyUSB0 is locked when starting minicom, it usually means that another process is using the serial port (which is usually another instance of minicom). You can find the process that is currently using the serial port by executing the following:

# fuser /dev/ttyUSB0
/dev/ttyUSB0:         28358

# ps 28358
  PID TTY      STAT  TIME COMMAND
  28923 pts/0    S+    0:00 minicom

This process can also be killed directly with fuser as root. Please use this command with caution:

# fuser -k /dev/ttyUSB0

Using GNU Screen

To quickly connect to a board using Gnu Screen, execute the following:

# screen /dev/ttyUSB0 115200

For more information about using screen, please consult the man page, or view the manual online at http://www.gnu.org/software/screen/manual/screen.html

Preparing the Secure Digital Card

The RZG2L_SECURE boots from an SD card. Some kits may be shipped with one that contains a sample kernel and RFS preloaded. We will be replacing these with the kernel and RFS from Factory. If you are using a blank SD card or have trouble replacing the software on the preloaded one, see Partitioning the SD Card. Otherwise, skip directly to Writing Boot Files to the SD Card.

Before you begin, you should determine the name of your SD card on your host system. To do so:

  1. Connect the SD card to your host system. Many modern systems have SD card slots on the case, or you can purchase a USB SD Card Reader for around $15 US.
  2. Determine the device name of the SD Card. This can be done using dmesg. In the following example, the device is /dev/sdX, which contains one partition sdX1.

    $ dmesg | tail
    [88050.184080] sd 4:0:0:0: [sdX] 1990656 512-byte hardware sectors: (1.01 GB/972 MiB)
    [88050.184821] sd 4:0:0:0: [sdX] Write Protect is off
    [88050.184824] sd 4:0:0:0: [sdX] Mode Sense: 03 00 00 00
    [88050.184827] sd 4:0:0:0: [sdX] Assuming drive cache: write through
    [88050.185575] sd 4:0:0:0: [sdX] 1990656 512-byte hardware sectors: (1.01 GB/972 MiB)
    [88050.186323] sd 4:0:0:0: [sdX] Write Protect is off
    [88050.186325] sd 4:0:0:0: [sdX] Mode Sense: 03 00 00 00
    [88050.186327] sd 4:0:0:0: [sdX] Assuming drive cache: write through
    [88050.186330]  sdX: sdX1

Partitioning the SD card

If you want to use a different SD card or its contents become corrupted, you can use the fdisk tool to create two partitions on your SD card. Please note that all data on the card will be lost upon completion of these steps.
  1. Unmount the partition if it was automounted by using the umount command.
    $ umount /dev/sdX1
  2. As root, run the fdisk utility on the drive.
    $ sudo fdisk /dev/sdX
  3. In fdisk, Delete the existing partition table and create a new one using the o command.
    Command (m for help): o
    Building a new DOS disklabel with disk identifier 0x8b025602.
    Changes will remain in memory only, until you decide to write them.
    After that, of course, the previous content won't be recoverable.
  4. Create a new primary partition using the n command. The first partition will be a FAT partition for storing the boot files. 64 MB is typically more than enough for this purpose.
    Command (m for help): n
    Partition type:
       p   primary (0 primary, 0 extended, 4 free)
       e   extended
    Select (default p): p
    Partition number (1-4, default 1): 1
    First sector (2048-30679039, default 2048):
    Using default value 2048
    Last sector, +sectors or +sizeK,M,G (2048-30679039, default 30679039): +64M
  5. Set the first partition as W95 FAT32 (LBA) using the t command and entering the Hex code c.

    Command (m for help): t
    Selected partition 1
    Hex code (type L to list codes): c

  6. Set the bootable flag on the first partition using the a command.

    Command (m for help): a
    Partition number (1-4): 1

  7. Create a second primary partition using the n command. This partition will be a linux partition for storing the root filesystem. It will fill the rest of the SD card.

    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    p
    Partition number (1-4, default 2): 2
    First sector (133120-30679039, default 133120):
    Using default value 18432
    Last sector, +sectors or +sizeK,M,G (133120-30679039, default 30679039):
    Using default value 30679039

  8. Verify that the partition table is correct by using the p command. It should look similar to the following:

    Command (m for help): p                                                         
                                                                                    
    Disk /dev/sdX: 15.7 GB, 15707668480 bytes
    64 heads, 32 sectors/track, 14980 cylinders, total 30679040 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x6eaae8f8

       Device Boot      Start         End      Blocks   Id  System
    /dev/sdX1   *        2048      133119       65536    c  W95 FAT32 (LBA)
    /dev/sdX2          133120    30679039    14773960   83  Linux

  9. This step will destroy all data on the SD Card - Write the partition table to the card using the w command.

    Command (m for help): w
    The partition table has been altered!

    Calling ioctl() to re-read partition table.

    WARNING: If you have created or modified any DOS 6.x
    partitions, please see the fdisk manual page for additional
    information.
    Syncing disks.

  10. Format the first partition of the SD card with a FAT filesystem using the mkfs.vfat tool.

    $ sudo /sbin/mkfs.vfat -n boot /dev/sdX1

  11. Format the second partition using an ext4 filesystem using the mkfs.ext4 tool.

    $ sudo /sbin/mkfs.ext4 -L rfs /dev/sdX2

Writing Boot Files to the SD Card

  1. Mount the partitions. You can remove and reinsert the card to trigger the automount, or you can use the mount command to mount the partition to an arbitrary location.

    $ sudo mount /dev/sdX1 /media/boot
    $ sudo mount /dev/sdX2 /media/rfs

  2. As root, copy the Image file, Image-5.10-ts-aarch64, to the boot partition of the card.

    $ sudo cp Image-5.10-ts-aarch64 /media/boot/

  3. As root, copy the Device Tree Blob file, rzg2l_secure.dtb, to the boot partition of the card.

    $ sudo cp rzg2l_secure.dtb /media/boot/

  4. As root, extract the rootfs.tar.gz archive to the mounted directory. This file is located at build_aarch64-timesys-linux-<libc>/images/rfs/ on Desktop Factory builds.

    $ sudo tar xzf rootfs.tar.gz -C /media/rfs

  5. As root, umount the SD Card.

    $ sync
    $ sudo umount /media/boot
    $ sudo umount /media/rfs
  6. Remove the SD Card from the host machine, and insert it into the SD Card slot on the target board (located on the Carrier).

Preparing the Host

No additional host setup is required to boot from SD.

Booting the Board

Set Environment Variables

You must set a few environment variables in order to boot the board from the SD card. This is done with the setenv and saveenv commands in U-Boot.

On the target, set the following environment variables:

Variable Value          
bootargs console=ttySC0,115200 root=/dev/mmcblk1p2 rootwait          
load_kernel fatload mmc 1:1 0x48080000 Image-5.10-ts-aarch64          
load_dtb fatload mmc 1:1 0x48000000 rzg2l_secure.dtb          
bootcmd mmc rescan\; run load_kernel load_dtb\; booti 0x48080000 - 0x48000000          

Example

> setenv bootargs console=ttySC0,115200 root=/dev/mmcblk1p2 rootwait
> setenv load_kernel fatload mmc 1:1 0x48080000 Image-5.10-ts-aarch64
> setenv load_dtb fatload mmc 1:1 0x48000000 rzg2l_secure.dtb
> setenv bootcmd mmc rescan\; run load_kernel load_dtb\; booti 0x48080000 - 0x48000000
> saveenv

Load The Kernel

You can use the mmc subsystem to load the kernel from the SD card. Example

> mmc rescan
> fatload mmc 1:1 0x48080000 Image-5.10-ts-aarch64
17902080 bytes read in 1137 ms (15 MiB/s)

Load The Device Tree

You can use the mmc subsystem to load the device tree file (dtb) from the SD card.

Example

> mmc rescan
> fatload mmc 1:1 0x48000000 rzg2l_secure.dtb
39900 bytes read in 31 ms (1.2 MiB/s)

Boot the Kernel

The booti command is used to boot the kernel. It loads the file that was previously loaded using the fatload command.

Example

> booti 0x48080000 - 0x48000000
Moving Image from 0x48080000 to 0x48200000, end=49380000
## Flattened Device Tree blob at 48000000
   Booting using the fdt blob at 0x48000000
   Loading Device Tree to 0000000057ff3000, end 0000000057fffbdb ... OK
   
Starting kernel ...

Additional Information

Setting up Renesas Graphics, Video Codec, and Secure sources in the Factory

  1. An account in the Renesas portal (https://www.renesas.com/en/myrenesas) is required.
  2. Download the Renesas platform sources from the below location and copy them to the ~/timesys directory.
        Graphics-> https://www.renesas.com/en/products/microcontrollers-microprocessors/rz-...      
        Video Codec-> https://www.renesas.com/en/software-tool/rz-mpu-video-codec-library-eval...
        Secure-> https://www.renesas.com/en/document/sws/rz-mpu-security-package-rzv-v143...
    Note: For a secure package from Renesas, you need to request from your account for access via your Renesas support contact/sales.
  3. From the factory top-level directory, use the copy platform software script to extract and copy the sources.
    $ ./bin/rzg2l_copy_platform_software.sh -g ~/timesys/RTK0EF0045Z13001ZJ-v1.2.2_EN.zip -c ~/timesys/RTK0EF0045Z15001ZJ-v1.2.2_EN.zip -s ~/timesys/RZG_SECURITY_PACKAGE_v1.4.3-update1.zip

  4. You may use 'Initial Selection Templates' to select the Video Codec packages group:

    $ make menuconfig
    Navigate to:
    > Target Configuration > Initial Selection Templates > [*]   RZG2 Video Codec  

Preparing Fitimage in Factory

Selecting Fitimage in Factory

Target Configuration -> Build RFS -> fitimage
  1. After selecting Fitimage
    run $ make
  2. Once build is completed, you can see the output in below directory,
    $ factory/build_aarch64-timesys-linux-gnu/images/fitimage-rzg2l_secure.itb

Partitioning the SD card for fitimage

  1. Unmount the partition if it was automounted by using the umount command.
    $ umount /dev/sdX1
    $ umount /dev/sdX2
  2. As root, run the fdisk utility on the drive.
    $ sudo fdisk /dev/sdX
  3. In fdisk, Delete the existing partition table and create a new one using the o command.
    Command (m for help): o
    Created a new DOS disklabel with disk identifier 0xf38ed2c0.
  4. Create a new primary partition using the n command. The first partition will be a FAT partition for storing the boot files. 64 MB is typically more than enough for this purpose.
    Command (m for help): n
    Partition type:
       p   primary (0 primary, 0 extended, 4 free)
       e   extended
    Select (default p): p
    Partition number (1-4, default 1): 1
    First sector (2048-30679039, default 2048):
    Using default value 2048
    Last sector, +sectors or +sizeK,M,G (2048-30679039, default 30679039): +64M
  5. Set the first partition as W95 FAT32 (LBA) using the t command and entering the Hex code c.
    Command (m for help): t
    Selected partition 1
    Hex code (type L to list codes): c
  6. Set the bootable flag on the first partition using the a command.
    Command (m for help): a
    Partition number (1-4): 1
  7. Verify that the partition table is correct by using the p command. It should look similar to the following:
    Command (m for help): p

    Disk /dev/sdb: 29.74 GiB, 31914983424 bytes, 62333952 sectors
    Disk model: Transcend       
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0xf38ed2c0

    Device     Boot Start    End Sectors Size Id Type
    /dev/sdb1  *     2048 133119  131072  64M  c W95 FAT32 (LBA)

  8. This step will destroy all data on the SD Card - Write the partition table to the card using the w command.

    Command (m for help): w

    The partition table has been altered.
    Calling ioctl() to re-read partition table.
    Syncing disks.

  9. Format the first partition of the SD card with a FAT filesystem using the mkfs.vfat tool.

    $ sudo /sbin/mkfs.vfat -n boot /dev/sdX1

Coping Fitimage File to the SD Card

  1. Mount the partitions. You can remove and reinsert the card to trigger the automount, or you can use the mount command to mount the partition to an arbitrary location.

    $ sudo mount /dev/sdX1 /media/boot

  2. As root, copy the Fitimage, to the boot partition of the card.

    $ sudo cp fitimage-rzg2l_secure.itb /media/boot/

  3. As root, umount the SD Card.

    $ sudo umount /media/boot

Booting Board using Fitimage

To boot the board using fitimage , follow the below steps

  1. After power on the board , set the below environment variable

    => setenv bootargs console=ttySC0 root=/dev/ram initrd=0x68000000 rdinit=/sbin/init rw

  2. Check whether fitimage is copied properly using below command,

    => fatls mmc 1:1                        
     21630200   fitimage-rzg2l_secure.itb          
                                            
    1 file(s), 0 dir(s)

  3. Load the fitimage using the below command

    => fatload mmc 1 0x52000000 fitimage-rzg2l_secure.itb                                                          
    45926328 bytes read in 2859 ms (15.3 MiB/s)

  4. To check the loaded image , run below command

    => iminfo 0x52000000                                                                                           

    ## Checking Image at 52000000 ...
       FIT image found
       FIT description: Renesas RZ/G2L Evaluation Kit (Secure Type) FIT Image
        Image 0 (kernel)
         Description:  Kernel
         Type:         Kernel Image
         Compression:  uncompressed
         Data Start:   0x520000dc
         Data Size:    17443328 Bytes = 16.6 MiB
         Architecture: AArch64
         OS:           Linux
         Load Address: 0x48080000
         Entry Point:  0x48080000
         Hash algo:    sha1
         Hash value:   59d53a56588848c32377f6b921d6772d478d7736
        Image 1 (fdt)
         Description:  DTB
         Type:         Flat Device Tree
         Compression:  uncompressed
         Data Start:   0x530a2bb8
         Data Size:    39880 Bytes = 38.9 KiB
         Architecture: AArch64
         Load Address: 0x48000000
         Hash algo:    sha1
         Hash value:   005035e4fe23bab6e8c8288dec02072ee1088899
        Image 2 (initrd)
         Description:  Initrd
         Type:         RAMDisk Image
         Compression:  gzip compressed
         Data Start:   0x530ac850
         Data Size:    28441108 Bytes = 27.1 MiB
         Architecture: AArch64
         OS:           Linux
         Load Address: unavailable
         Entry Point:  unavailable
         Hash algo:    sha1
         Hash value:   ca9db92034261a2aa1178854070ffb12a6020f3e
        Default Configuration: 'standard'
        Configuration 0 (standard)
         Description:  Standard Boot
         Kernel:       kernel
         Init Ramdisk: initrd
         FDT:          fdt
         Hash algo:    sha1
         Hash value:   unavailable
    ## Checking hash(es) for FIT Image at 52000000 ...
       Hash(es) for Image 0 (kernel): sha1+
       Hash(es) for Image 1 (fdt): sha1+
       Hash(es) for Image 2 (initrd): sha1+

  5. To boot the fitimage run below command

    => bootm 0x52000000
    ## Loading kernel from FIT Image at 52000000 ...
       Using 'standard' configuration
       Trying 'kernel' kernel subimage
         Description:  Kernel
         Type:         Kernel Image
         Compression:  uncompressed
         Data Start:   0x520000dc
         Data Size:    17443328 Bytes = 16.6 MiB
         Architecture: AArch64
         OS:           Linux
         Load Address: 0x48080000
         Entry Point:  0x48080000
         Hash algo:    sha1
         Hash value:   59d53a56588848c32377f6b921d6772d478d7736
       Verifying Hash Integrity ... sha1+ OK
    ## Loading ramdisk from FIT Image at 52000000 ...
       Using 'standard' configuration
       Trying 'initrd' ramdisk subimage
         Description:  Initrd
         Type:         RAMDisk Image
         Compression:  gzip compressed
         Data Start:   0x530ac850
         Data Size:    28441108 Bytes = 27.1 MiB
         Architecture: AArch64
         OS:           Linux
         Load Address: unavailable
         Entry Point:  unavailable
         Hash algo:    sha1
         Hash value:   ca9db92034261a2aa1178854070ffb12a6020f3e
       Verifying Hash Integrity ... sha1+ OK
    WARNING: 'compression' nodes for ramdisks are deprecated, please fix your .its file!
    ## Loading fdt from FIT Image at 52000000 ...
       Using 'standard' configuration
       Trying 'fdt' fdt subimage
         Description:  DTB
         Type:         Flat Device Tree
         Compression:  uncompressed
         Data Start:   0x530a2bb8
         Data Size:    39880 Bytes = 38.9 KiB
         Architecture: AArch64
         Load Address: 0x48000000
         Hash algo:    sha1
         Hash value:   005035e4fe23bab6e8c8288dec02072ee1088899
       Verifying Hash Integrity ... sha1+ OK
       Loading fdt from 0x530a2bb8 to 0x48000000
       Booting using the fdt blob at 0x48000000
       Loading Kernel Image
       Loading Ramdisk to 564e0000, end 57fffa14 ... OK
       Loading Device Tree to 00000000564d3000, end 00000000564dfbc7 ... OK

    Starting kernel ...

Factory Documentation