JianyuWang0623 opened a new pull request, #3997:
URL: https://github.com/apache/nuttx-apps/pull/3997
## Summary
Publish getvar's integer variables by reference, raise the default
download buffer to 64 KiB, and overlap flash writes with the next
download on a worker thread.
## Impact
- max-download-size halves (the download buffer is split in two for
the overlapped writes), and a flash write failure is now reported on
the response to the next command rather than the one that triggered
the write.
- The default SYSTEM_FASTBOOTD_DOWNLOAD_MAX changes from 40960 to
65536, adding 24 KiB of download buffer on every board that enables
CONFIG_SYSTEM_FASTBOOTD, so the halved size (32768) stays above what
older host fastboot (libsparse 1:10.0.0+r36) needs to split an
ordinary image.
## Testing
Internal measurement on the board this was developed on, flashing a
32 MiB image to eMMC over USB high speed in 131 segments of 256 KiB,
same max-download-size before and after:
| | Sending | Writing | Total | Throughput |
|---|---|---|---|---|
| before | 1.04 s | 1.36 s | 2.80 s | 11.4 MiB/s |
| after | 1.05 s | 0.27 s | 1.40 s | 22.8 MiB/s |
Build Host: Ubuntu 22.04.5 LTS x86_64; xtensa-esp32s3-elf-gcc
(crosstool-NG esp-12.2.0_20230208) 12.2.0; Arm GNU Toolchain 13.2.rel1
aarch64-none-elf-gcc 13.2.1; QEMU 6.2.0 (Debian 1:6.2+dfsg-2ubuntu6.31)
Target: lckfb-szpi-esp32s3:fastboot_usb, with CONFIG_ESP32S3_SPIFLASH=y
to expose /dev/mtdblock0; SYSTEM_FASTBOOTD_DOWNLOAD_MAX left at the
Kconfig default
```
$ fastboot -s 1234 getvar max-download-size
max-download-size: 32768
Finished. Total time: 0.001s
$ fastboot -s 1234 flash mtdblock0 fb_200k.bin
Invalid sparse file format at header magic
Sending sparse 'mtdblock0' 1/8 (28 KB) OKAY [ 0.033s]
Writing 'mtdblock0' OKAY [ 0.001s]
...
Sending sparse 'mtdblock0' 8/8 (4 KB) OKAY [ 0.037s]
Writing 'mtdblock0' OKAY [ 0.372s]
Finished. Total time: 3.057s
```
A `download:` request larger than max-download-size is rejected with
`FAILData too large`, and the device keeps responding afterwards.
Target: qemu-armv8a:fastboot (TCP transport, default defconfig)
```
$ qemu-system-aarch64 -cpu cortex-a53 -nographic -machine
virt,virtualization=on,gic-version=3 -global virtio-mmio.force-legacy=false
-netdev user,id=u1,hostfwd=tcp:127.0.0.1:15554-:5554 -device
virtio-net-device,netdev=u1,bus=virtio-mmio-bus.0 -kernel ./nuttx
nsh> fastbootd &
nsh> mkrd -m 1 -s 512 400
$ fastboot -s tcp:127.0.0.1:15554 getvar max-download-size
max-download-size: 32768
Finished. Total time: 0.002s
$ fastboot -s tcp:127.0.0.1:15554 flash ram1 fb_200k.bin
Invalid sparse file format at header magic
Sending sparse 'ram1' 1/8 (28 KB) OKAY [ 0.048s]
Writing 'ram1' OKAY [ 0.005s]
...
Sending sparse 'ram1' 8/8 (4 KB) OKAY [ 0.046s]
Writing 'ram1' OKAY [ 0.003s]
Finished. Total time: 0.418s
```
The whole 204800-byte ramdisk, read back over fastboot after the flash,
matches the source image (same sha256).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]