How to use USB mass storage in U-Boot

Revision as of 12:17, 25 July 2019 by Patrick Delaunay (talk | contribs) (cleanup noinclude)

This page explains how to use the U-Boot command "ums" to update an SD card or eMMC on the device.

1 ums command[edit]

In U-Boot, you can directly export the available block devices (sd/mmc/usb) as USB mass storage devices with ums command:

 Board $> help ums
 ums - Use the UMS [USB Mass Storage]
 ums <USB_controller> [<devtype>] <dev[:part]>  e.g. ums 0 mmc 0
     devtype defaults to mmc

This U-Boot command "ums" is infinite (a loop in USB treatments), and the U-Boot console is blocked until user enters a Ctrl-C.

2 Exporting a block device[edit]

On ST boards, the OTG USB controller device index is 0, SD card = "mmc 0" and, when available, eMMC = "mmc 1".
You can check the device connected on an SDMMC with the U-Boot command "mmc info".

You can also export a USB device connected to the USB host controller (USBH) = "usb 0".

Then execute one of the following commands:

 Board $> ums 0 mmc 0 --> start ums on SD card
 Board $> ums 0 mmc 1 --> start ums on eMMC
 Board $> usb start   --> start USB host controller
 Board $> ums 0 usb 0 --> start ums on USB device 0 (USB key for example)
 Board $> usb stop    --> stop USB host controller

After a delay (of up to 15 seconds), the host sees the exported block device and you can use any command on the PC to access the partitions of the exported memory (dd, mount, cp, rsync). A Ctrl-C is needed to stop the command.

See also How to update U-Boot on an SD card.