├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── NOTICE ├── build.sh ├── cmake ├── CMakeLists.txt ├── lib │ ├── CMakeLists.txt │ ├── libselinux │ │ └── CMakeLists.txt │ ├── libsparse │ │ └── CMakeLists.txt │ └── libzlib │ │ └── CMakeLists.txt └── make_ext4fs_tools │ └── CMakeLists.txt ├── jni ├── Android.mk └── Application.mk ├── prebuilt_binary ├── img2simg-arm64-v8a ├── img2simg-armeabi-v7a ├── img2simg-x86 ├── img2simg-x86_64 ├── make_ext4fs-arm64-v8a ├── make_ext4fs-armeabi-v7a ├── make_ext4fs-x86 ├── make_ext4fs-x86_64 ├── sefcontext_decompile-arm64-v8a ├── sefcontext_decompile-armeabi-v7a ├── sefcontext_decompile-x86 ├── sefcontext_decompile-x86_64 ├── simg2img-arm64-v8a ├── simg2img-armeabi-v7a ├── simg2img-x86 └── simg2img-x86_64 ├── readme.md └── src ├── core ├── include │ └── private │ │ ├── android_filesystem_capability.h │ │ └── android_filesystem_config.h └── libsparse │ ├── backed_block.c │ ├── backed_block.h │ ├── defs.h │ ├── img2simg.c │ ├── include │ └── sparse │ │ └── sparse.h │ ├── output_file.c │ ├── output_file.h │ ├── simg2img.c │ ├── simg2simg.c │ ├── sparse.c │ ├── sparse_crc32.c │ ├── sparse_crc32.h │ ├── sparse_defs.h │ ├── sparse_err.c │ ├── sparse_file.h │ ├── sparse_format.h │ └── sparse_read.c ├── extras └── ext4_utils │ ├── allocate.c │ ├── allocate.h │ ├── canned_fs_config.c │ ├── canned_fs_config.h │ ├── contents.c │ ├── contents.h │ ├── crc16.c │ ├── ext4.h │ ├── ext4_extents.h │ ├── ext4_kernel_headers.h │ ├── ext4_sb.c │ ├── ext4_sb.h │ ├── ext4_utils.c │ ├── ext4_utils.h │ ├── ext4fixup.c │ ├── ext4fixup.h │ ├── ext4fixup_main.c │ ├── extent.c │ ├── extent.h │ ├── indirect.c │ ├── indirect.h │ ├── jbd2.h │ ├── make_ext4fs.c │ ├── make_ext4fs.h │ ├── make_ext4fs_main.c │ ├── sha1.c │ ├── sha1.h │ ├── uuid.c │ ├── uuid.h │ ├── wipe.c │ ├── wipe.h │ └── xattr.h ├── libselinux ├── include │ └── selinux │ │ ├── android.h │ │ ├── avc.h │ │ ├── context.h │ │ ├── label.h │ │ └── selinux.h └── src │ ├── callbacks.c │ ├── callbacks.h │ ├── check_context.c │ ├── dso.h │ ├── freecon.c │ ├── init.c │ ├── label.c │ ├── label_android_property.c │ ├── label_file.c │ ├── label_internal.h │ ├── policy.h │ └── selinux_internal.h ├── sefcontext_decompile ├── LICENSE ├── Makefile ├── README.md └── sefcontext_decompile.cpp └── zlib └── src ├── adler32.c ├── compress.c ├── crc32.c ├── crc32.h ├── deflate.c ├── deflate.h ├── gzclose.c ├── gzguts.h ├── gzlib.c ├── gzread.c ├── gzwrite.c ├── infback.c ├── inffast.c ├── inffast.h ├── inffixed.h ├── inflate.c ├── inflate.h ├── inftrees.c ├── inftrees.h ├── trees.c ├── trees.h ├── uncompr.c ├── zconf.h ├── zlib.h ├── zutil.c └── zutil.h /.gitignore: -------------------------------------------------------------------------------- 1 | obj 2 | libs 3 | bin 4 | build_cmake.sh 5 | build -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14.2) 2 | 3 | project(make_ext4fs_tools) 4 | 5 | set(SRC ${CMAKE_SOURCE_DIR}/src) 6 | set(BIN ${CMAKE_SOURCE_DIR}/bin) 7 | 8 | set(common_include 9 | ${SRC}/core/include 10 | ${SRC}/core/libsparse 11 | ${SRC}/core/libsparse/include 12 | ${SRC}/libselinux/include 13 | ) 14 | 15 | add_subdirectory(cmake) 16 | 17 | install(TARGETS sefcontext_decompile img2simg simg2img make_ext4fs DESTINATION ${BIN}) 18 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2008, The Android Open Source Project 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | * Redistributions of source code must retain the above copyright 6 | notice, this list of conditions and the following disclaimer. 7 | * Redistributions in binary form must reproduce the above copyright 8 | notice, this list of conditions and the following disclaimer in the 9 | documentation and/or other materials provided with the distribution. 10 | * Neither the name of Google Inc. nor the names of its contributors may 11 | be used to endorse or promote products derived from this software 12 | without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY Google Inc. ``AS IS'' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL Google Inc. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 18 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 20 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 21 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 22 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/data/data/com.termux/files/usr/bin/bash 2 | # File : build.sh 3 | # Author : rendiix 4 | # Create date: 22-Jan-2020 19:04 5 | 6 | if [[ $(which ndk-build) != "" ]]; then 7 | NDK=$(which ndk-build); 8 | else 9 | echo -e "$1: Could not find Android NDK directory !\nMake sure you have installed android NDK!"; exit 1; 10 | fi 11 | 12 | build () 13 | { 14 | JOBS=$(grep -c ^processor /proc/cpuinfo); 15 | if [ "$OPT_DEBUG" = "true" ]; then 16 | DEBUGFLAGS="NDK_DEBUG=1 APP_OPTIM=debug"; 17 | fi; 18 | TOOLCHAINS=${COMPILER} BUILD=${OPT_TARGET_ARCH} STATIC=${OPT_STATIC} $NDK ${DEBUGFLAGS} V=${OPT_VERBOSE} -j${JOBS}; 19 | if [ "$?" = 0 ]; then 20 | find libs -mindepth 1 -maxdepth 1 -type d | while read -r meki; do 21 | DIR_ABI=$(basename "$meki"); 22 | if [ ! -d "prebuilt_binary" ]; then 23 | mkdir prebuilt_binary; 24 | fi; 25 | if [ "$OPT_NO_COPY" = "0" ]; then 26 | for binary in "make_ext4fs" "img2simg" "simg2img" "sefcontext_decompile"; 27 | do 28 | cp -f "libs/${DIR_ABI}/${binary}" "prebuilt_binary/${binary}_android_${DIR_ABI}"; 29 | done; 30 | fi; 31 | done; 32 | fi; 33 | rm -rf libs; 34 | rm -rf obj 35 | } 36 | 37 | HELP () 38 | { 39 | echo -e "Usage $0 40 | 41 | Options: 42 | -t, --target 43 | build single target executable i.e: . 44 | -c, --compiler 45 | select compiler gcc or clang. 46 | -s, --static compile static executable binary. 47 | -n, --no-copy dont copy compiled binary to bin folder. 48 | -d, --debug compile with debugable binary. 49 | -v, --verbose verbose compilation. 50 | -h, --help show this help message and exit. 51 | -q, --quiet build with silent stdout" 52 | } 53 | 54 | OPTS=`busybox getopt -o t:c:vsndhq --long target:,compiler:verbose,static,no-copy,debug,quiet,help -n "$0" -- "$@"` 55 | 56 | if [ "$?" -ne "0" ]; then 57 | HELP; exit 1; 58 | fi 59 | eval set -- "$OPTS" 60 | 61 | OPT_DEBUG="0" 62 | OPT_TARGET_ARCH="all" 63 | OPT_VERBOSE="0" 64 | OPT_STATIC="0" 65 | OPT_HELP="false" 66 | OPT_QUIET="0" 67 | OPT_NO_COPY="0" 68 | COMPILER=clang 69 | 70 | if [ -z "$1" ]; then 71 | echo -e "No options was given, building with default options. 72 | To see more options: 73 | $0 --help\n"; 74 | fi 75 | 76 | while true; do 77 | case "$1" in 78 | -t | --target) 79 | OPT_TARGET_ARCH="$2"; shift 80 | ;; 81 | -c | --compiler) 82 | if [[ "$2" -ne "clang" || "$2" -ne "gcc" ]]; then 83 | echo "$2 is not valid compiler, use gcc or clang"; HELP; exit 1; 84 | fi; COMPILER="$2"; shift 85 | ;; 86 | -h | --help) 87 | OPT_HELP=true 88 | ;; 89 | -d | --debug) 90 | OPT_DEBUG=true 91 | ;; 92 | -v | --verbose) 93 | OPT_VERBOSE=1 94 | ;; 95 | -n | --no-copy) 96 | OPT_NO_COPY=1 97 | ;; 98 | -s | --static) 99 | OPT_STATIC=1 100 | ;; 101 | -q | --quiet) 102 | OPT_QUIET=1 103 | ;; 104 | --) 105 | shift; break 106 | ;; 107 | *) 108 | break 109 | ;; 110 | esac; shift; 111 | done 112 | 113 | info () 114 | { 115 | echo -e "\nBuild start with cofiguration:\n"; 116 | echo -e "BUILD TARGET ARCH: $OPT_TARGET_ARCH"; 117 | echo -e "EXE TYPE : $(if [ "$OPT_STATIC" = 1 ]; then echo STATIC; else echo SHARED;fi)"; 118 | echo -e "VERBOSE : $(if [ "$OPT_VERBOSE" = 1 ]; then echo YES; else echo NO;fi)"; 119 | echo -e "BUILD TYPE : $(if [ "$OPT_DEBUG" = 1 ]; then echo DEBUG; else echo RELEASE;fi)"; 120 | echo -e "COMPILER : $COMPILER"; 121 | echo -e "\n$0 --help\nto show more options"; 122 | sleep 2; 123 | echo -e "\nPlease wait... \c" 124 | } 125 | 126 | case "$OPT_TARGET_ARCH" in 127 | arm | arm64 | x86 | x86_64 | all) 128 | 129 | ;; 130 | *) 131 | echo "unknown arch $OPT_TARGET_ARCH"; exit 1 132 | ;; 133 | esac 134 | 135 | if [ "$OPT_HELP" = "true" ]; then 136 | HELP; exit 1; 137 | fi 138 | 139 | if [ "$OPT_QUIET" = 0 ]; then 140 | info; build; 141 | else 142 | info; build &> /dev/null; 143 | fi 144 | if [ "$?" = 0 ]; then 145 | echo "done"; 146 | else 147 | echo "someting went wrong!"; 148 | fi 149 | 150 | -------------------------------------------------------------------------------- /cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14.2) 2 | 3 | project(cmake) 4 | 5 | set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules) 6 | 7 | set(GLOBAL_C_FLAGS " \ 8 | -fPIC \ 9 | -Wall \ 10 | -Wno-unused \ 11 | -Wno-unused-parameter \ 12 | -fcolor-diagnostics \ 13 | ") 14 | 15 | add_subdirectory(lib) 16 | 17 | add_subdirectory(make_ext4fs_tools) 18 | 19 | -------------------------------------------------------------------------------- /cmake/lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14.2) 2 | 3 | project(lib) 4 | 5 | add_subdirectory(libselinux) 6 | add_subdirectory(libsparse) 7 | add_subdirectory(libzlib) 8 | 9 | -------------------------------------------------------------------------------- /cmake/lib/libselinux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14.2) 2 | 3 | project(libselinux) 4 | 5 | set(LIBSELINUX ${SRC}/libselinux/src) 6 | 7 | set(LIBSELINUX_SRC_FILES 8 | ${LIBSELINUX}/callbacks.c 9 | ${LIBSELINUX}/check_context.c 10 | ${LIBSELINUX}/freecon.c 11 | ${LIBSELINUX}/init.c 12 | ${LIBSELINUX}/label.c 13 | ${LIBSELINUX}/label_android_property.c 14 | ${LIBSELINUX}/label_file.c 15 | ) 16 | 17 | set(CMAKE_C_FLAGS " \ 18 | -std=gnu89 -DBUILD_HOST \ 19 | ") 20 | 21 | include_directories( 22 | ${common_include} 23 | ) 24 | 25 | add_library(selinux STATIC ${LIBSELINUX_SRC_FILES}) 26 | target_link_libraries(selinux) 27 | -------------------------------------------------------------------------------- /cmake/lib/libsparse/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14.2) 2 | 3 | project(libsparse) 4 | 5 | set(LIBSPARSE ${SRC}/core/libsparse) 6 | 7 | set(LIBSPARSE_SRC_FILES 8 | ${LIBSPARSE}/backed_block.c 9 | ${LIBSPARSE}/img2simg.c 10 | ${LIBSPARSE}/output_file.c 11 | ${LIBSPARSE}/simg2img.c 12 | ${LIBSPARSE}/simg2simg.c 13 | ${LIBSPARSE}/sparse.c 14 | ${LIBSPARSE}/sparse_crc32.c 15 | ${LIBSPARSE}/sparse_err.c 16 | ${LIBSPARSE}/sparse_read.c 17 | ) 18 | 19 | include_directories( 20 | ${common_include} 21 | ) 22 | 23 | add_library(sparse STATIC ${LIBSPARSE_SRC_FILES}) 24 | target_link_libraries(sparse) 25 | -------------------------------------------------------------------------------- /cmake/lib/libzlib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14.2) 2 | 3 | project(libzlib) 4 | 5 | set(LIBZLIB ${SRC}/zlib/src) 6 | 7 | set(LIBZLIB_SRC_FILES 8 | ${LIBZLIB}/adler32.c 9 | ${LIBZLIB}/compress.c 10 | ${LIBZLIB}/crc32.c 11 | ${LIBZLIB}/deflate.c 12 | ${LIBZLIB}/gzclose.c 13 | ${LIBZLIB}/gzlib.c 14 | ${LIBZLIB}/gzread.c 15 | ${LIBZLIB}/gzwrite.c 16 | ${LIBZLIB}/infback.c 17 | ${LIBZLIB}/inffast.c 18 | ${LIBZLIB}/inflate.c 19 | ${LIBZLIB}/inftrees.c 20 | ${LIBZLIB}/trees.c 21 | ${LIBZLIB}/uncompr.c 22 | ${LIBZLIB}/zutil.c 23 | ) 24 | 25 | set(CMAKE_C_FLAGS " \ 26 | -DUSE_MMAP \ 27 | -D_FILE_OFFSET_BITS=64 \ 28 | -D_LARGEFILE64_SOURCE=1 \ 29 | -DZLIB_CONST \ 30 | ") 31 | 32 | include_directories( 33 | ${common_include} 34 | ) 35 | 36 | add_library(zlib STATIC ${LIBZLIB_SRC_FILES}) 37 | target_link_libraries(zlib) 38 | -------------------------------------------------------------------------------- /cmake/make_ext4fs_tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14.2) 2 | 3 | project(make_ext4fs_tools) 4 | 5 | set(SEFCONTEXT_DECOMPILE ${SRC}/sefcontext_decompile) 6 | set(MAKE_EXT4FS ${SRC}/extras/ext4_utils) 7 | set(IMG2SIMG ${SRC}/core/libsparse) 8 | 9 | set(SEFCONTEXT_DECOMPILE_SRC_FILES 10 | ${SEFCONTEXT_DECOMPILE}/sefcontext_decompile.cpp 11 | ) 12 | 13 | set(IMG2SIMG_SRC_FILES 14 | ${IMG2SIMG}/img2simg.c 15 | ) 16 | 17 | set(SIMG2IMG_SRC_FILES 18 | ${IMG2SIMG}/simg2img.c 19 | ) 20 | 21 | set(MAKE_EXT4FS_SRC_FILES 22 | ${MAKE_EXT4FS}/allocate.c 23 | ${MAKE_EXT4FS}/canned_fs_config.c 24 | ${MAKE_EXT4FS}/contents.c 25 | ${MAKE_EXT4FS}/crc16.c 26 | ${MAKE_EXT4FS}/ext4_sb.c 27 | ${MAKE_EXT4FS}/ext4_utils.c 28 | ${MAKE_EXT4FS}/ext4fixup.c 29 | ${MAKE_EXT4FS}/extent.c 30 | ${MAKE_EXT4FS}/indirect.c 31 | ${MAKE_EXT4FS}/make_ext4fs.c 32 | ${MAKE_EXT4FS}/make_ext4fs_main.c 33 | ${MAKE_EXT4FS}/sha1.c 34 | ${MAKE_EXT4FS}/uuid.c 35 | ${MAKE_EXT4FS}/wipe.c 36 | ) 37 | 38 | set(CMAKE_C_FLAGS " \ 39 | -D_GNU_SOURCE \ 40 | -DANDROID \ 41 | -DHOST \ 42 | ") 43 | 44 | include_directories( 45 | ${common_include} 46 | ${MAKE_EXT4FS_SRC_FILES} 47 | ) 48 | 49 | 50 | add_executable(make_ext4fs ${MAKE_EXT4FS_SRC_FILES}) 51 | target_link_libraries(make_ext4fs 52 | selinux 53 | sparse 54 | zlib) 55 | 56 | add_executable(img2simg ${IMG2SIMG_SRC_FILES}) 57 | target_link_libraries(img2simg 58 | sparse 59 | zlib) 60 | 61 | add_executable(simg2img ${SIMG2IMG_SRC_FILES}) 62 | target_link_libraries(simg2img 63 | sparse 64 | zlib) 65 | 66 | add_executable(sefcontext_decompile ${SEFCONTEXT_DECOMPILE_SRC_FILES}) 67 | target_link_libraries(sefcontext_decompile) 68 | -------------------------------------------------------------------------------- /jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | 3 | libselinux_src_files := \ 4 | ../src/libselinux/src/callbacks.c \ 5 | ../src/libselinux/src/check_context.c \ 6 | ../src/libselinux/src/freecon.c \ 7 | ../src/libselinux/src/init.c \ 8 | ../src/libselinux/src/label.c \ 9 | ../src/libselinux/src/label_android_property.c \ 10 | ../src/libselinux/src/label_file.c \ 11 | 12 | libz_src_files := \ 13 | ../src/zlib/src/adler32.c \ 14 | ../src/zlib/src/compress.c \ 15 | ../src/zlib/src/crc32.c \ 16 | ../src/zlib/src/deflate.c \ 17 | ../src/zlib/src/gzclose.c \ 18 | ../src/zlib/src/gzlib.c \ 19 | ../src/zlib/src/gzread.c \ 20 | ../src/zlib/src/gzwrite.c \ 21 | ../src/zlib/src/infback.c \ 22 | ../src/zlib/src/inffast.c \ 23 | ../src/zlib/src/inflate.c \ 24 | ../src/zlib/src/inftrees.c \ 25 | ../src/zlib/src/trees.c \ 26 | ../src/zlib/src/uncompr.c \ 27 | ../src/zlib/src/zutil.c \ 28 | 29 | libsparse_src_files := \ 30 | ../src/core/libsparse/backed_block.c \ 31 | ../src/core/libsparse/img2simg.c \ 32 | ../src/core/libsparse/output_file.c \ 33 | ../src/core/libsparse/simg2img.c \ 34 | ../src/core/libsparse/simg2simg.c \ 35 | ../src/core/libsparse/sparse.c \ 36 | ../src/core/libsparse/sparse_crc32.c \ 37 | ../src/core/libsparse/sparse_err.c \ 38 | ../src/core/libsparse/sparse_read.c \ 39 | 40 | ext4fs_src_files := \ 41 | ../src/extras/ext4_utils/allocate.c \ 42 | ../src/extras/ext4_utils/canned_fs_config.c \ 43 | ../src/extras/ext4_utils/contents.c \ 44 | ../src/extras/ext4_utils/crc16.c \ 45 | ../src/extras/ext4_utils/ext4_sb.c \ 46 | ../src/extras/ext4_utils/ext4_utils.c \ 47 | ../src/extras/ext4_utils/ext4fixup.c \ 48 | ../src/extras/ext4_utils/extent.c \ 49 | ../src/extras/ext4_utils/indirect.c \ 50 | ../src/extras/ext4_utils/make_ext4fs.c \ 51 | ../src/extras/ext4_utils/make_ext4fs_main.c \ 52 | ../src/extras/ext4_utils/sha1.c \ 53 | ../src/extras/ext4_utils/uuid.c \ 54 | ../src/extras/ext4_utils/wipe.c \ 55 | 56 | common_cflags := \ 57 | -g -O3 \ 58 | -D__ANDROID__ \ 59 | -DANDROID 60 | 61 | common_includes := \ 62 | src/core/include \ 63 | src/core/libsparse \ 64 | src/core/libsparse/include \ 65 | src/libselinux/include 66 | 67 | ## 68 | # libselinux 69 | # 70 | include $(CLEAR_VARS) 71 | LOCAL_SRC_FILES := $(libselinux_src_files) 72 | LOCAL_MODULE := libselinux 73 | LOCAL_CFLAGS := -std=gnu89 -DBUILD_HOST $(common_cflags) 74 | LOCAL_C_INCLUDES := $(common_includes) 75 | 76 | include $(BUILD_STATIC_LIBRARY) 77 | 78 | 79 | ## 80 | # libz.a 81 | # 82 | include $(CLEAR_VARS) 83 | 84 | LOCAL_MODULE := libz 85 | LOCAL_C_INCLUDES := $(common_includes) 86 | LOCAL_CFLAGS += -DUSE_MMAP \ 87 | -D_FILE_OFFSET_BITS=64 \ 88 | -D_LARGEFILE64_SOURCE=1 \ 89 | -DZLIB_CONST 90 | 91 | LOCAL_SRC_FILES := $(libz_src_files) 92 | 93 | include $(BUILD_STATIC_LIBRARY) 94 | 95 | ## 96 | # libsparse.a 97 | # 98 | include $(CLEAR_VARS) 99 | 100 | LOCAL_MODULE := libsparse 101 | LOCAL_MODULE_TAGES := optional 102 | LOCAL_C_INCLUDES := $(common_includes) 103 | LOCAL_SRC_FILES := $(libsparse_src_files) 104 | LOCAL_STATIC_LIBRARIES := libz 105 | 106 | include $(BUILD_STATIC_LIBRARY) 107 | 108 | ## 109 | # make_ext4fs 110 | # 111 | include $(CLEAR_VARS) 112 | LOCAL_SRC_FILES := $(ext4fs_src_files) 113 | LOCAL_MODULE := make_ext4fs 114 | LOCAL_CFLAGS += -D_GNU_SOURCE -D__ANDROID__ -DHOST 115 | LOCAL_STATIC_LIBRARIES := libselinux libz libsparse 116 | LOCAL_C_INCLUDES := $(common_includes) 117 | LOCAL_MODULE_TAGS := optional 118 | ifeq ($(STATIC), 1) 119 | LOCAL_LDFLAGS := -static 120 | endif 121 | 122 | include $(BUILD_EXECUTABLE) 123 | 124 | 125 | ## 126 | # simg2img 127 | # 128 | include $(CLEAR_VARS) 129 | LOCAL_SRC_FILES := \ 130 | ../src/core/libsparse/simg2img.c \ 131 | ../src/core/libsparse/sparse_crc32.c 132 | 133 | LOCAL_MODULE := simg2img 134 | LOCAL_CFLAGS := $(common_cflags) \ 135 | -std=c11 136 | 137 | LOCAL_STATIC_LIBRARIES := libz libsparse 138 | LOCAL_C_INCLUDES := $(common_includes) 139 | LOCAL_MODULE_TAGS := optional 140 | ifeq ($(STATIC), 1) 141 | LOCAL_LDFLAGS := -static 142 | endif 143 | 144 | include $(BUILD_EXECUTABLE) 145 | 146 | ## 147 | # img2simg 148 | # 149 | include $(CLEAR_VARS) 150 | LOCAL_SRC_FILES := \ 151 | ../src/core/libsparse/img2simg.c \ 152 | ../src/core/libsparse/sparse_crc32.c 153 | 154 | LOCAL_MODULE := img2simg 155 | LOCAL_CFLAGS := $(common_cflags) 156 | LOCAL_STATIC_LIBRARIES := libz libsparse 157 | LOCAL_C_INCLUDES := $(common_includes) 158 | LOCAL_MODULE_TAGS := optional 159 | ifeq ($(STATIC), 1) 160 | LOCAL_LDFLAGS := -static 161 | endif 162 | 163 | include $(BUILD_EXECUTABLE) 164 | 165 | ## 166 | # sefcontext_decompile 167 | # 168 | 169 | include $(CLEAR_VARS) 170 | 171 | LOCAL_SRC_FILES := \ 172 | ../src/sefcontext_decompile/sefcontext_decompile.cpp 173 | 174 | LOCAL_MODULE := sefcontext_decompile 175 | LOCAL_CPPFLAGS := $(common_cflags) -std=c++11 176 | 177 | ifeq ($(STATIC), 1) 178 | LOCAL_LDFLAGS := -static 179 | endif 180 | 181 | include $(BUILD_EXECUTABLE) 182 | 183 | -------------------------------------------------------------------------------- /jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_PLATFORM := android-28 2 | 3 | ifeq ($(BUILD), arm64) 4 | APP_ABI := arm64-v8a 5 | endif 6 | 7 | ifeq ($(BUILD), arm) 8 | APP_ABI := armeabi-v7a 9 | endif 10 | 11 | ifeq ($(BUILD), x86_64) 12 | APP_ABI := x86_64 13 | endif 14 | 15 | ifeq ($(BUILD), x86) 16 | APP_ABI := x86 17 | endif 18 | 19 | ifeq ($(BUILD), all) 20 | APP_ABI := arm64-v8a armeabi-v7a x86 x86_64 21 | endif 22 | 23 | ifeq ($(TOOLCHAINS), gcc) 24 | NDK_TOOLCHAIN_VERSION=4.9 25 | endif 26 | 27 | ifeq ($(TOOLCHAINS), clang) 28 | NDK_TOOLCHAIN_VERSION=clang 29 | endif 30 | -------------------------------------------------------------------------------- /prebuilt_binary/img2simg-arm64-v8a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rendiix/make_ext4fs/7c6357f01d25a703c08e30dc62948422394341da/prebuilt_binary/img2simg-arm64-v8a -------------------------------------------------------------------------------- /prebuilt_binary/img2simg-armeabi-v7a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rendiix/make_ext4fs/7c6357f01d25a703c08e30dc62948422394341da/prebuilt_binary/img2simg-armeabi-v7a -------------------------------------------------------------------------------- /prebuilt_binary/img2simg-x86: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rendiix/make_ext4fs/7c6357f01d25a703c08e30dc62948422394341da/prebuilt_binary/img2simg-x86 -------------------------------------------------------------------------------- /prebuilt_binary/img2simg-x86_64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rendiix/make_ext4fs/7c6357f01d25a703c08e30dc62948422394341da/prebuilt_binary/img2simg-x86_64 -------------------------------------------------------------------------------- /prebuilt_binary/make_ext4fs-arm64-v8a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rendiix/make_ext4fs/7c6357f01d25a703c08e30dc62948422394341da/prebuilt_binary/make_ext4fs-arm64-v8a -------------------------------------------------------------------------------- /prebuilt_binary/make_ext4fs-armeabi-v7a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rendiix/make_ext4fs/7c6357f01d25a703c08e30dc62948422394341da/prebuilt_binary/make_ext4fs-armeabi-v7a -------------------------------------------------------------------------------- /prebuilt_binary/make_ext4fs-x86: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rendiix/make_ext4fs/7c6357f01d25a703c08e30dc62948422394341da/prebuilt_binary/make_ext4fs-x86 -------------------------------------------------------------------------------- /prebuilt_binary/make_ext4fs-x86_64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rendiix/make_ext4fs/7c6357f01d25a703c08e30dc62948422394341da/prebuilt_binary/make_ext4fs-x86_64 -------------------------------------------------------------------------------- /prebuilt_binary/sefcontext_decompile-arm64-v8a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rendiix/make_ext4fs/7c6357f01d25a703c08e30dc62948422394341da/prebuilt_binary/sefcontext_decompile-arm64-v8a -------------------------------------------------------------------------------- /prebuilt_binary/sefcontext_decompile-armeabi-v7a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rendiix/make_ext4fs/7c6357f01d25a703c08e30dc62948422394341da/prebuilt_binary/sefcontext_decompile-armeabi-v7a -------------------------------------------------------------------------------- /prebuilt_binary/sefcontext_decompile-x86: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rendiix/make_ext4fs/7c6357f01d25a703c08e30dc62948422394341da/prebuilt_binary/sefcontext_decompile-x86 -------------------------------------------------------------------------------- /prebuilt_binary/sefcontext_decompile-x86_64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rendiix/make_ext4fs/7c6357f01d25a703c08e30dc62948422394341da/prebuilt_binary/sefcontext_decompile-x86_64 -------------------------------------------------------------------------------- /prebuilt_binary/simg2img-arm64-v8a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rendiix/make_ext4fs/7c6357f01d25a703c08e30dc62948422394341da/prebuilt_binary/simg2img-arm64-v8a -------------------------------------------------------------------------------- /prebuilt_binary/simg2img-armeabi-v7a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rendiix/make_ext4fs/7c6357f01d25a703c08e30dc62948422394341da/prebuilt_binary/simg2img-armeabi-v7a -------------------------------------------------------------------------------- /prebuilt_binary/simg2img-x86: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rendiix/make_ext4fs/7c6357f01d25a703c08e30dc62948422394341da/prebuilt_binary/simg2img-x86 -------------------------------------------------------------------------------- /prebuilt_binary/simg2img-x86_64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rendiix/make_ext4fs/7c6357f01d25a703c08e30dc62948422394341da/prebuilt_binary/simg2img-x86_64 -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | [![GitHub](https://img.shields.io/github/license/rendiix/make_ext4fs.svg)](https://github.com/rendiix/make_ext4fs/blob/master/LICENSE) 2 | [![HitCount](http://hits.dwyl.io/rendiix/make_ext4fs.svg)](http://github.com/rendiix/make_ext4fs) 3 | [![GitHub release](https://img.shields.io/github/release/rendiix/make_ext4fs.svg)](https://GitHub.com/rendiix/make_ext4fs/releases/) 4 | [![Github all releases](https://img.shields.io/github/downloads/rendiix/make_ext4fs/total.svg)](https://GitHub.com/rendiix/make_ext4fs/releases/) 5 | [![GitHub forks](https://img.shields.io/github/forks/rendiix/make_ext4fs.svg?style=social&label=Fork&maxAge=2592000)](https://GitHub.com/rendiix/make_ext4fs/network/) 6 | [![GitHub stars](https://img.shields.io/github/stars/rendiix/make_ext4fs.svg?style=social&label=Star&maxAge=2592000)](https://GitHub.com/rendiix/make_ext4fs/stargazers/) 7 | [![GitHub watchers](https://img.shields.io/github/watchers/rendiix/make_ext4fs.svg?style=social)](https://github.com/rendiix/make_ext4fs/watchers) 8 | [![GitHub followers](https://img.shields.io/github/followers/rendiix.svg?style=social&label=Follow&maxAge=2592000)](https://github.com/rendiix?tab=followers) 9 | [![GitHub contributors](https://img.shields.io/github/contributors/rendiix/make_ext4fs.svg)](https://GitHub.com/rendiix/make_ext4fs/graphs/contributors/) 10 | 11 | # make_ext4fs for android 12 | ## termux make_ext4fs img2simg simg2img sefcontext_decompile 13 | 14 | #### Join Discord or follow me on Twitter: 15 | 16 | [![Discord](https://img.shields.io/discord/404576842419273729.svg?label=join%20discord&logo=discord)](https://discord.gg/5PmKhrc) 17 | [![Twitter Follow](https://img.shields.io/twitter/follow/rendiix.svg?color=green&label=follow&logo=twitter&style=social)](https://twitter.com/rendiix) 18 | 19 | #### How to build 20 | 21 | >Make sure the NDK android is installed 22 | 23 | ```console 24 | user@localhost:~/make_ext4fs$ build.sh --help 25 | Usage ./build.sh 26 | 27 | Options: 28 | -t, --target build single target i.e: . 29 | -s, --static compile static executable binary. 30 | -c, --compiler select compiler gcc or clang. 31 | -d, --debug compile with debugable binary. 32 | -v, --verbose verbose compilation. 33 | -h, --help show this help message and exit. 34 | -q, --quiet build with silent stdout 35 | ``` 36 | #### 37 | 38 | ```console 39 | user@localhost:~/make_ext4fs$ ./bin/make_ext4fs_android_arm64-v8a 40 | Expected filename after options 41 | make_ext4fs_android_arm64-v8a [ -l ] [ -j ] [ -b ] 42 | [ -g ] [ -i ] [ -I ] 43 | [ -L