From 2f83f219bfd42bc6ac54689cf4189bd239ed41fe Mon Sep 17 00:00:00 2001 From: Jassi Brar Date: Fri, 6 Apr 2018 12:05:09 +0530 Subject: fastboot: sparse: make write_sparse_image useable for non-fastboot write_sparse_image could be useful for non-fastboot users. For ex a platform, without usb-device/fastboot support, could get sparse images over tftp and write using the mmc command. Or non-android systems could also leverage the sparse format. Towards that, this patch removes anything fastboot specific from the write_sparse_image implementation. Which includes making the function return integer as error code and calls for fastboot logging via an optional callback function 'mssg'. Signed-off-by: Jassi Brar --- common/fb_nand.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'common/fb_nand.c') diff --git a/common/fb_nand.c b/common/fb_nand.c index d7d9eb08f69..c07655e49ed 100644 --- a/common/fb_nand.c +++ b/common/fb_nand.c @@ -174,12 +174,15 @@ void fb_nand_flash_write(const char *cmd, void *download_buffer, sparse.size = part->size / sparse.blksz; sparse.write = fb_nand_sparse_write; sparse.reserve = fb_nand_sparse_reserve; + sparse.mssg = fastboot_fail; printf("Flashing sparse image at offset " LBAFU "\n", sparse.start); sparse.priv = &sparse_priv; - write_sparse_image(&sparse, cmd, download_buffer); + ret = write_sparse_image(&sparse, cmd, download_buffer); + if (!ret) + fastboot_okay(""); } else { printf("Flashing raw image at offset 0x%llx\n", part->offset); -- cgit v1.2.3