Skip to content
Chris Brandt edited this page Oct 18, 2024 · 5 revisions

USB Mass Storage (ums) in u-boot

H/W sections

=> ums usb0 mmc0.1

Partitions

=> ums usb0 mmc 0:1
=> ums usb0 mmc 0:2
=> ums usb0 mmc 0:3
=> ums usb0 mmc 0:4

Boot from eMMC

=> setenv file_kernel 'Image'
=> setenv file_dt 'r9a07g044l2-smarc.dtb' # RZ/G2L
=> setenv file_dt 'r9a08g045s33-smarc.dtb' # RZ/G3S
=> saveenv


=> setenv mmc_a 'mmc dev 0 ; ext4load mmc 0:${part} 0x48080000 /boot/${file_kernel} ; ext4load mmc 0:${part} 0x48000000 /boot/${file_dt}'
=> setenv mmc_b setenv 'bootargs root=/dev/mmcblk0p${part} rootwait'
=> setenv mmc_c 'booti 0x48080000 - 0x48000000'
=> setenv mmcp1 'setenv part 1 ; run mmc_a mmc_b mmc_c'
=> setenv mmcp2 'setenv part 2 ; run mmc_a mmc_b mmc_c'
=> setenv mmcp3 'setenv part 3 ; run mmc_a mmc_b mmc_c'
=> setenv mmcp4 'setenv part 4 ; run mmc_a mmc_b mmc_c'
=> saveenv

run mmcp1  # boot from eMMC partition 1
run mmcp2  # boot from eMMC partition 2
run mmcp3  # boot from eMMC partition 3
run mmcp5  # boot from eMMC partition 4

Show root of each partition

# SD Card
setenv sd_list 'echo partition 2 ; ls mmc 1:2 / ; echo partition 3 ; ls mmc 1:3 / ; echo partition 4 ; ls mmc 1:4 /'
saveenv
run sd_list

=> echo partition 2 ; ls mmc 1:2 / ; echo partition 3 ; ls mmc 1:3 / ; echo partition 4 ; ls mmc 1:4 /

# eMMC Flash
=> echo partition 1 ; ls mmc 0:1 / ; partition 2 ; ls mmc 0:2 / ; echo partition 3 ; ls mmc 0:3 / ; echo partition 4 ; ls mmc 0:4 /
=> setenv mmc_list '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 mmc_list

Format eMMC as ext4 (4 partitions)

First boot using initramfs, SD card or USB Flash drive.

fdisk /dev/mmcblk0

m for help

# delete any existing partition
d

# make 4 primary ext4 partitions, 4GB each. (can make them only 2GB to make them format faster)
n  p  1  {enter} +4G
n  p  2  {enter} +4G
n  p  3  {enter} +4G
n  p     {enter} +4G     << 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