Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

Zero/dev/usb-mass-storage

< Zero‎ | dev
Revision as of 08:58, 28 October 2021 by Stephen (Talk | contribs)

    Radxa Zero >  Development >  USB Mass Storage

Description

This guide describes how to setup USB Mass Storage on Radxa Zero.

Requirement

  • Radxa Zero
  • Host PC with Ubuntu
  • USB Male A to C or USB C to C cable
    • The USB cable is used for powering the Radxa Zero as well as data transmission from your host PC to the Zero. Depends on the USB port on host PC, you may need USB A to C(host PC is USB A) or USB C to C(host PC is USB C) cable.
  • Mouse, monitor and HDMI Cable
    • To access Radxa Zero
  • USB to TTL serial cable
    • To access Radxa Zero

Support

Support hardware platform:

  • All Radxa Zero

You'd better follow the installation steps.

Operations on Radxa Zero

Step 1: Make sure that kernel version is at least version 5.10.69-6-amlogic. Otherwise, do the following steps to upgrade kernel.

rock@zero:~$ sudo apt update
rock@zero:~$ sudo apt install -y linux-headers-5.10.69-6-amlogic-g775a46783ad8
rock@zero:~$ sudo apt install -y inux-image-5.10.69-6-amlogic-g775a46783ad8

Step 2: Reboot the device.

rock@zero:~$ sudo reboot

Step 3: Create a file to be a shared space and make it FAT32 type.

rock@zero:~$ sudo dd if=/dev/zero of=/home/rock/share bs=1M count=512 status=progress
rock@zero:~$ sudo apt-get install dosfstools
rock@zero:~$ sudo mkfs.fat /home/rock/share -F 32 -I

Step 4: Enable usb mass storage with the file and create test.txt file.

rock@zero:~$ sudo modprobe g_mass_storage file=/home/rock/share stall=0 removable=1
rock@zero:~$ sudo mount /home/rock/share /mnt/
rock@zero:~$ sudo touch  /mnt/test.txt
rock@zero:~$ echo "hello radxa" | sudo tee /mnt/test.txt
hello radxa
rock@zero:~$ cat /mnt/test.txt
hello radxa

Operations on Ubuntu PC

After executing command sudo modprobe g_mass_storage file=/home/rock/share stall=0 removable=1" on Radxa Zero, we would see that one device is mounted. That one is Radxa Zero share space.

$ lsblk
...
sdd           8:48   1   512M  0 disk /media/radxa/5A81-B2F
...

Here we have to remount the share space.

radxa@focal:~$ sudo umount /media/radxa/5A81-B2F
radxa@focal:~$ sudo mount /dev/sdd /mnt/
radxa@focal:~$ cd /mnt/
radxa@focal-:/mnt$ ls
test.txt
radxa@focal:/mnt$ cat test.txt
hello radxa

Troubleshooting