title: UnPack / rePack android img with Ubuntu simg2img/make_ext4fs
body: <p>I'm playing with these 2 tools on ubuntu 14.04.1 : </p>
  
  <ul>
  <li>simg2img </li>
  <li>make_ext4fs</li>
  </ul>
  
  <p>The first tool work great. 
  But when I try to compile the image changed with the second tool I have in output this error:</p>
  
  <pre><code>can't set android permissions - built without android support
  </code></pre>
  
  <p>I have installed these two tools with the official package of ubuntu and also with the package of debian that seems more updated. </p>
  
  <p>Anyone can help me ?
  How I can compile these two tools ? </p>
  
  <p>Thank you, </p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I have write this script for compile this tool, but the error persist:</p>
  
  <pre><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"
  
  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
  </code></pre>
  
  <p><strong>UPDATE 2:</strong>
  This is the final code:</p>
  
  <pre><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
  </code></pre>