Alessio
Alessio

Reputation: 21

UnPack / rePack android img with Ubuntu simg2img/make_ext4fs

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

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

Upvotes: 0

Views: 8571

Answers (1)

Sam
Sam

Reputation: 6160

I struggled for hours building make_ext4fs and then finally found a precompiled binary which I could run on my Debian system: http://blog.djodjo.org/?p=98

Repacking my system.img went flawless with this.

Upvotes: 0

Related Questions