Using U-Boot to update your Device

In U-Boot, there is a command gzwritefile to write a compressed image to a block device. It can be used to update an internal eMMC as well as a (micro-) SD card. The syntax is:

gzwritefile <target interface> <target device> <source interface> <source device> <filename> [<buffersize> [<force>]]

Where:

  • target interface is the interface the device to write to is connected (usualy mmc)

  • target device is the device and partition number to write to in syntax device[.partition], if the partition is omitted the whole device is used

  • source interface is the interface the source device is connected to

  • source device is a device to read from

  • filename is the image file to write

  • buffersize (optional) is the size of the buffer to use if omitted 1MB will be used

  • force (optional) will write the file even if it does not fit the target device

Examples:

gzwritefile mmc 0 usb 0 myimage.imz

will write the compressed image myimage.imz from the 1st usb-storage to the 1st mmc-device.

gzwritefile mmc 0.1 mmc 1 myimage.imz

will write the compressed image myimage.imz from an external SD-card to the 2nd partition of the internal eMMC

will write the compressed image myimage.imz from the 1st usb-storage to the 1st mmc-device even if it will not fit using a 1MB buffer. The buffer-size of 1MB is the default, but must be given make the force-parameter be at the right place.

Automated Installation/Update using U-Boot

The U-Boot command gzwritefile can be used in conjunction with the U-Boot-Autoboot mechanism to automatically install an image file to a device. Create an autoboot.bat file like this:

Change the line

to match the filename of your image and place it, together with your image, in the root-directory of an USB-Stick. Plug it into your device and power it on. On startup U-Boot will scan the connected USB-devices, find the file, recognize it as an autostart-file (by it's name and the magic header #!autoboot.bat) and execute it's contents as a script.

You can also place your image in a subdirectory and change the line

to