1. When you select file by the Firmware update menu in your STB then system execute equivalent of following script:

setenv usb_upgrade 1
setenv usb_upgrade_path SELECTED_FILE.bin

2. System reboots

3. U-BOOT checks crc32 and loads firmware file to memory at address 0x80000000

4. First 4096 (0x1000) bytes of upgrade file is script (in plain text padded to 4096 bytes by zeroes) which is executed after loading to memory. For example:

cusid 169b 1 1
spi_wrc 0x80001000 0 2f2b80
setenv usb_complete 1
setenv usb_upgrade 0
setenv bootcmd ' spi_rdc 0x80b00000 0x8000c 0x272a61; LzmaDec 0x80b00000 0x270b61 0x80000180 0x81000000; go 0x80000224;

In this exaple key line is: spi_wrc 0x80001000 0 2f2b80

spi_wrc <maddr> <faddr> <size> command writes memory content at address <maddr> to flash at offset <faddr>. Size is exact size of binary (without crc32 and script).

So basically upgrade file structure is following:

Content Size
Upgrade script 4096 bytes
Upgrade binary vary
CRC32 of script+binary 4 bytes
Community content is available under CC-BY-SA unless otherwise noted.