Flashing a 400Mb sparse system image takes ~10 minutes. The fastboot UDP
protocol expects a response within 1 minute, so during long flash
operations, the device must send fastboot "INFO" packets.
This patch does the following:
- Separate large writes into writes of size FASTBOOT_MAX_BLK_WRITE.
This parameter was tuned by hand to result in a ~10 second write.
- Keep a timer and send an INFO packet every 30 seconds.
- Adjust the sequence number in the header of the fastboot OKAY packet
to account for any INFO packets sent during flashing.
- Reduce busywaiting in the bcm2835 MMC driver. This change is based on
what the kernel does, and doesn't seem to corrupt the MMC. Without
this change, "flashall" takes 25 minutes.
Bug: 31887729
Test: "fastboot -s udp:$RPI_IP flashall" works, rpi3 boots
- Compute CRC checksum over every write to verify written data
was not corrupted.
Change-Id: Ib17ef6a85715705a8b5f722a8b7d3e5fd1a6625d
Add function to respond to fastboot flash and erase. Flash writes the
previously downloaded image to indicated partition. Erase clears the
indicated partition. fb_flash and fb_erase are essentially wrappers
for fb_mmc_flash_write and fb_mmc_erase, which are implemented in
common/fb_mmc.c.
Added common/fb_common.c, where fastboot_okay/fail are implemented.
common/fb_mmc.c assumes fasboot_okay() and fastboot_fail() are
implemented, but they were tied to the fastboot USB implementation.
This refactor adds the response string as a parameter to
fastboot_okay/fail, instead of modifying a global.
Bug: 31887729
Test: FLASH:
- Create file "foo" containing 2048 chars = "-"
- Start "fastboot udp" on device and run
"fastboot -s udp:$RPI_IP flash misc foo" from host
- From U-boot console, read into memory the first 4 blocks from
misc partition, observe each byte is "-".
ERASE
- Start "fastboot udp" on device and run
"fastboot -s udp:$RPI_IP erase misc" from host
- From U-boot console, read into memory many blocks from misc
partition, observe each byte is 0x00
Configs that use fastboot USB implementation still build.
Change-Id: I5bd54868990bd9d5736d0969b3db240c2926eeec