summaryrefslogtreecommitdiff
path: root/lib/image-sparse.c
AgeCommit message (Collapse)Author
2024-02-09lib: sparse: Fix error checking for write_sparse_chunk_rawSean Anderson
The return value of write_sparse_chunk_raw is unsigned, so the existing check has no effect. Use IS_ERR_VALUE to detect error instead, which is what write_sparse_chunk_raw does itself. Fixes: 62649165cb0 ("lib: sparse: Make CHUNK_TYPE_RAW buffer aligned") Reported-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/u-boot/[email protected]/ Signed-off-by: Sean Anderson <[email protected]> Reviewed-by: Michael Trimarchi <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2023-12-21lib: Remove <common.h> inclusion from these filesTom Rini
After some header file cleanups to add missing include files, remove common.h from all files in the lib directory. This primarily means just dropping the line but in a few cases we need to add in other header files now. Reviewed-by: Simon Glass <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2023-10-31fastboot: fix CRC32 chunk size checkingWojciech Nizinski
genimage create android-sparse file with CRC32 chunk at end. When U-Boot's fastboot receives this chunk it returns error message: `Fail Bogus chunk size for chunk type Dont Care` According to reference implementation of Android's sparse file format: <https://android.googlesource.com/platform/system/core/+/refs/heads/main/ libsparse/output_file.cpp#513> the chunk_header.total_sz is CHUNK_HEADER_LEN + 4 (CRC32 size). Signed-off-by: Wojciech Nizinski <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Tested-by: Mattijs Korpershoek <[email protected]> # on vim3 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
2023-07-25lib: sparse: allocate FASTBOOT_MAX_BLK_WRITE instead of small numberMattijs Korpershoek
Commit 62649165cb02 ("lib: sparse: Make CHUNK_TYPE_RAW buffer aligned") fixed cache alignment for systems with a D-CACHE. However it introduced some performance regressions [1] on system flashing huge images, such as Android. On AM62x SK EVM, we also observe such performance penalty: Sending sparse 'super' 1/2 (768793 KB) OKAY [ 23.954s] Writing 'super' OKAY [ 75.926s] Sending sparse 'super' 2/2 (629819 KB) OKAY [ 19.641s] Writing 'super' OKAY [ 62.849s] Finished. Total time: 182.474s The reason for this is that we use an arbitrary small buffer (info->blksz * 100) for transferring. Fix it by using a bigger buffer (info->blksz * FASTBOOT_MAX_BLK_WRITE) as suggested in the original's patch review [2]. With this patch, performance impact is mitigated: Sending sparse 'super' 1/2 (768793 KB) OKAY [ 23.912s] Writing 'super' OKAY [ 15.780s] Sending sparse 'super' 2/2 (629819 KB) OKAY [ 19.581s] Writing 'super' OKAY [ 17.192s] Finished. Total time: 76.569s [1] https://lore.kernel.org/r/[email protected] [2] https://lore.kernel.org/r/all/[email protected]/ Fixes: 62649165cb02 ("lib: sparse: Make CHUNK_TYPE_RAW buffer aligned") Signed-off-by: Mattijs Korpershoek <[email protected]>
2022-01-14lib: sparse: Make CHUNK_TYPE_RAW buffer alignedqianfan Zhao
CHUNK_TYPE_RAW buffer is not aligned, and flash sparse images by fastboot will report "Misaligned operation" if DCACHE is enabled. Flashing Sparse Image CACHE: Misaligned operation at range [84000028, 84001028] CACHE: Misaligned operation at range [84001034, 84002034] CACHE: Misaligned operation at range [8401104c, 8401304c] Fix it Signed-off-by: qianfan Zhao <[email protected]> Reviewed-by: Sean Anderson <[email protected]>
2021-06-01fastboot: Fix overflow when calculating chunk sizeSean Anderson
If a chunk was larger than 4GiB, then chunk_data_sz would overflow and blkcnt would not be calculated correctly. Upgrade it to a u64 and cast its multiplicands as well. Also fix bytes_written while we're at it. Signed-off-by: Sean Anderson <[email protected]> Reviewed-by: Heiko Schocher <[email protected]>
2020-05-18common: Drop log.h from common headerSimon Glass
Move this header out of the common header. Signed-off-by: Simon Glass <[email protected]>
2020-05-18common: Drop part.h from common headerSimon Glass
Move this uncommon header out of the common header. Signed-off-by: Simon Glass <[email protected]>
2020-05-18common: Drop net.h from common headerSimon Glass
Move this header out of the common header. Network support is used in quite a few places but it still does not warrant blanket inclusion. Note that this net.h header itself has quite a lot in it. It could be split into the driver-mode support, functions, structures, checksumming, etc. Signed-off-by: Simon Glass <[email protected]>
2018-05-30mmc: Separate "mmc swrite" from fastbootAlex Kiernan
Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc swrite" command is separated from the fastboot code. Move image-sparse from common to lib so it's clear it's library code. Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE and migrate it to Kconfig. Signed-off-by: Alex Kiernan <[email protected]> Acked-by: Jassi Brar <[email protected]> Reviewed-by: Simon Glass <[email protected]>