Introduction

The following guide will provide different HummingBoard RZ/G2LC boot options.

This guide uses build artifacts from the SolidRun BSP repository. You need to clone this repo and build the artifacts first.

The RZ/G2LC HummingBoards have two basic boot modes: SD boot and eMMC boot. The boot process starts with loading the bootloaders to the memory from the SD or eMMC. This article will explain how to boot HummingBoard in different modes and flash bootloaders to the eMMC.

Boot from SD card

sudo dd if=images/rzg2lc_solidrun_buildroot-sd-xxxxxxx.img of=/dev/sdX bs=1M

Note: xxxxxxx in the file name is the software revision number that changes over time.

Note: the SD card is assumed to be connected to /dev/sdX device and unmounted. Don’t forget to change X to the actual device letter.

After that step, the board will boot automatically.

Boot from USB

It’s possible to place the rootfs and boot partitions on the USB drive. This allows us to boot the Linux and get access to the eMMC.

sudo dd if=images/rzg2lc_solidrun-sd-bootloader-xxxxxxx.img of=/dev/sdX bs=1M
sudo dd if=images/rzg2lc_solidrun_buildroot-sd-xxxxxxx.img of=/dev/sdX bs=1M

Note: the USB drive is assumed to be connected to /dev/sdX device and unmounted. Don’t forget to change X to the actual device letter.

After this step, the board will boot. Stop it in the U-Boot command line in your terminal.

In: serial@1004b800
Out: serial@1004b800
Err: serial@1004b800
Net: EEPROM: TlvInfo v1 len=18
eth0: ethernet@11c20000
Hit any key to stop autoboot: 2
=>

setenv bootargs "rw rootwait earlycon root=/dev/sda2"
usb start
load usb 0:1 $kernel_addr_r boot/Image
load usb 0:1 $fdt_addr_r boot/rzg2lc-hummingboard.dtb
setenv sdio_select emmc
booti $kernel_addr_r - $fdt_addr_r

After that step, the board will boot using the rootfs placed on the second USB drive partition.

Boot using TFTP

U-Boot allows to load the kernel, ramdisk, and fdt over TFTP. In this example, we will use ramdisk for the rootfs.

sudo dd if=images/rzg2lc_solidrun-sd-bootloader-xxxxxxx.img of=/dev/sdX bs=1M

After this step, the board will boot. Stop it in the U-Boot command line in your terminal.

setenv serverip <the.server.ip.addr>
dhcp
setenv bootargs "earlycon"
tftpboot $kernel_addr_r Image
tftpboot $fdt_addr_r rzg2lc-hummingboard.dtb
tftpboot $ramdisk_addr_r initrd.img
setenv sdio_select emmc
booti $kernel_addr_r $ramdisk_addr_r $fdt_addr_r

After that step, the board will boot using the ramdisk rootfs.

Note: since the rootfs is in the RAM, all changes in the filesystem will be lost after reboot.

Flashing bootloaders and rootfs from Linux

This paragraph assumes you boot Linux using rootfs placed on the USB. And you selected SDIO switch to the eMMC in the u-boot environment before jumping to Linux.

setenv sdio_select emmc

Also, you need to copy bootloader files to the USB:

Disable eMMC boot partition write protection:

echo 0 > /sys/block/mmcblk0boot0/force_ro

Flash the bootloaders:

dd if=bl2_bp-rzg2lc-solidrun.bin of=/dev/mmcblk0boot0 bs=512 seek=1
dd if=fip-rzg2lc-solidrun.bin of=/dev/mmcblk0boot0 bs=512 seek=256

Enable boot partition:

mmc bootbus set single_backward x1 x8 /dev/mmcblk0
mmc bootpart enable 1 0 /dev/mmcblk0

Flash the bootfs and rootfs:

dd if=rzg2lc_solidrun_buildroot-sd-a6f9227.img of=/dev/mmcblk0 bs=4M

After this step, you can reboot, and the board will start booting from eMMC.

Flashing bootloaders over serial

An RZ/G2LC CPU has a serial downloader mode. With this mode, it’s possible to flash the bootloader to SOM’s eMMC using flash-writer bare-metal software.

Prepare the board:

Go to the flash-writer script dir:

cd build_scripts/flash-writer/

Note: The config.ini file contains all the necessary script configuration, including binaries paths and the serial device. That config sets /dev/ttyUSB0 as the default serial device. Don’t forget to change the SERIAL_DEVICE_INTERFACE variable to the actual device if it’s different in your system.

Flash the bootloaders:

sudo ./flash_writer_tool.sh config.ini fw
sudo ./flash_writer_tool.sh config.ini bl2
sudo ./flash_writer_tool.sh config.ini fip
sudo ./flash_writer_tool.sh config.ini emmc_config

Note: The fw command uploads the flash-writer bare-metal software to the RAM. You can change the order or skip some of the commands if you need, but the fw command should always come first since it uploads the necessary software for the other commands.

Set the S3 DIP switch to eMMC boot and press reset.