Skip to content

RZ G2L SMARC Boot

Chris Brandt edited this page Sep 15, 2024 · 23 revisions

Copy kernel over Eth and boot

On Host:

./build.sh k _all
./build.sh k deploy
cp -va rz_linux-cip/.deploy/smarc-rzg2l /var/lib/tftpboot/

On Board:

# Disable 60 sec watchdog
=> wdt dev watchdog@12800800 ; wdt stop


setenv ipaddr 10.10.10.60 ; setenv ethaddr 00:ee:ee:11:22:33 ; setenv serverip 10.10.10.30

setenv ipaddr 10.10.10.110    # The ip address of your board
ping 10.10.10.30              # The ip address of your PC
setenv serverip 10.10.10.30
Default 128M
tftpboot 0x48080000 /smarc-rzg2l/Image && dcache flush
tftpboot 0x48000000 /smarc-rzg2l/r9a07g044l2-smarc.dtb && dcache flush
setenv bootargs root=/dev/mmcblk1p2 rootwait init=/bin/sh ; booti 0x48080000 - 0x48000000
setenv bootargs root=/dev/mmcblk1p2 rootwait ; booti 0x48080000 - 0x48000000

When using init=/bin/sh

After boot:

#Mount things needed by this script
mount -t proc proc /proc
mount -t sysfs sysfs /sys

16MB

tftpboot 0x41080000 /smarc-rzg2l/Image && dcache flush tftpboot 0x41000000 /smarc-rzg2l/r9a07g044l2-smarc.dtb && dcache flush setenv bootargs root=/dev/mmcblk1p2 earlycon rootwait ; booti 0x41080000 - 0x41000000

setenv bootargs root=/dev/mmcblk1p2 earlycon rootwait init=/bin/sh ; booti 0x40080000 - 0x41000000

tftpboot 0x40180000 /smarc-rzg2l/Image && dcache flush tftpboot 0x40100000 /smarc-rzg2l/r9a07g044l2-smarc.dtb && dcache flush setenv bootargs root=/dev/mmcblk1p2 earlycon rootwait ; booti 0x40180000 - 0x40010000

2MB

tftpboot 0x40280000 /smarc-rzg2l/Image && dcache flush tftpboot 0x40200000 /smarc-rzg2l/r9a07g044l2-smarc.dtb && dcache flush setenv bootargs root=/dev/mmcblk1p2 earlycon rootwait ; booti 0x40280000 - 0x40200000

1MB

tftpboot 0x40180000 /smarc-rzg2l/Image && dcache flush tftpboot 0x40100000 /smarc-rzg2l/r9a07g044l2-smarc.dtb && dcache flush setenv bootargs root=/dev/mmcblk1p2 earlycon rootwait ; booti 0x40180000 - 0x40100000

U-boot tftpboot 0x50000000 /u-boot.bin && dcache flush ; go 0x50000000

FYI, On SMARC EVK, from u-boot, you can select sd0 device to SDHI0 or eMMC by controlling P41_1 without changing SW1.2. We just need to configure P41_1 as GPIO in u-boot and drive P41_1 for device selection.

setenv netmask 255.255.255.0 setenv gatewayip 10.10.10.1 setenv serverip 192.168.1.100

sd1load=ext4load mmc 1:1 0x4A080000 boot/Image.gz;ext4load mmc 1:1 0x48000000 boot/r9a07g044l-smarc-rzg2l.dtb;run prodsdbootargs sd_boot1=mmc dev 1 ; fatload mmc 1:1 0x48080000 Image ; fatload mmc 1:1 0x48000000 /r9a07g044l2-smarc.dtb sd_boot2=setenv bootargs root=/dev/mmcblk1p2 rootwait ; booti 0x48080000 - 0x48000000

Boot from different partitions. Files kept in /boot Look for both r9a07g044l2-smarc.dtb and Image-r9a07g044l2-smarc.dtb(what is explained in the ReleaseNote)

setenv sd_p2_boot1 'mmc dev 1 ; ext4load mmc 1:2 0x48080000 /boot/Image ; ext4load mmc 1:2 0x48000000 /boot/r9a07g044l2-smarc.dtb ; ext4load mmc 1:2 0x48000000 /boot/Image-r9a07g044l2-smarc.dtb' setenv sd_p2_boot2 'setenv bootargs root=/dev/mmcblk1p2 rootwait ; booti 0x48080000 - 0x48000000' setenv sd_p2_boot 'run sd_p2_boot1 sd_p2_boot2' saveenv

show root of each partition

setenv list 'ls mmc 1:2 /*.txt ; ls mmc 1:3 /*.txt ; ls mmc 1:4 /'
setenv list 'echo partition 2 ; ls mmc 1:2 / ; echo partition 3 ; ls mmc 1:3 / ; echo partition 4 ; ls mmc 1:4 /'
saveenv
run list

boot from any partition

Commands to make the u-boot macros

setenv part 2
setenv sd_part_boot1 'mmc dev 1 ; ext4load mmc 1:${part} 0x48080000 /boot/Image ; ext4load mmc 1:${part} 0x48000000 /boot/r9a07g044l2-smarc.dtb'
setenv sd_part_boot2 'setenv bootargs root=/dev/mmcblk1p${part} rootwait ; booti 0x48080000 - 0x48000000'
setenv sd_2_boot 'setenv part 2 ; run sd_part_boot1 sd_part_boot2'
setenv sd_3_boot 'setenv part 3 ; run sd_part_boot1 sd_part_boot2'
setenv sd_4_boot 'setenv part 4 ; run sd_part_boot1 sd_part_boot2'

Commands to run:

=> run sd_2_boot

Format eMMC as ext4 (4 partitions)

fdisk /dev/mmcblk0

m for help

# delete any existing partition
d

# make 4 primary ext4 partitions, 2GB each. They are only 2GB to make them format faster.
n  p  1  {enter} +2G
n  p  2  {enter} +2G
n  p  3  {enter} +2G
n  p     {enter} +2G     << note that it does not ask you for the partition number
w



# format the new partitions
$ mkfs.ext4 /dev/mmcblk0p1
$ mkfs.ext4 /dev/mmcblk0p2
$ mkfs.ext4 /dev/mmcblk0p3
$ mkfs.ext4 /dev/mmcblk0p4

Program BSP int eMMC over Ethernet

On board:

mkdir -p /mnt/mmcblk0p1 ; mount /dev/mmcblk0p1 /mnt/mmcblk0p1
mkdir -p /mnt/mmcblk0p2 ; mount /dev/mmcblk0p2 /mnt/mmcblk0p2
mkdir -p /mnt/mmcblk0p3 ; mount /dev/mmcblk0p3 /mnt/mmcblk0p3
mkdir -p /mnt/mmcblk0p4 ; mount /dev/mmcblk0p4 /mnt/mmcblk0p4

ifconfig    #  to get the ip address for SCP

On PC:

  • Connect with WinSCP to board, and drag file core-image-qt-smarc-rzg2l.tar.bz2 into /mnt/mmcblk0p1
  • Use scp to copy to board ** scp core-image-qt-smarc-rzg2l.tar.bz2 [email protected]/mnt (command does not work yet)

On board:

$ cd /mnt/mmcblk0p1
$ tar -xf core-image-qt-smarc-rzg2l.tar.gz
$ touch "core-image-qt-smarc-rzg2l_vlp_v3.0.6-update3.txt"

$ sync ; cd / ;  umount /mnt/mmcblk0p1
$ reboot

Boot:

=> setenv part 1
=> mmc dev 0 ; ext4load mmc 0:${part} 0x48080000 /boot/Image ; ext4load mmc 0:${part} 0x48000000 /boot/r9a07g044l2-smarc.dtb
=> setenv bootargs root=/dev/mmcblk0p1 rootwait ; booti 0x48080000 - 0x48000000

Clone this wiki locally