Skip to content

Commit

Permalink
Build Android sparse image (simg) tools
Browse files Browse the repository at this point in the history
libsparse is already built for fastboot, so building the simg
tools only requires a few build rules to link the executables.

Adds the following tools: simgtoimg, img2simg, and append2simg.
  • Loading branch information
stephan-gh authored and nmeum committed Sep 21, 2019
1 parent bf68304 commit db84fde
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Currently the following tools are supported:
* adb
* fastboot
* mke2fs.android (required by fastboot)
* simg2img, img2simg, append2simg

The build system itself works quite well and is already being used for
the Alpine Linux [android-tools package][alpine-linux] which I maintain.
Expand Down
11 changes: 0 additions & 11 deletions vendor/CMakeLists.fastboot.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
add_library(libsparse STATIC
core/libsparse/backed_block.cpp
core/libsparse/output_file.cpp
core/libsparse/sparse.cpp
core/libsparse/sparse_crc32.cpp
core/libsparse/sparse_err.cpp
core/libsparse/sparse_read.cpp)

target_include_directories(libsparse PUBLIC
core/libsparse/include core/base/include)

add_library(libzip STATIC
core/libziparchive/zip_archive.cc)

Expand Down
25 changes: 25 additions & 0 deletions vendor/CMakeLists.sparse.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
add_library(libsparse STATIC
core/libsparse/backed_block.cpp
core/libsparse/output_file.cpp
core/libsparse/sparse.cpp
core/libsparse/sparse_crc32.cpp
core/libsparse/sparse_err.cpp
core/libsparse/sparse_read.cpp)

target_include_directories(libsparse PUBLIC
core/libsparse/include core/base/include)

add_executable(simg2img
core/libsparse/simg2img.cpp)
target_link_libraries(simg2img
libsparse z libbase)

add_executable(img2simg
core/libsparse/img2simg.cpp)
target_link_libraries(img2simg
libsparse z libbase)

add_executable(append2simg
core/libsparse/append2simg.cpp)
target_link_libraries(append2simg
libsparse z libbase)
4 changes: 3 additions & 1 deletion vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if(EXISTS "${ANDROID_PATCH_DIR}/")
endif()

include(CMakeLists.adb.txt)
include(CMakeLists.sparse.txt)
include(CMakeLists.fastboot.txt)
include(CMakeLists.mke2fs.txt)

Expand All @@ -36,4 +37,5 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11 -Wno-attributes")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++2a -Wno-attributes")

# Targets which should be installed by `make install`.
install(TARGETS adb fastboot "${ANDROID_MKE2FS_NAME}" DESTINATION bin)
install(TARGETS adb fastboot "${ANDROID_MKE2FS_NAME}"
simg2img img2simg append2simg DESTINATION bin)

0 comments on commit db84fde

Please sign in to comment.