Skip to content

RZ G2L SMARC Boot

Chris Brandt edited this page Oct 7, 2024 · 22 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

Copy kernel over Eth and boot (initramfs)

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

tftpboot 0x48080000 /smarc-rzg2l/Image && dcache flush
tftpboot 0x48000000 /smarc-rzg2l/r9a07g044l2-smarc.dtb && dcache flush
tftpboot 0x4C000000 /smarc-rzg2l/rzg2_initramfs.cpio.gz && dcache flush
setenv bootargs 'initrd=0x4C000000,32M'
booti 0x48080000 - 0x48000000



# Start SSH Server
ifconfig eth0 up
udhcpc eth0
ifconfig

# need to add a password for root
passwd
1234

## dropbear should be already running ##

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

Conenct with winSCP

initramfs from SD Card

On Board:

=> mmc dev 1
=> fatload mmc 1:1 0x4C000000 rzg2_initramfs.cpio.gz
=> fatload mmc 1:1 0x48080000 Image-smarc-rzg2l.bin
=> fatload mmc 1:1 0x48000000 Image-r9a07g044l2-smarc.dtb
=> setenv bootargs 'initrd=0x4C000000,32M'
=> booti 0x48080000 - 0x48000000

mmc dev 1
fatload mmc 1:1 0x4C000000 rzg2_initramfs.cpio.gz
ext4load mmc 1:2 0x48080000 /boot/Image
ext4load mmc 1:2 0x48000000 /boot/r9a07g044l2-smarc.dtb
setenv bootargs 'initrd=0x4C000000,32M'
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

# SD Card
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

echo partition 2 ; ls mmc 1:2 / ; echo partition 3 ; ls mmc 1:3 / ; echo partition 4 ; ls mmc 1:4 /
loadaddr=0x58000000

# eMMC Flash
setenv list_mmc 'echo partition 1 ; ls mmc 0:1 / ; echo partition 2 ; ls mmc 0:2 / ; echo partition 3 ; ls mmc 0:3 / ; echo partition 4 ; ls mmc 0:4 /'
saveenv
run list

Boot from any partition (SD Card)

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

Boot from any partition (eMMC Flash)

Commands to make the u-boot macros

setenv mmc_part_boot_a 'mmc dev 0 ; ext4load mmc 0:${part} 0x48080000 /boot/Image ; ext4load mmc 0:${part} 0x48000000 /boot/r9a07g044l2-smarc.dtb'
setenv mmc_part_boot_b 'setenv bootargs root=/dev/mmcblk0p${part} rootwait ; booti 0x48080000 - 0x48000000'
setenv mmc_1_boot 'setenv part 1 ; run mmc_part_boot_a mmc_part_boot_b'
setenv mmc_2_boot 'setenv part 2 ; run mmc_part_boot_a mmc_part_boot_b'
setenv mmc_3_boot 'setenv part 3 ; run mmc_part_boot_a mmc_part_boot_b'
setenv mmc_4_boot 'setenv part 4 ; run mmc_part_boot_a mmc_part_boot_b'
saveenv

Commands to run:

=> run mmc_1_boot

Program BSP into 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 from eMMC

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


=> setenv part 2
=> setenv emmcp2_a 'setenv part 2'
=> setenv emmcp2_b 'mmc dev 0 ; ext4load mmc 0:${part} 0x48080000 /boot/Image ; ext4load mmc 0:${part} 0x48000000 /boot/r9a07g044l2-smarc.dtb'
=> setenv emmcp2_c 'setenv bootargs root=/dev/mmcblk0p${part} rootwait'
=> setenv emmcp2_d 'booti 0x48080000 - 0x48000000'
=> setenv emmcp2 'run emmcp2_a emmcp2_b emmcp2_c emmcp2_d'
=> saveenv

USB Mass Storage (ums) in u-boot

H/W sections => ums usb0 mmc0.1 => ums usb0 mmc0.1

Partitions => ums usb0 mmc 0:2