Date: Friday, January 19, 2018 @ 23:05:42 Author: anatolik Revision: 284249
upgpkg: android-tools 8.1.0_r7-1 FS#56955 add Android specific mke2fs, e2fsdroid, ext2simg tools. Patch fastboot to use custom mke2fs. Added: android-tools/trunk/fix_build_e2fsprogs.patch Modified: android-tools/trunk/PKGBUILD android-tools/trunk/fix_build_core.patch android-tools/trunk/generate_build.rb ---------------------------+ PKGBUILD | 15 +++- fix_build_core.patch | 13 ++++ fix_build_e2fsprogs.patch | 43 +++++++++++++ generate_build.rb | 141 +++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 207 insertions(+), 5 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2018-01-19 23:03:25 UTC (rev 284248) +++ PKGBUILD 2018-01-19 23:05:42 UTC (rev 284249) @@ -4,7 +4,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) @@ -18,10 +18,12 @@ 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' @@ -29,9 +31,11 @@ 'SKIP' 'SKIP' 'SKIP' - 'fa0e4579f2f26a0e0efe53549e9a91ef3a334eff' - '640db48e8e915f8c7f525dd044f16a3b502d4689' + 'SKIP' + 'caf4dd68f94e7c745b915778c3f33946c0478eae' + 'e6ab688d0decfae64302d1402e1eee6678fc2549' 'ec473160d7445f97bccabd1c32ac0ae2f77900c1' + '8ccb2ef791a5b517b4371af7f529f4e731ce7260' '7004dbd0c193668827174880de6f8434de8ceaee') prepare() { @@ -43,6 +47,9 @@ 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 } @@ -52,6 +59,6 @@ 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 } Modified: fix_build_core.patch =================================================================== --- fix_build_core.patch 2018-01-19 23:03:25 UTC (rev 284248) +++ fix_build_core.patch 2018-01-19 23:05:42 UTC (rev 284249) @@ -67,6 +67,19 @@ // 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 Added: fix_build_e2fsprogs.patch =================================================================== --- fix_build_e2fsprogs.patch (rev 0) +++ fix_build_e2fsprogs.patch 2018-01-19 23:05:42 UTC (rev 284249) @@ -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__ Modified: generate_build.rb =================================================================== --- generate_build.rb 2018-01-19 23:03:25 UTC (rev 284248) +++ generate_build.rb 2018-01-19 23:05:42 UTC (rev 284249) @@ -141,8 +141,10 @@ 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 @@ 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