git » android-tools.git » commit 71746fd

upgpkg: 8.1.0_r7-1

author Anatol Pomozov
2018-01-19 23:05:42 UTC
committer Anatol Pomozov
2018-01-19 23:05:42 UTC
parent 11ceb54e1ba56a17de55ac908044a4c4c9a32026

upgpkg: 8.1.0_r7-1

FS#56955 add Android specific mke2fs, e2fsdroid, ext2simg tools. Patch fastboot to use custom mke2fs.

PKGBUILD +11 -4
fix_build_core.patch +13 -0
fix_build_e2fsprogs.patch +43 -0
generate_build.rb +140 -1

diff --git a/PKGBUILD b/PKGBUILD
index b9b2f74..c36fd80 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,7 +3,7 @@
 # Contributor: Alucryd <alucryd at gmail dot com>
 
 pkgname=android-tools
-pkgver=8.1.0_r1
+pkgver=8.1.0_r7
 pkgrel=1
 pkgdesc='Android platform tools'
 arch=(x86_64)
@@ -17,10 +17,12 @@ source=(git+https://android.googlesource.com/platform/system/core#tag=android-$p
         git+https://android.googlesource.com/platform/system/extras#tag=android-$pkgver
         git+https://android.googlesource.com/platform/external/selinux#tag=android-$pkgver
         git+https://android.googlesource.com/platform/external/f2fs-tools#tag=android-$pkgver
+        git+https://android.googlesource.com/platform/external/e2fsprogs#tag=android-$pkgver
         git+https://boringssl.googlesource.com/boringssl#commit=$_boringssl_commit
         generate_build.rb
         fix_build_core.patch
         fix_build_selinux.patch
+        fix_build_e2fsprogs.patch
         bash_completion.fastboot)
         # Bash completion file was taken from https://github.com/mbrubeck/android-completion
 sha1sums=('SKIP'
@@ -28,9 +30,11 @@ sha1sums=('SKIP'
           'SKIP'
           'SKIP'
           'SKIP'
-          'fa0e4579f2f26a0e0efe53549e9a91ef3a334eff'
-          '640db48e8e915f8c7f525dd044f16a3b502d4689'
+          'SKIP'
+          'caf4dd68f94e7c745b915778c3f33946c0478eae'
+          'e6ab688d0decfae64302d1402e1eee6678fc2549'
           'ec473160d7445f97bccabd1c32ac0ae2f77900c1'
+          '8ccb2ef791a5b517b4371af7f529f4e731ce7260'
           '7004dbd0c193668827174880de6f8434de8ceaee')
 
 prepare() {
@@ -42,6 +46,9 @@ prepare() {
   cd $srcdir/selinux
   patch -p1 < ../fix_build_selinux.patch
 
+  cd $srcdir/e2fsprogs
+  patch -p1 < ../fix_build_e2fsprogs.patch
+
   mkdir -p $srcdir/boringssl/build && cd $srcdir/boringssl/build && cmake -GNinja ..; ninja
 }
 
@@ -51,6 +58,6 @@ build() {
 
 package(){
   install -m755 -d "$pkgdir"/usr/bin
-  install -m755 -t "$pkgdir"/usr/bin fastboot adb core/mkbootimg/mkbootimg
+  install -m755 -t "$pkgdir"/usr/bin fastboot adb mke2fs.android e2fsdroid ext2simg core/mkbootimg/mkbootimg
   install -Dm 644 bash_completion.fastboot "$pkgdir"/usr/share/bash-completion/completions/fastboot
 }
diff --git a/fix_build_core.patch b/fix_build_core.patch
index f41361d..7ee9dd7 100644
--- a/fix_build_core.patch
+++ b/fix_build_core.patch
@@ -67,6 +67,19 @@ index 6357b4ba73..3c7dbce131 100644
  
  // For getprogname(3) or program_invocation_short_name.
  #if defined(__ANDROID__) || defined(__APPLE__)
+diff --git a/fastboot/fs.cpp b/fastboot/fs.cpp
+index 709f061bd6..77629a882b 100644
+--- a/fastboot/fs.cpp
++++ b/fastboot/fs.cpp
+@@ -108,7 +108,7 @@ static int generate_ext4_image(const char* fileName, long long partSize,
+     static constexpr int block_size = 4096;
+     const std::string exec_dir = android::base::GetExecutableDirectory();
+ 
+-    const std::string mke2fs_path = exec_dir + "/mke2fs";
++    const std::string mke2fs_path = exec_dir + "/mke2fs.android";
+     std::vector<const char*> mke2fs_args = {mke2fs_path.c_str(), "-t", "ext4", "-b"};
+ 
+     std::string block_size_str = std::to_string(block_size);
 diff --git a/libsparse/sparse_read.cpp b/libsparse/sparse_read.cpp
 index bd668735a3..6168f2e248 100644
 --- a/libsparse/sparse_read.cpp
diff --git a/fix_build_e2fsprogs.patch b/fix_build_e2fsprogs.patch
new file mode 100644
index 0000000..bc2b365
--- /dev/null
+++ b/fix_build_e2fsprogs.patch
@@ -0,0 +1,43 @@
+diff --git a/contrib/android/perms.c b/contrib/android/perms.c
+index 9ae8e586..433506fd 100644
+--- a/contrib/android/perms.c
++++ b/contrib/android/perms.c
+@@ -5,6 +5,7 @@
+ #include "support/nls-enable.h"
+ #include <time.h>
+ #include <sys/stat.h>
++#include "private/android_filesystem_capability.h"
+ 
+ #ifndef XATTR_SELINUX_SUFFIX
+ # define XATTR_SELINUX_SUFFIX  "selinux"
+diff --git a/lib/ext2fs/bitops.h b/lib/ext2fs/bitops.h
+index 505b3c9c..7be5105f 100644
+--- a/lib/ext2fs/bitops.h
++++ b/lib/ext2fs/bitops.h
+@@ -233,11 +233,11 @@ extern errcode_t ext2fs_find_first_set_generic_bmap(ext2fs_generic_bitmap bitmap
+ #if (__STDC_VERSION__ >= 199901L)
+ #define _INLINE_ extern inline
+ #else
+-#define _INLINE_ inline
++#define _INLINE_ static inline
+ #endif
+ #else /* !INCLUDE_INLINE FUNCS */
+ #if (__STDC_VERSION__ >= 199901L)
+-#define _INLINE_ inline
++#define _INLINE_ static inline
+ #else /* not C99 */
+ #ifdef __GNUC__
+ #define _INLINE_ extern __inline__
+diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
+index e153c817..dcae5947 100644
+--- a/lib/ext2fs/ext2fs.h
++++ b/lib/ext2fs/ext2fs.h
+@@ -1736,7 +1736,7 @@ extern const struct ext2_inode *ext2fs_const_inode(const struct ext2_inode_large
+ #define _INLINE_ extern
+ #else
+ #if (__STDC_VERSION__ >= 199901L)
+-#define _INLINE_ inline
++#define _INLINE_ static inline
+ #else
+ #ifdef __GNUC__
+ #define _INLINE_ extern __inline__
diff --git a/generate_build.rb b/generate_build.rb
index 7fe6d7c..a655f6d 100755
--- a/generate_build.rb
+++ b/generate_build.rb
@@ -141,8 +141,10 @@ cutilsfiles = %w(
   sockets.cpp
   android_get_control_file.cpp
   threads.c
+  fs_config.cpp
+  canned_fs_config.c
 )
-libcutils = compile(expand('core/libcutils', cutilsfiles), '-D_GNU_SOURCE -Icore/include')
+libcutils = compile(expand('core/libcutils', cutilsfiles), '-D_GNU_SOURCE -Icore/libcutils/include -Icore/include')
 
 diagnoseusbfiles = %w(
   diagnose_usb.cpp
@@ -273,3 +275,140 @@ libsepolfiles = %w(
 libsepol = compile(expand('selinux/libsepol/src', libsepolfiles), '-Iselinux/libsepol/include')
 
 link('fastboot', libsparse + libzip + libcutils + liblog + libutil + libbase + libext4 + f2fs + libselinux + libsepol + libfastboot + libdiagnoseusb, '-lz -lpcre2-8 -lpthread -ldl')
+
+
+# mke2fs.android - a ustom version of mke2fs that supports --android_sparse (FS#56955)
+libext2fsfiles = %w(
+  lib/blkid/cache.c
+  lib/blkid/dev.c
+  lib/blkid/devname.c
+  lib/blkid/devno.c
+  lib/blkid/getsize.c
+  lib/blkid/llseek.c
+  lib/blkid/probe.c
+  lib/blkid/read.c
+  lib/blkid/resolve.c
+  lib/blkid/save.c
+  lib/blkid/tag.c
+  lib/e2p/feature.c
+  lib/e2p/hashstr.c
+  lib/e2p/mntopts.c
+  lib/e2p/ostype.c
+  lib/e2p/parse_num.c
+  lib/e2p/uuid.c
+  lib/et/com_err.c
+  lib/et/error_message.c
+  lib/et/et_name.c
+  lib/ext2fs/alloc.c
+  lib/ext2fs/alloc_sb.c
+  lib/ext2fs/alloc_stats.c
+  lib/ext2fs/alloc_tables.c
+  lib/ext2fs/atexit.c
+  lib/ext2fs/badblocks.c
+  lib/ext2fs/bb_inode.c
+  lib/ext2fs/bitmaps.c
+  lib/ext2fs/bitops.c
+  lib/ext2fs/blkmap64_ba.c
+  lib/ext2fs/blkmap64_rb.c
+  lib/ext2fs/blknum.c
+  lib/ext2fs/block.c
+  lib/ext2fs/bmap.c
+  lib/ext2fs/closefs.c
+  lib/ext2fs/crc16.c
+  lib/ext2fs/crc32c.c
+  lib/ext2fs/csum.c
+  lib/ext2fs/dirblock.c
+  lib/ext2fs/dir_iterate.c
+  lib/ext2fs/expanddir.c
+  lib/ext2fs/ext2_err.c
+  lib/ext2fs/ext_attr.c
+  lib/ext2fs/extent.c
+  lib/ext2fs/fallocate.c
+  lib/ext2fs/fileio.c
+  lib/ext2fs/freefs.c
+  lib/ext2fs/gen_bitmap64.c
+  lib/ext2fs/gen_bitmap.c
+  lib/ext2fs/get_num_dirs.c
+  lib/ext2fs/getsectsize.c
+  lib/ext2fs/getsize.c
+  lib/ext2fs/i_block.c
+  lib/ext2fs/ind_block.c
+  lib/ext2fs/initialize.c
+  lib/ext2fs/inline.c
+  lib/ext2fs/inline_data.c
+  lib/ext2fs/inode.c
+  lib/ext2fs/io_manager.c
+  lib/ext2fs/ismounted.c
+  lib/ext2fs/link.c
+  lib/ext2fs/llseek.c
+  lib/ext2fs/lookup.c
+  lib/ext2fs/mkdir.c
+  lib/ext2fs/mkjournal.c
+  lib/ext2fs/mmp.c
+  lib/ext2fs/namei.c
+  lib/ext2fs/newdir.c
+  lib/ext2fs/openfs.c
+  lib/ext2fs/progress.c
+  lib/ext2fs/punch.c
+  lib/ext2fs/rbtree.c
+  lib/ext2fs/read_bb.c
+  lib/ext2fs/read_bb_file.c
+  lib/ext2fs/res_gdt.c
+  lib/ext2fs/rw_bitmaps.c
+  lib/ext2fs/sparse_io.c
+  lib/ext2fs/symlink.c
+  lib/ext2fs/undo_io.c
+  lib/ext2fs/unix_io.c
+  lib/ext2fs/valid_blk.c
+  lib/support/dict.c
+  lib/support/mkquota.c
+  lib/support/parse_qtype.c
+  lib/support/plausible.c
+  lib/support/prof_err.c
+  lib/support/profile.c
+  lib/support/quotaio.c
+  lib/support/quotaio_tree.c
+  lib/support/quotaio_v2.c
+  lib/uuid/gen_uuid.c
+  lib/uuid/isnull.c
+  lib/uuid/pack.c
+  lib/uuid/parse.c
+  lib/uuid/unpack.c
+  lib/uuid/unparse.c
+  misc/create_inode.c
+)
+libext2fs = compile(expand('e2fsprogs', libext2fsfiles), '-Ie2fsprogs/lib -Icore/libsparse/include')
+
+
+mke2fsfiles = %w(
+  misc/default_profile.c
+  misc/mke2fs.c
+  misc/mk_hugefiles.c
+  misc/util.c
+)
+mke2fs = compile(expand('e2fsprogs', mke2fsfiles), '-Ie2fsprogs/lib')
+
+link('mke2fs.android', mke2fs + libext2fs + libsparse + libbase + libzip + liblog + libutil, '-lpthread -lz')
+
+
+e2fsdroidfiles = %w(
+  contrib/android/e2fsdroid.c
+  contrib/android/basefs_allocator.c
+  contrib/android/block_range.c
+  contrib/android/hashmap.c
+  contrib/android/base_fs.c
+  contrib/android/fsmap.c
+  contrib/android/block_list.c
+  contrib/android/perms.c
+)
+e2fsdroid = compile(expand('e2fsprogs', e2fsdroidfiles), '-Ie2fsprogs/lib -Iselinux/libselinux/include -Icore/libcutils/include -Ie2fsprogs/misc')
+
+link('e2fsdroid', e2fsdroid + libext2fs + libsparse + libbase + libzip + liblog + libutil + libselinux + libsepol + libcutils, '-lz -lpthread -lpcre2-8')
+
+
+ext2simgfiles = %w(
+  contrib/android/ext2simg.c
+)
+ext2simg = compile(expand('e2fsprogs', ext2simgfiles), '-Ie2fsprogs/lib -Icore/libsparse/include')
+
+link('ext2simg', ext2simg + libext2fs + libsparse + libbase + libzip + liblog + libutil, '-lz -lpthread')
\ No newline at end of file