[U-Boot-Users] usb write command available in u-boot??

Ken.Fuchs at bench.com Ken.Fuchs at bench.com
Tue May 13 21:18:08 CEST 2008


> In u-boot under common/cmd_usb.c there are commands for
>                 usb info , usb tree, usb reset, 
> 
> I can find usb read command also
> 
> There is no command for usb write

Since a bootloader loads things from boot devices as opposed
writing things to boot devices, it makes sense that there would
be no write command to boot devices.

> Is there is possibility to do a usb write command (eg .. writing some
> data into the flash memory stick)  in u-boot level??

Absolutely, but it is potentially dangerous to do.

Raw writes of disk images or individual filesystems may be a
reasonable thing to do and should require only modest changes
to support.  Only a block write function would need to be added.
This is especially useful if the device is soldered to the board
and there is no other way to write the data to the device.

Does anyone have a soldered-on USB storage device?

Crazy data transfer idea:

For simple data transfer, it may be possible to allocate a file
on a FAT16 filesystem that uses exactly one cluster and determine
the block address of that cluster and instruct U-Boot to write
only to that cluster.  This would mean that a cluster could be
written in raw mode via U-Boot and on another system read as a
FAT16 file.  The file length would always be a full cluster in
size, so the file would need to be copied and truncated to the
proper length on the host system.  Again, on U-Boot this would
require only the addition of a block write function.

Writing files to filesystems via U-Boot:

The filesystem support in U-Boot is designed to function in a
read-only mode, but the code is probably based on a read/write
Linux driver, so it may not be that difficult to change to
support write functions.  The filesystems would need to support
file creation, data over-write and file append functions, at a
minimum.

This would require more work than it would be worth, in my
opinion.  But a block write function would be useful for some
(soldered on) devices, if not USB storage.

Sincerely,

Ken Fuchs




More information about the U-Boot mailing list