#992127 fastboot fails to flash 2GB+ raw images on 32bit hosts

Package:
fastboot
Source:
android-platform-tools
Description:
Android fastboot tool
Submitter:
Marek Szyprowski
Date:
2021-08-12 11:30:03 UTC
Severity:
normal
#992127#5
Date:
2021-08-12 11:27:00 UTC
From:
To:
Dear Maintainer,

flashing a large (2GB+) RAW image with fastboot fails if tool is compiled
for 32bit host (x86 or arm) with the following error:

fastboot flash system_a rootfs.img
error: cannot load 'rootfs.img': Value too large for defined data type

This issue happens only when flashed image is in RAW format. So called
'android-sparse' images (simg) are handled properly even if they are
larger than 2GB.

I've added -D_FILE_OFFSET_BITS=64 to DEB_CPPFLAGS_MAINT_APPEND in
debian/rules and rebuild the deb package. Then it properly handles 2GB+
files on 32bit hosts, so this is a matter of using a proper large file
API in the source code. fastboot tool compiled for 64bit hosts (x86_64 or
arm64) handles such files without any problem.

Best regards,
Marek Szyprowski