Difference between revisions of "Zero/dev/usb-mass-storage"
m (fix typo) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 17: | Line 17: | ||
** To access Radxa Zero | ** To access Radxa Zero | ||
− | === | + | === Enable USB mass storage on Radxa Zero === |
− | + | ||
− | + | ||
− | + | Step 0: Make sure that kernel version is at least version 5.10.69-6-amlogic. Otherwise, you can upgrade the kernel with the following commands: | |
− | + | ||
− | + | ||
− | + | ||
− | Step | + | |
rock@zero:~$ sudo apt update | 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 linux-headers-5.10.69-6-amlogic-g775a46783ad8 | ||
− | rock@zero:~$ sudo apt install -y | + | rock@zero:~$ sudo apt install -y linux-image-5.10.69-6-amlogic-g775a46783ad8 |
+ | |||
+ | Step 1: Disable amlogic-adbd service. It will interfere with USB mass storage mode: | ||
+ | |||
+ | rock@zero:~$ sudo systemctl disable amlogic-adbd | ||
+ | |||
+ | Step 2: Reboot the device: | ||
− | |||
rock@zero:~$ sudo reboot | rock@zero:~$ sudo reboot | ||
− | Step 3: Create a file | + | Step 3: Create a file backing for mass storage, and format it in FAT32: |
− | 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 dd if=/dev/zero of=/home/rock/share bs=1M count=512 status=progress # Create a 512M file as /home/rock/share |
+ | rock@zero:~$ sudo apt-get install dosfstools # dosfstools contains mkfs.fat | ||
rock@zero:~$ sudo mkfs.fat /home/rock/share -F 32 -I | rock@zero:~$ sudo mkfs.fat /home/rock/share -F 32 -I | ||
− | Step 4: Enable | + | Step 4: Enable USB mass storage on our backing file and create test.txt file: |
+ | |||
rock@zero:~$ sudo modprobe g_mass_storage file=/home/rock/share stall=0 removable=1 | 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 mount /home/rock/share /mnt/ | ||
Line 48: | Line 49: | ||
hello radxa | hello radxa | ||
− | === | + | === Accessing storage device from Ubuntu PC === |
− | After executing command | + | After executing command <code>sudo modprobe g_mass_storage file=/home/rock/share stall=0 removable=1</code> on Radxa Zero, a new USB storage device will be detected on your host computer: |
− | + | ||
− | $ lsblk | + | radxa@x86-64:~$ lsblk |
... | ... | ||
sdd 8:48 1 512M 0 disk /media/radxa/5A81-B2F | sdd 8:48 1 512M 0 disk /media/radxa/5A81-B2F | ||
... | ... | ||
− | Here we have to remount the share space | + | Here we have to remount the share space: |
− | radxa@ | + | radxa@x86-64:~$ sudo umount /media/radxa/5A81-B2F |
− | radxa@ | + | radxa@x86-64:~$ sudo mount /dev/sdd /mnt/ |
− | radxa@ | + | radxa@x86-64:~$ cd /mnt/ |
− | radxa@ | + | radxa@x86-64:/mnt$ ls |
test.txt | test.txt | ||
− | radxa@ | + | radxa@x86-64:/mnt$ cat test.txt |
hello radxa | hello radxa | ||
− | |||
− | |||
− | |||
− |
Latest revision as of 04:44, 27 May 2022
Radxa Zero > Development > USB Mass Storage
Contents
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
Enable USB mass storage on Radxa Zero
Step 0: Make sure that kernel version is at least version 5.10.69-6-amlogic. Otherwise, you can upgrade the kernel with the following commands:
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 linux-image-5.10.69-6-amlogic-g775a46783ad8
Step 1: Disable amlogic-adbd service. It will interfere with USB mass storage mode:
rock@zero:~$ sudo systemctl disable amlogic-adbd
Step 2: Reboot the device:
rock@zero:~$ sudo reboot
Step 3: Create a file backing for mass storage, and format it in FAT32:
rock@zero:~$ sudo dd if=/dev/zero of=/home/rock/share bs=1M count=512 status=progress # Create a 512M file as /home/rock/share rock@zero:~$ sudo apt-get install dosfstools # dosfstools contains mkfs.fat rock@zero:~$ sudo mkfs.fat /home/rock/share -F 32 -I
Step 4: Enable USB mass storage on our backing 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
Accessing storage device from Ubuntu PC
After executing command sudo modprobe g_mass_storage file=/home/rock/share stall=0 removable=1
on Radxa Zero, a new USB storage device will be detected on your host computer:
radxa@x86-64:~$ lsblk ... sdd 8:48 1 512M 0 disk /media/radxa/5A81-B2F ...
Here we have to remount the share space:
radxa@x86-64:~$ sudo umount /media/radxa/5A81-B2F radxa@x86-64:~$ sudo mount /dev/sdd /mnt/ radxa@x86-64:~$ cd /mnt/ radxa@x86-64:/mnt$ ls test.txt radxa@x86-64:/mnt$ cat test.txt hello radxa