Skip to content

Commit b712670

Browse files
committed
snagflash: fastboot: remove "truncated flash" check
As reported by #85, flashing a wic image generated by Yocto using fastboot-uboot mode trigger an error when sending the last image chunk to the target: ValueError: Truncated flash, only 82944 bytes were flashed instead of 86016 bytes The same issue is reproduced on another platform (SK-TDA4VM). [INFO] Flashing to MMC device... [DEBUG] setting MMC device to 1 [DEBUG] fastboot OKAY [DEBUG] range start 0x88100000 read size 0x2000 [DEBUG] send size 0x2000 dst offset 0x88100000 [DEBUG] fastboot DATA length: 8192 [INFO] fastboot OKAY [DEBUG] fastboot OKAY [INFO] flashed 8192/8192 bytes [INFO] Flashing sparse range 12/13 [INFO] Flashing to MMC device... [DEBUG] setting MMC device to 1 [DEBUG] fastboot OKAY [DEBUG] range start 0x936e0000 read size 0x1c000 [DEBUG] send size 0x1b800 dst offset 0x936e0000 <<< here we have "send size" < "read size" [DEBUG] fastboot DATA length: 112640 [INFO] fastboot OKAY [DEBUG] fastboot OKAY [INFO] flashed 112640/114688 bytes [DEBUG] range start 0x936fb800 read size 0x800 ValueError: Truncated flash, only 112640 bytes were flashed instead of 114688 bytes 0x936fb800 is actually the size of the wic file (2473572352). This value is verified by the ImageSize value in .bmap file. <!-- Image size in bytes: 2.3 GiB --> <ImageSize> 2473572352 </ImageSize> So it means that flash_range() reached the end of the file: blob = file.read(read_size) bytes_read = len(blob) if bytes_read == 0: break That's why "read size" != "send size" in the Snagflash debug log, file.read() returned less than requested data. Removing the bmap file allows to workaround this issue. This bug was introduced in Snagboot 2.6 when the "flashing with unspecified file sizes" feature was added. Indeed, a new "truncated flash" check was added but it expect that the image file is aligned with a bmap block. This not alway the case. Remove this "truncated flash" check since Snagflash correctly flash the end of the file. Fixes: d499ae2 ("snagflash: fb-uboot: Allow flashing with unspecified file sizes") Fixes #85 Signed-off-by: Romain Naour <romain.naour@smile.fr>
1 parent 99a7409 commit b712670

1 file changed

Lines changed: 0 additions & 5 deletions

File tree

src/snagflash/fastboot_uboot.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,6 @@ def flash_range(
318318
f"flashed {file_bytes_flashed}/{file_size if file_size < sys.maxsize else '?'} bytes"
319319
)
320320

321-
if file_size < sys.maxsize and file_bytes_flashed < file_size:
322-
raise ValueError(
323-
f"Truncated flash, only {file_bytes_flashed} bytes were flashed instead of {file_size} bytes"
324-
)
325-
326321
def flash_mtd_section(
327322
self,
328323
fb_addr: int,

0 commit comments

Comments
 (0)