[Python] UnPack / rePack android img with Ubuntu simg2img/make_ext4fs

Discussão em 'Python' iniciado por Stack, Maio 14, 2025.

  1. Stack

    Stack Membro Participativo

    I'm playing with these 2 tools on ubuntu 14.04.1 :

    • simg2img
    • make_ext4fs

    The first tool work great. But when I try to compile the image changed with the second tool I have in output this error:

    can't set android permissions - built without android support


    I have installed these two tools with the official package of ubuntu and also with the package of debian that seems more updated.

    Anyone can help me ? How I can compile these two tools ?

    Thank you,

    UPDATE

    I have write this script for compile this tool, but the error persist:

    sudo apt-get install git zlib1g-dev gcc make libpcre3-dev

    URL="https://android.googlesource.com/platform/system/core"
    git clone --depth 1 "$URL" "$(basename $URL)"
    URL="https://android.googlesource.com/platform/system/extras"
    git clone --depth 1 "$URL" "$(basename $URL)"
    URL="https://android.googlesource.com/platform/external/libselinux"
    git clone --depth 1 "$URL" "$(basename $URL)"


    git clone "extras" "extras-build"

    DIR=$(pwd)

    cd "extras-build/ext4_utils"


    gcc -Wall \
    -o make_ext4fs \
    -DHAVE_ANDROID_OS -DHOST \
    -I$DIR/core/libsparse/include \
    -I$DIR/libselinux/include \
    make_ext4fs_main.c \
    make_ext4fs.c \
    ext4fixup.c \
    ext4_utils.c \
    allocate.c \
    contents.c \
    extent.c \
    indirect.c \
    uuid.c \
    sha1.c \
    wipe.c \
    crc16.c \
    ext4_sb.c \
    $DIR/core/libsparse/backed_block.c \
    $DIR/core/libsparse/output_file.c \
    $DIR/core/libsparse/sparse.c \
    $DIR/core/libsparse/sparse_crc32.c \
    $DIR/core/libsparse/sparse_err.c \
    $DIR/core/libsparse/sparse_read.c \
    $DIR/libselinux/src/callbacks.c \
    $DIR/libselinux/src/check_context.c \
    $DIR/libselinux/src/freecon.c \
    $DIR/libselinux/src/init.c \
    $DIR/libselinux/src/label.c \
    $DIR/libselinux/src/label_android_property.c \
    $DIR/libselinux/src/label_file.c\
    -lz \
    -lpcre


    UPDATE 2: This is the final code:

    sudo apt-get install git zlib1g-dev gcc make libpcre3-dev

    URL="https://android.googlesource.com/platform/system/core"
    git clone --depth 1 "$URL" "$(basename $URL)"
    URL="https://android.googlesource.com/platform/system/extras"
    git clone --depth 1 "$URL" "$(basename $URL)"
    URL="https://android.googlesource.com/platform/external/libselinux"
    git clone --depth 1 "$URL" "$(basename $URL)"


    git clone "extras" "extras-build"


    cd "extras-build/ext4_utils"


    gcc -Wall \
    -o make_ext4fs \
    -I$DIR/core/include -DANDROID \
    -DHAVE_ANDROID_OS -DHOST \
    -I$DIR/core/libsparse/include \
    -I$DIR/libselinux/include \
    make_ext4fs_main.c \
    make_ext4fs.c \
    ext4fixup.c \
    ext4_utils.c \
    allocate.c \
    contents.c \
    extent.c \
    indirect.c \
    uuid.c \
    sha1.c \
    wipe.c \
    crc16.c \
    ext4_sb.c \
    $DIR/core/libsparse/backed_block.c \
    $DIR/core/libsparse/output_file.c \
    $DIR/core/libsparse/sparse.c \
    $DIR/core/libsparse/sparse_crc32.c \
    $DIR/core/libsparse/sparse_err.c \
    $DIR/core/libsparse/sparse_read.c \
    $DIR/libselinux/src/callbacks.c \
    $DIR/libselinux/src/check_context.c \
    $DIR/libselinux/src/freecon.c \
    $DIR/libselinux/src/init.c \
    $DIR/libselinux/src/label.c \
    $DIR/libselinux/src/label_android_property.c \
    $DIR/libselinux/src/label_file.c\
    -lz \
    -lpcre

    Continue reading...

Compartilhe esta Página