FS#63370 - [android-tools] Flashing image leads to assertion error
Attached to Project:
Community Packages
Opened by Philipp Klein (kleinph) - Monday, 05 August 2019, 08:16 GMT
Last edited by Anatol Pomozov (anatolik) - Monday, 14 October 2019, 22:58 GMT
Opened by Philipp Klein (kleinph) - Monday, 05 August 2019, 08:16 GMT
Last edited by Anatol Pomozov (anatolik) - Monday, 14 October 2019, 22:58 GMT
|
Details
Description:
Trying to flash a boot image leads to an assertion. Additional info: * android-tools-29.0.2-1 * target device: Xiaomi Mi A2 Lite Steps to reproduce: fastboot flash boot magisk_patched_boot_10.0.10.0.img > fastboot: core/libsparse/sparse.cpp:131: int write_all_blocks(struct sparse_file *, struct output_file *): Assertion `pad >= 0' failed. Doing the same with android-tools-9.0.0_r45-1 works fine. |
This task depends upon
Closed by Anatol Pomozov (anatolik)
Monday, 14 October 2019, 22:58 GMT
Reason for closing: Fixed
Additional comments about closing: 29.0.4-2
Monday, 14 October 2019, 22:58 GMT
Reason for closing: Fixed
Additional comments about closing: 29.0.4-2
android-tools-9.0.0_r45-1 works fine.
rolled back to android-tools-9.0.0_r45-1 and it works.
Go not to the elves for counsel, for they will say both yes and no.
-- J.R.R. Tolkien
```
fastboot version 29.0.2-5738569 from current https://aur.archlinux.org/packages/android-sdk-platform-tools/ indeed works fine (thanks @braderhart for the tip!).
Try something like:
sudo fastboot boot /path/of/file.img
Remember you must unlock the OEM before.
fastboot: core/libsparse/sparse.cpp:131: int write_all_blocks(struct sparse_file *, struct output_file *): Assertion `pad >= 0' failed.
flash_all.sh: line 7: 7682 Aborted (core dumped) fastboot $* flash sbl1 `dirname $0`/images/sbl1.mbn
Flash sbl1 error
sorry i could not be more verbose. already doing the best i can
https://android-review.googlesource.com/c/platform/system/core/+/729604/13/fastboot/fastboot.cpp#778
This looks like a suspicious change, particularly since sparse_file_import_auto seems to treat even non-sparse files as "sparse" in some way (as opposed to sparse_file_import, which checks for sparse magic header value before proceeding).
I'm trying to flash a Pixel 3 image, which requires platform tools 28.0.2+, which was released August 2018 - conveniently right before this change.
EDIT: Cross-reference: https://issuetracker.google.com/issues/140538105
#!/bin/bash
block_size=4096
filename="$1"
filesize=$(stat --format=%s "$filename")
block_count=$(( ($filesize + $block_size - 1) / $block_size ))
aligned_size=$(( $block_count * $block_size ))
padding_len=$(( $aligned_size - $filesize ))
dd if=/dev/zero of="$filename-padding" bs=1 count=$padding_len
cat $filename "$filename-padding" > "$filename-padded"
Tested with stock recovery image of HTC U11 (ocndugl).
if its any help, i flash phone's stock rom firmware using the flash command, resulting in an error. weirdly the fastboot command works.
also the link for the firmware file is: http://bigota.d.miui.com/V10.2.3.0.OEGMIXM/vince_global_images_V10.2.3.0.OEGMIXM_20190701.0000.00_8.1_global_82d73c7f78.tgz
The attached file is a patch for PKGBUILD. It pulls the commit from the aforementioned pull request.
android-tools-29.0.3-2 with the upstream fix been pushed to [testing]. Please update the system and let me know if this bug is fixed for you now.
fastboot version 29.0.4-1
Installed as /usr/bin/fastboot
fastboot: core/libsparse/sparse.cpp:131: int write_all_blocks(struct sparse_file *, struct output_file *): Assertion `pad >= 0' failed.
[1] 64679 abort (core dumped) fastboot flash recovery twrp-3.3.1-0-oneplus3.img
fastboot flash recovery twrp-3.3.1-0-oneplus3.img-padded
Sending 'recovery' (27532 KB) OKAY [ 0.721s]
Writing 'recovery' OKAY [ 0.202s]
Finished. Total time: 0.965s
Anatol Pomozov, could you consider reverting the removal of the patch in [2]?
[1] https://github.com/aosp-mirror/platform_system_core/compare/platform-tools-29.0.3...platform-tools-29.0.4
[2] https://git.archlinux.org/svntogit/community.git/commit/trunk?h=packages/android-tools&id=a5e739c82f44038f23eaea47de8e24b80c70efd5
I am pushing 29.0.4-2 to [community-testing]. Please let me know if you see any issues with it.