libsparse: add sparse_file read and convert tools to use it
Abstract the logic from simg2img into libsparse, and add logic
for reading a regular image into libsparse. simg2img then
becomes a simple wrapper around libsparse.
img2simg was not actually making the file sparse, it was using
sparse files to create multiple files that could be pieced back
together. Replace it with a simple wrapper around libsparse.
Its functionality will be replaced by an simg2simg that can
resparse a file into smaller chunks.
Change-Id: I266f70e1c750454183ce46c71a7bb66bbb033a26
diff --git a/libsparse/Android.mk b/libsparse/Android.mk
index d3eeae6..e83ee1c 100644
--- a/libsparse/Android.mk
+++ b/libsparse/Android.mk
@@ -7,7 +7,8 @@
output_file.c \
sparse.c \
sparse_crc32.c \
- sparse_err.c
+ sparse_err.c \
+ sparse_read.c
include $(CLEAR_VARS)
@@ -48,6 +49,7 @@
sparse_crc32.c
LOCAL_MODULE := simg2img
LOCAL_MODULE_TAGS := debug
+LOCAL_STATIC_LIBRARIES := libsparse libz
include $(BUILD_HOST_EXECUTABLE)
@@ -57,6 +59,7 @@
sparse_crc32.c
LOCAL_MODULE := simg2img
LOCAL_MODULE_TAGS := optional
+LOCAL_STATIC_LIBRARIES := libsparse libz
include $(BUILD_EXECUTABLE)
@@ -65,6 +68,7 @@
LOCAL_SRC_FILES := img2simg.c
LOCAL_MODULE := img2simg
LOCAL_MODULE_TAGS := debug
+LOCAL_STATIC_LIBRARIES := libsparse libz
include $(BUILD_HOST_EXECUTABLE)
@@ -73,6 +77,7 @@
LOCAL_SRC_FILES := img2simg.c
LOCAL_MODULE := img2simg
LOCAL_MODULE_TAGS := optional
+LOCAL_STATIC_LIBRARIES := libsparse libz
include $(BUILD_EXECUTABLE)