Appendix¶
How to boot from eMMC¶
In this section, the steps to boot from eMMC are described.
Writing Bootloader for eMMC Boot¶
For the boot operation, EXT_CSD
registers of eMMC need to be modified and two boot loader files need to be written to the target board.
After booting the Flash Writer
, EM_SECSD
command of Flash Writer is used to modify EXT_CSD
register of eMMC to enable eMMC boot.
Then, EM_W
command of Flash Writer is used to write boot loader binary files. This command receives binary data from the serial port and writes the data to a specified address of the eMMC with information where the data should be loaded on the address of the main memory.
For example, this part describes how to modify EXT_CSD
register and write boot loader files:
>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[B3] = 0x00
Please Input Value(H'00 - H'FF) :8
EXT_CSD[B3] = 0x08
>EM_W
EM_W Start --------------
---------------------------------------------------------
Please select,eMMC Partition Area.
0:User Partition Area : 62160896 KBytes
eMMC Sector Cnt : H'0 - H'0768FFFF
1:Boot Partition 1 : 32256 KBytes
eMMC Sector Cnt : H'0 - H'0000FBFF
2:Boot Partition 2 : 32256 KBytes
eMMC Sector Cnt : H'0 - H'0000FBFF
---------------------------------------------------------
Select area(0-2)>1
-- Boot Partition 1 Program -----------------------------
Please Input Start Address in sector :1
Please Input Program Start Address : 11e00
Work RAM(H'50000000-H'50FFFFFF) Clear....
please send ! ('.' & CR stop load)
Send the data of bl2_bp_smmc-smarc-rzg2l_pmic.srec
from terminal software after the message please send ! is shown.
After successfully downloading the binary, messages like below are shown on the terminal.
Next, write another loader file by using EM_W
command again.
> EM_W
EM_W Start --------------
---------------------------------------------------------
Please select,eMMC Partition Area.
0:User Partition Area : 62160896 KBytes
eMMC Sector Cnt : H'0 - H'0768FFFF
1:Boot Partition 1 : 32256 KBytes
eMMC Sector Cnt : H'0 - H'0000FBFF
2:Boot Partition 2 : 32256 KBytes
eMMC Sector Cnt : H'0 - H'0000FBFF
---------------------------------------------------------
Select area(0-2)>1
-- Boot Partition 1 Program -----------------------------
Please Input Start Address in sector :100
Please Input Program Start Address : 0
Work RAM(H'50000000-H'50FFFFFF) Clear....
please send ! ('.' & CR stop load)
Send the data of fip-smarc-rzg2l_pmic.srec
from terminal software after the message please send ! is shown.
After successfully downloading the binary, messages like below are shown on the terminal.
After writing two loader files normally, turn off the power of the board by changing the SW11.
Note
Address of
EXT_CSD
register of eMMC for eMMC bootAddress Value to write 0xB1
0x02
0xB3
0x08
Address for sending each loader binary file for eMMC boot
File name Partition to save to eMMC Address to save to eMMC Address to load to RAM bl2_bp_mmc-smarc-rzg2l_pmic.srec
1
00000001
11E00
fip-smarc-rzg2l_pmic.srec
1
00000100
00000
Create a microSD card to boot Linux for eMMC boot¶
Please create a microSD card (see Step 4: Deploy Renesas RZ Linux BSP Plus).
After that, please return to the following instructions before unmounting the micro SD card.
Copy the kernel image, device tree file, and rootfs to the second partition of the microSD card.
cd /media/user/rootfs/home/root/
sudo cp ${WORK}/build/tmp/deploy/images/${BOARD}/<Linux kernel> ./
sudo cp ${WORK}/build/tmp/deploy/images/${BOARD}/<Devise tree> ./
sudo cp ${WORK}/build/tmp/deploy/images/${BOARD}/<root filesystem> ./
cd ${WORK}
sudo umount /media/user/rootfs
Writing rootfs to eMMC¶
To set the board to eMMC Boot mode, set the SW11 as below:
Then, set the SW1 on SOM module to eMMC mode.
Turn on the board by pressing the reset button SW10. After Linux boots, please log in as root and create partitions on the eMMC by running the following commands.
root@smarc-rzg2l:~# fdisk /dev/mmcblk0
Welcome to fdisk (util-linux 2.35.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): o
Created a new DOS disklabel with disk identifier 0xf3d53104.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): (Push the enter key)
Partition number (1-4, default 1): (Push the enter key)
First sector (2048-124321791, default 2048): (Push the enter key)
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-124321791, default 124321791): +500M
Created a new partition 1 of type 'Linux' and of size 500 MiB.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): (Push the enter key)
Using default response p.
Partition number (2-4, default 2): (Push the enter key)
First sector (1026048-124321791, default 1026048): (Push the enter key)
Last sector, +/-sectors or +/-size{K,M,G,T,P} (1026048-124321791, default 124321791): (Push the enter key)
Created a new partition 2 of type 'Linux' and of size 58.8 GiB.
Command (m for help): p
Disk /dev/mmcblk0: 59.29 GiB, 63652757504 bytes, 124321792 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
Disklabel type: dos
Disk identifier: 0xf3d53104
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 2048 1026047 1024000 500M 83 Linux
/dev/mmcblk0p2 1026048 124321791 123295744 58.8G 83 Linux
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
root@smarc-rzg2l:~#
Format eMMC.
Format the eMMC and write the kernel, device tree, and rootfs.
Setting U-boot for eMMC boot¶
Reset the board by pressing the reset button SW10 and interrupt the boot process by pressing the Enter key.
U-Boot 2021.10 (Apr 22 2022 - 03:04:59 +0000)
CPU: Renesas Electronics K rev 16.15
Model: smarc-rzg2l
DRAM: 1.9 GiB
MMC: sd@11c00000: 0, sd@11c10000: 1
Loading Environment from MMC... OK
In: serial@1004b800
Out: serial@1004b800
Err: serial@1004b800
Net: eth0: ethernet@11c20000
Hit any key to stop autoboot: 0
=>
Set environment variables in the u-boot environment to boot from eMMC. When using other boards, please replace the file names in bootcmd
and set the IP address of your Linux host PC.
setenv bootargs 'root=/dev/mmcblk0p2 rootwait'
setenv bootcmd 'mmc dev 1; ext4load mmc 0:1 0x48080000 Image-smarc-rzg2l.bin; ext4load mmc 0:1 0x48000000 r9a07g044l2-smarc.dtb; booti 0x48080000 - 0x48000000'
saveenv
Please reset the board again for eMMC boot.
How to boot from eSD¶
In this section, the steps to boot from eSD are described.
Prepare micro SD card¶
Prepare the micro SD card using the wic
image file.
Two files (bl2_bp_esd-smarc-<device>.bin
and fip-smarc-<device>.bin
) are used for boot from eSD.
File and directory in the micro SD card
Type/Number
Filesystem
Contents
Primary #1
FAT32
Flash_Writer_SCIF_<device, memory size>.mot
bl2_bp_mmc-smarc-rzg2l_pmic.srec
bl2_bp_spi-smarc-rzg2l_pmic.srec
bl2_bp_esd-smarc-rzg2l_pmic.bin
fip-smarc-rzg2l_pmic.srec
fip-smarc-rzg2l_pmic.bin
Primary #2
Ext4
Set SMARC EVK board for eSD boot¶
Power on and boot¶
After pressing the POWER button (SW9) to turn on the power and RESET button (SW10), Linux will be booted from eSD.
NOTICE: BL2: v2.9(release):cc18695-dirty
NOTICE: BL2: Built : 04:12:39, Dec 14 2023
NOTICE: BL2: SD boot from partition 0
NOTICE: BL2: Load dst=0x1f840 src=(p:0)0x10000(128) len=0x10(1)
NOTICE: BL2: SD boot from partition 0
NOTICE: BL2: Load dst=0x1f9a0 src=(p:0)0x10010(128) len=0x28(1)
NOTICE: BL2: SD boot from partition 0
NOTICE: BL2: Load dst=0x44000000 src=(p:0)0x10090(128) len=0x6069(49)
NOTICE: BL2: SD boot from partition 0
NOTICE: BL2: Load dst=0x1f840 src=(p:0)0x10000(128) len=0x10(1)
NOTICE: BL2: SD boot from partition 0
NOTICE: BL2: Load dst=0x1f9a0 src=(p:0)0x10010(128) len=0x28(1)
NOTICE: BL2: Load dst=0x1f9a0 src=(p:0)0x10038(128) len=0x28(1)
NOTICE: BL2: SD boot from partition 0
NOTICE: BL2: Load dst=0x50000000 src=(p:0)0x16100(176) len=0xbae68(1496)
NOTICE: BL2: Booting BL31
NOTICE: BL31: v2.9(release):cc18695-dirty
NOTICE: BL31: Built : 04:12:39, Dec 14 2023
U-Boot 2021.10 (Dec 15 2023 - 06:47:44 +0000)
CPU: Renesas Electronics CPU rev 1.0
Model: smarc-rzg2l
DRAM: 1.9 GiB
WDT: watchdog@0000000012800800
WDT: Started with servicing (60s timeout)
MMC: sd@11c00000: 0, sd@11c10000: 1
Loading Environment from MMC... *** Warning - bad CRC, using default environment
In: serial@1004b800
Out: serial@1004b800
Err: serial@1004b800
U-boot WDT started!
Net:
Error: ethernet@11c20000 address not set.
No ethernet found.
Hit any key to stop autoboot: 0
## Resetting to default environment
Card did not respond to voltage select! : -110
20070912 bytes read in 1655 ms (11.6 MiB/s)
39353 bytes read in 6 ms (6.3 MiB/s)
Error: Bad gzipped data
Moving Image from 0x48080000 to 0x48200000, end=495a0000
## Flattened Device Tree blob at 48000000
Booting using the fdt blob at 0x48000000
Loading Device Tree to 0000000057ff3000, end 0000000057fff9b8 ... OK
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x412fd050]
[ 0.000000] Linux version 6.10.184-cip36-yocto-standard (oe-user@oe-host) (aarc
:
:
Poky (Yocto Project Reference Distro) 3.1.33 smarc-rzg2l ttySC0
BSP: RZG2L/RZG2L-SMARC-EVK/4.0.0
LSI: RZG2L
Version: 4.0.0
smarc-rzg2l login: root
root@smarc-rzg2l:~#