Skip to content

Commit

Permalink
android-platform-tools: (Arch patches and scripts) update to 9.0.0r30
Browse files Browse the repository at this point in the history
  • Loading branch information
MingcongBai committed Apr 19, 2019
1 parent ce8abf8 commit bca4fc8
Show file tree
Hide file tree
Showing 10 changed files with 114 additions and 70 deletions.
9 changes: 6 additions & 3 deletions extra-android/android-platform-tools/autobuild/build
@@ -1,4 +1,6 @@
mkdir -p "$SRCDIR"/boringssl/build
# Adapted from Arch Linux.

mkdir -pv "$SRCDIR"/boringssl/build
cd "$SRCDIR"/boringssl/build
cmake -GNinja ${ASM} ..
ninja
Expand All @@ -7,5 +9,6 @@ cd "$SRCDIR"

ninja

install -m755 -d "$PKGDIR"/usr/bin
install -m755 -t "$PKGDIR"/usr/bin fastboot adb core/mkbootimg/mkbootimg
install -dvm755 "$PKGDIR"/usr/bin
install -vm755 -t "$PKGDIR"/usr/bin \
fastboot adb mke2fs.android e2fsdroid ext2simg core/mkbootimg/mkbootimg avb/avbtool
39 changes: 14 additions & 25 deletions extra-android/android-platform-tools/autobuild/gen_build.rb
Expand Up @@ -21,7 +21,7 @@ def compile(sources, cflags)
lang_flags = "-std=gnu11 $CFLAGS $CPPFLAGS"
when ".cpp", ".cc"
cc = "cxx"
lang_flags = "-std=gnu++14 $CXXFLAGS $CPPFLAGS"
lang_flags = "-std=gnu++17 $CXXFLAGS $CPPFLAGS"
else
raise "Unknown extension #{ext}"
end
Expand Down Expand Up @@ -131,17 +131,17 @@ def link(output, objects, ldflags)
liblog = compile(expand("core/liblog", logfiles), "-DLIBLOG_LOG_TAG=1006 -D_XOPEN_SOURCE=700 -DFAKE_LOG_DEVICE=1 -Icore/log/include -Icore/include")

cutilsfiles = %w(
load_file.c
socket_local_client_unix.c
socket_network_client_unix.c
socket_local_server_unix.c
load_file.cpp
socket_local_client_unix.cpp
socket_network_client_unix.cpp
socket_local_server_unix.cpp
sockets_unix.cpp
socket_inaddr_any_server_unix.c
socket_inaddr_any_server_unix.cpp
sockets.cpp
android_get_control_file.cpp
threads.c
threads.cpp
fs_config.cpp
canned_fs_config.c
canned_fs_config.cpp
)
libcutils = compile(expand("core/libcutils", cutilsfiles), "-D_GNU_SOURCE -Icore/libcutils/include -Icore/include")

Expand Down Expand Up @@ -173,7 +173,7 @@ def link(output, objects, ldflags)
tcp.cpp
udp.cpp
)
libfastboot = compile(expand("core/fastboot", fastbootfiles), '-DFASTBOOT_VERSION="\"$PKGVER\"" -D_GNU_SOURCE -D_XOPEN_SOURCE=700 -DUSE_F2FS -Icore/base/include -Icore/include -Icore/adb -Icore/libsparse/include -Icore/mkbootimg -Iextras/ext4_utils/include -Iextras/f2fs_utils -Icore/libziparchive/include')
libfastboot = compile(expand("core/fastboot", fastbootfiles), '-DFASTBOOT_VERSION="\"$PKGVER\"" -D_GNU_SOURCE -D_XOPEN_SOURCE=700 -DUSE_F2FS -Icore/base/include -Icore/include -Icore/adb -Icore/libsparse/include -Icore/mkbootimg -Iextras/ext4_utils/include -Iextras/f2fs_utils -Icore/libziparchive/include -Icore/mkbootimg/include/bootimg')

sparsefiles = %w(
backed_block.c
Expand All @@ -186,11 +186,8 @@ def link(output, objects, ldflags)
libsparse = compile(expand("core/libsparse", sparsefiles), "-Icore/libsparse/include -Icore/base/include")

f2fsfiles = %w(
f2fs_utils.c
f2fs_ioutils.c
f2fs_dlutils.c
)
f2fs = compile(expand("extras/f2fs_utils", f2fsfiles), "-Iextras/f2fs_utils -If2fs-tools/include -If2fs-tools/mkfs -Icore/libsparse/include -Iselinux/libselinux/include")
f2fs = compile(expand("extras/f2fs_utils", f2fsfiles), "-DHAVE_LINUX_TYPES_H -If2fs-tools/include -Icore/liblog/include")

zipfiles = %w(
zip_archive.cc
Expand All @@ -203,16 +200,8 @@ def link(output, objects, ldflags)
libutil = compile(expand("core/libutils", utilfiles), "-Icore/include")

ext4files = %w(
make_ext4fs.c
ext4fixup.c
ext4_utils.c
allocate.c
contents.c
extent.c
indirect.c
sha1.c
wipe.c
crc16.c
ext4_sb.c
)
libext4 = compile(expand("extras/ext4_utils", ext4files), "-D_GNU_SOURCE -Icore/libsparse/include -Icore/include -Iselinux/libselinux/include -Iextras/ext4_utils/include")
Expand Down Expand Up @@ -328,6 +317,7 @@ def link(output, objects, ldflags)
lib/ext2fs/get_num_dirs.c
lib/ext2fs/getsectsize.c
lib/ext2fs/getsize.c
lib/ext2fs/hashmap.c
lib/ext2fs/i_block.c
lib/ext2fs/ind_block.c
lib/ext2fs/initialize.c
Expand All @@ -352,6 +342,7 @@ def link(output, objects, ldflags)
lib/ext2fs/read_bb_file.c
lib/ext2fs/res_gdt.c
lib/ext2fs/rw_bitmaps.c
lib/ext2fs/sha512.c
lib/ext2fs/sparse_io.c
lib/ext2fs/symlink.c
lib/ext2fs/undo_io.c
Expand All @@ -374,7 +365,7 @@ def link(output, objects, ldflags)
lib/uuid/unparse.c
misc/create_inode.c
)
libext2fs = compile(expand("e2fsprogs", libext2fsfiles), "-Ie2fsprogs/lib -Icore/libsparse/include")
libext2fs = compile(expand("e2fsprogs", libext2fsfiles), "-Ie2fsprogs/lib -Ie2fsprogs/lib/ext2fs -Icore/libsparse/include")

mke2fsfiles = %w(
misc/default_profile.c
Expand All @@ -390,13 +381,12 @@ def link(output, objects, ldflags)
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")
e2fsdroid = compile(expand("e2fsprogs", e2fsdroidfiles), "-Ie2fsprogs/lib -Ie2fsprogs/lib/ext2fs -Iselinux/libselinux/include -Icore/libcutils/include -Ie2fsprogs/misc")

link("e2fsdroid", e2fsdroid + libext2fs + libsparse + libbase + libzip + liblog + libutil + libselinux + libsepol + libcutils, "-lz -lpthread -lpcre2-8")

Expand All @@ -406,4 +396,3 @@ def link(output, objects, ldflags)
ext2simg = compile(expand("e2fsprogs", ext2simgfiles), "-Ie2fsprogs/lib -Icore/libsparse/include")

link("ext2simg", ext2simg + libext2fs + libsparse + libbase + libzip + liblog + libutil, "-lz -lpthread")

19 changes: 14 additions & 5 deletions extra-android/android-platform-tools/autobuild/patch
@@ -1,3 +1,4 @@
# Adapted from Arch Linux.
git clone https://android.googlesource.com/platform/system/core
cd core; git checkout tags/android-${PKGVER/r/_r}; cd ..
git clone https://android.googlesource.com/platform/system/extras
Expand All @@ -9,10 +10,18 @@ cd f2fs-tools; git checkout tags/android-${PKGVER/r/_r}; cd ..
git clone https://android.googlesource.com/platform/external/e2fsprogs
cd e2fsprogs; git checkout tags/android-${PKGVER/r/_r}; cd ..
git clone https://boringssl.googlesource.com/boringssl
git clone https://android.googlesource.com/platform/external/avb
cd avb; git checkout tags/android-${PKGVER/r/_r}; cd ..

patch -d core -p1 < autobuild/patches/fix_build_core.patch
patch -d selinux -p1 < autobuild/patches/fix_build_selinux.patch
patch -d e2fsprogs -p1 < autobuild/patches/fix_build_e2fsprogs.patch
patch -d boringssl -p1 < autobuild/patches/0001-BoringSSL-add-PPC-defines.patch
PKGVER=$PKGVER LDFLAGS="${LDFLAGS}" ruby autobuild/gen_build.rb > build.ninja

ruby autobuild/gen_build.rb > build.ninja
# FIXME: ppc64be LLVM flags compatibility.
export CFLAGS="${CFLAGS/-maltivec=be/}"
export CFLAGS="${CFLAGS/-msecure-plt/}"
export CXXFLAGS="${CXXFLAGS/-maltivec=be/}"
export CXXFLAGS="${CXXFLAGS/-msecure-plt/}"

# Patches
patch -d "$SRCDIR"/core -p1 < "$SRCDIR"/autobuild/patches/fix_build_core.patch
patch -d "$SRCDIR"/selinux -p1 < "$SRCDIR"/autobuild/patches/fix_build_selinux.patch
patch -d "$SRCDIR"/e2fsprogs -p1 < "$SRCDIR"/autobuild/patches/fix_build_e2fsprogs.patch

This file was deleted.

@@ -1,16 +1,16 @@
diff --git a/adb/client/usb_libusb.cpp b/adb/client/usb_libusb.cpp
index 81201995a0..cfd60fce97 100644
index 46c3f58ec5..a0c36f0151 100644
--- a/adb/client/usb_libusb.cpp
+++ b/adb/client/usb_libusb.cpp
@@ -21,6 +21,7 @@
#include <stdint.h>
@@ -22,6 +22,7 @@
#include <stdlib.h>

#include <atomic>
+#include <condition_variable>
#include <chrono>
#include <condition_variable>
#include <memory>
#include <mutex>
@@ -28,7 +29,7 @@
@@ -30,7 +31,7 @@
#include <thread>
#include <unordered_map>

Expand All @@ -19,8 +19,20 @@ index 81201995a0..cfd60fce97 100644

#include <android-base/file.h>
#include <android-base/logging.h>
diff --git a/adb/client/usb_linux.cpp b/adb/client/usb_linux.cpp
index 1f376a4c93..f1d6779159 100644
--- a/adb/client/usb_linux.cpp
+++ b/adb/client/usb_linux.cpp
@@ -29,6 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
+#include <sys/sysmacros.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/adb/sysdeps/posix/network.cpp b/adb/sysdeps/posix/network.cpp
index 45da5af4a1..ee3bf06994 100644
index ecd1fd24ec..86166c0e2c 100644
--- a/adb/sysdeps/posix/network.cpp
+++ b/adb/sysdeps/posix/network.cpp
@@ -21,6 +21,7 @@
Expand All @@ -44,7 +56,7 @@ index 296995efe2..48269b6750 100644
namespace android {
namespace base {
diff --git a/base/file.cpp b/base/file.cpp
index a2f28878e8..0aa185e972 100644
index 2f697a1cc1..81aef5758c 100644
--- a/base/file.cpp
+++ b/base/file.cpp
@@ -22,6 +22,7 @@
Expand All @@ -56,7 +68,7 @@ index a2f28878e8..0aa185e972 100644
#include <memory>
#include <mutex>
diff --git a/base/logging.cpp b/base/logging.cpp
index 6357b4ba73..3c7dbce131 100644
index a31feefab2..d746cc4d78 100644
--- a/base/logging.cpp
+++ b/base/logging.cpp
@@ -23,6 +23,7 @@
Expand All @@ -68,10 +80,10 @@ 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
index c30ca1e4b3..fdc042ff36 100644
--- a/fastboot/fs.cpp
+++ b/fastboot/fs.cpp
@@ -108,7 +108,7 @@ static int generate_ext4_image(const char* fileName, long long partSize,
@@ -117,7 +117,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();

Expand All @@ -81,15 +93,26 @@ index 709f061bd6..77629a882b 100644

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
index 4379635270..ccb565bb63 100644
--- a/libsparse/sparse_read.cpp
+++ b/libsparse/sparse_read.cpp
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
+#include <string.h>
#include <unistd.h>

#include <sparse/sparse.h>

diff --git a/libziparchive/zip_archive.cc b/libziparchive/zip_archive.cc
index 5e5e7afd18..ebbc819a7a 100644
--- a/libziparchive/zip_archive.cc
+++ b/libziparchive/zip_archive.cc
@@ -29,6 +29,7 @@
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <string_view>

#include <memory>
#include <vector>
@@ -1,5 +1,5 @@
diff --git a/contrib/android/perms.c b/contrib/android/perms.c
index 9ae8e586..433506fd 100644
index d83ad35a..dca5b620 100644
--- a/contrib/android/perms.c
+++ b/contrib/android/perms.c
@@ -5,6 +5,7 @@
Expand Down Expand Up @@ -29,10 +29,10 @@ index 505b3c9c..7be5105f 100644
#ifdef __GNUC__
#define _INLINE_ extern __inline__
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
index e153c817..dcae5947 100644
index 470e7d7a..95a41e0d 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
@@ -1743,7 +1743,7 @@ extern const struct ext2_inode *ext2fs_const_inode(const struct ext2_inode_large
#define _INLINE_ extern
#else
#if (__STDC_VERSION__ >= 199901L)
Expand All @@ -41,4 +41,43 @@ index e153c817..dcae5947 100644
#else
#ifdef __GNUC__
#define _INLINE_ extern __inline__

diff --git a/misc/create_inode.c b/misc/create_inode.c
index 1373b46b..e6f34bd9 100644
--- a/misc/create_inode.c
+++ b/misc/create_inode.c
@@ -403,7 +403,7 @@ static ssize_t my_pread(int fd, void *buf, size_t count, off_t offset)
}
#endif /* !defined HAVE_PREAD64 && !defined HAVE_PREAD */

-static errcode_t copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file,
+static errcode_t e2_copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file,
off_t start, off_t end, char *buf,
char *zerobuf)
{
@@ -477,7 +477,7 @@ static errcode_t try_lseek_copy(ext2_filsys fs, int fd, struct stat *statbuf,

data_blk = data & ~(fs->blocksize - 1);
hole_blk = (hole + (fs->blocksize - 1)) & ~(fs->blocksize - 1);
- err = copy_file_range(fs, fd, e2_file, data_blk, hole_blk, buf,
+ err = e2_copy_file_range(fs, fd, e2_file, data_blk, hole_blk, buf,
zerobuf);
if (err)
return err;
@@ -527,7 +527,7 @@ static errcode_t try_fiemap_copy(ext2_filsys fs, int fd, ext2_file_t e2_file,
}
for (i = 0, ext = ext_buf; i < fiemap_buf->fm_mapped_extents;
i++, ext++) {
- err = copy_file_range(fs, fd, e2_file, ext->fe_logical,
+ err = e2_copy_file_range(fs, fd, e2_file, ext->fe_logical,
ext->fe_logical + ext->fe_length,
buf, zerobuf);
if (err)
@@ -580,7 +580,7 @@ static errcode_t copy_file(ext2_filsys fs, int fd, struct stat *statbuf,
goto out;
#endif

- err = copy_file_range(fs, fd, e2_file, 0, statbuf->st_size, buf,
+ err = e2_copy_file_range(fs, fd, e2_file, 0, statbuf->st_size, buf,
zerobuf);
out:
ext2fs_free_mem(&zerobuf);
Expand Up @@ -24,4 +24,3 @@ index b00251c6..68e7c6a0 100644

struct val_to_name {
unsigned int val;

4 changes: 0 additions & 4 deletions extra-android/android-platform-tools/autobuild/prepare

This file was deleted.

3 changes: 1 addition & 2 deletions extra-android/android-platform-tools/spec
@@ -1,3 +1,2 @@
VER=8.1.0r7
REL=2
VER=9.0.0r30
DUMMYSRC=true

0 comments on commit bca4fc8

Please sign in to comment.