Skip to main content

uSD cards

The SOM Carrier Board have a uSD slot for external memory cards that can be used for persistent storage or too boot from.

BoardU-BootLinux
RZ/G3E SOMmmc dev 1/dev/mmcblk1

A uSD memory card is required.

U-Boot

The U-Boot has support for reading/writing memory cards.

Select device and show information

mmc rescan
mmc dev 1
mmc info
Device: mmc@15c10000
Manufacturer ID: 1b
OEM: 534d
Name: JB1Q5
Bus Speed: 50000000
Mode: SD High Speed (50MHz)
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: 29.8 GiB
Bus Width: 4-bit
Erase Group Size: 512 Bytes

List content

If the card has a FAT file system:

fatls mmc 0
 1491 btngraph.gif
1396 btnlast.jpg
1266 btnminus.gif
1049 btnnext.jpg
1375 btnplus.gif

If the card has an EXT4 file system (typically when the uSD card holds the rootfs) and you want to see the content of the boot folder on partition 2:

ext4ls mmc 0:2
<DIR>       4096 .
<DIR> 4096 ..
<DIR> 16384 lost+found
<SYM> 7 bin
<DIR> 4096 boot
<DIR> 4096 dev
<DIR> 4096 etc
<DIR> 4096 home
<SYM> 7 lib
<DIR> 4096 media
<DIR> 4096 mnt
<DIR> 4096 proc
<DIR> 4096 root
<DIR> 4096 run
<SYM> 8 sbin
<DIR> 4096 srv
<DIR> 4096 sys
<DIR> 4096 tmp
<DIR> 4096 usr
<DIR> 4096 var

Linux

If you boot from the uSD card

If you boot from the uSD then be very careful with what you do so that the root file system is not damaged.

Available disk space

df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root 28.0G 990.1M 25.6G 4% /
devtmpfs 1.6G 0 1.6G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 761.1M 10.3M 750.8M 1% /run
tmpfs 1.9G 0 1.9G 0% /tmp
tmpfs 1.9G 12.0K 1.9G 0% /var/volatile
tmpfs 380.5M 4.0K 380.5M 0% /run/user/0

Create a file

echo Hello > greeting

Show content of a file

cat greeting
Hello

List files

ls -la
drwxr-xr-x   2 root    root      1024 Sep 23 15:25 .
drwxr-xr-x 3 root root 1024 Sep 23 14:52 ..
-rw-r--r-- 1 root root 12 Sep 23 15:25 greeting

If you don't boot from the uSD card

A new memory card will be detected automatically when it is inserted and a message like this one will be printed in the console.

mmc1: new ultra high speed SDR104 SDHC card at address 59b4
mmcblk1: mmc1:59b4 JB1Q5 29.8 GiB
mmcblk1: p1 p2

To use the memory card it must first be mounted.

mkdir /mnt/sdcard
mount /dev/mmcblk1p2 /mnt/sdcard

The card is now mounted.

df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root 28.0G 990.1M 25.6G 4% /
devtmpfs 1.6G 0 1.6G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 761.1M 10.3M 750.8M 1% /run
tmpfs 1.9G 0 1.9G 0% /tmp
tmpfs 1.9G 12.0K 1.9G 0% /var/volatile
tmpfs 380.5M 4.0K 380.5M 0% /run/user/0
/dev/mmcblk1p2 27.5G 975.4M 25.3G 4% /mnt/sdcard

List the content.

ls /mnt/sdcard
bin         etc         lost+found  mnt_usb     run         sys         var
boot home media proc sbin tmp
dev lib mnt root srv usr

A good way to stress test the card is to copy a large file to the sdcard and compute a checksum of it (this should be done on a PC with a known good sdcard reader). It is then possible to calculate that checksum again on the target and make sure it matches.

md5sum /mnt/blob.bin
790bfdcdfac22a08ff27450d60be8a8f /mnt/blob.bin

As with the USB memory stick, don't forget to unmount it before physically removing it from the carrier board.

umount /mnt/sdcard