Browse Source

Upgrade android-tools

master
mid-kid 7 years ago
parent
commit
cea4ef98dd
  1. 10
      satellites/android-tools.sat
  2. 112
      satellites/extrafiles/android-tools/Makefile
  3. 107
      satellites/extrafiles/android-tools/fix_core.patch

10
satellites/android-tools.sat

@ -1,20 +1,14 @@
import 'vcs/git'
name=android-tools
version=7.1.2_r17
version=8.1.0_r18
vcs_git -Vr "android-$version" 'https://android.googlesource.com/platform/system/core'
vcs_git -Vr "android-$version" 'https://android.googlesource.com/platform/system/extras'
vcs_git -Vr "android-$version" 'https://android.googlesource.com/platform/external/libselinux'
vcs_git -Vr "android-$version" 'https://android.googlesource.com/platform/external/f2fs-tools'
vcs_git -Vr "android-$version" 'https://android.googlesource.com/platform/external/boringssl'
extrafile 'Makefile'
extrafile 'fix_core.patch'
_
( cd core
patch -p0 -i ../fix_core.patch
)
make \
VERSION="$version"
MYCFLAGS="$CFLAGS" \

112
satellites/extrafiles/android-tools/Makefile

@ -1,20 +1,24 @@
# Created for android-7.0.0_r13
# Created for android-8.1.0_r18
CFLAGS := -O3 -fdata-sections -ffunction-sections -flto \
-DFASTBOOT_REVISION='"$(VERSION)"' \
-DADB_REVISION='"$(VERSION)"' \
-DADB_HOST=1 \
-DFAKE_LOG_DEVICE=1 \
CFLAGS := -O2 -fdata-sections -ffunction-sections -flto \
-DADB_HOST \
-DADB_VERSION='"$(VERSION)"' \
-DFAKE_LOG_DEVICE \
-DFASTBOOT_VERSION='"$(VERSION)"' \
-D_GNU_SOURCE \
-D_Nonnull= \
-D_Nullable= \
-I boringssl/include \
-I core/adb \
-I core/base/include \
-I core/include \
-I core/libcrypto_utils/include \
-I core/libsparse/include \
-I core/libziparchive/include \
-I core/mkbootimg \
-I extras/ext4_utils \
-I extras/ext4_utils/include \
-I extras/f2fs_utils \
-I f2fs-tools/include \
-I f2fs-tools/mkfs \
-I libselinux/include \
-include string.h
CXXFLAGS := -std=gnu++14 -fpermissive \
$(CFLAGS)
@ -23,6 +27,14 @@ CFLAGS += $(MYCFLAGS)
CXXFLAGS += $(MYCXXFLAGS)
FASTBOOT_OBJECTS := \
core/adb/diagnose_usb.o \
core/base/errors_unix.o \
core/base/file.o \
core/base/logging.o \
core/base/parsenetaddress.o \
core/base/stringprintf.o \
core/base/strings.o \
core/base/test_utils.o \
core/fastboot/bootimg_utils.o \
core/fastboot/engine.o \
core/fastboot/fastboot.o \
@ -33,22 +45,11 @@ FASTBOOT_OBJECTS := \
core/fastboot/udp.o \
core/fastboot/usb_linux.o \
core/fastboot/util.o \
core/fastboot/util_linux.o \
core/adb/diagnose_usb.o \
core/base/errors_unix.o \
core/base/file.o \
core/base/parsenetaddress.o \
core/base/stringprintf.o \
core/base/strings.o \
core/libcutils/socket_inaddr_any_server_unix.o \
core/libcutils/socket_local_client_unix.o \
core/libcutils/socket_network_client_unix.o \
core/libcutils/sockets.o \
core/libcutils/sockets_unix.o \
core/liblog/config_write.o \
core/liblog/fake_log_device.o \
core/liblog/fake_writer.o \
core/liblog/log_event_list.o \
core/liblog/logger_lock.o \
core/liblog/logger_name.o \
core/liblog/logger_write.o \
@ -59,31 +60,10 @@ FASTBOOT_OBJECTS := \
core/libsparse/sparse_err.o \
core/libsparse/sparse_read.o \
core/libutils/FileMap.o \
core/libziparchive/zip_archive.o \
extras/ext4_utils/allocate.o \
extras/ext4_utils/contents.o \
extras/ext4_utils/crc16.o \
extras/ext4_utils/ext4_sb.o \
extras/ext4_utils/ext4_utils.o \
extras/ext4_utils/extent.o \
extras/ext4_utils/indirect.o \
extras/ext4_utils/make_ext4fs.o \
extras/ext4_utils/sha1.o \
extras/ext4_utils/wipe.o \
extras/f2fs_utils/f2fs_dlutils.o \
extras/f2fs_utils/f2fs_ioutils.o \
libselinux/src/callbacks.o \
libselinux/src/check_context.o \
libselinux/src/freecon.o \
libselinux/src/init.o \
libselinux/src/label.o \
libselinux/src/label_android_property.o \
libselinux/src/label_file.o \
libselinux/src/label_support.o
core/libziparchive/zip_archive.o
ADB_OBJECTS := \
core/adb/adb.o \
core/adb/adb_auth.o \
core/adb/adb_auth_host.o \
core/adb/adb_client.o \
core/adb/adb_io.o \
@ -92,51 +72,67 @@ ADB_OBJECTS := \
core/adb/adb_utils.o \
core/adb/bugreport.o \
core/adb/client/main.o \
core/adb/client/usb_dispatch.o \
core/adb/client/usb_libusb.o \
core/adb/client/usb_linux.o \
core/adb/commandline.o \
core/adb/console.o \
core/adb/diagnose_usb.o \
core/adb/fdevent.o \
core/adb/file_sync_client.o \
core/adb/get_my_path_linux.o \
core/adb/line_printer.o \
core/adb/services.o \
core/adb/shell_service_protocol.o \
core/adb/socket_spec.o \
core/adb/sockets.o \
core/adb/sysdeps/errno.o \
core/adb/sysdeps/posix/network.o \
core/adb/sysdeps_unix.o \
core/adb/transport.o \
core/adb/transport_local.o \
core/adb/transport_mdns_unsupported.o \
core/adb/transport_usb.o \
core/adb/usb_linux.o \
core/base/file.o \
core/base/logging.o \
core/base/parsenetaddress.o \
core/base/stringprintf.o \
core/base/strings.o \
core/libcutils/load_file.o \
core/libcrypto_utils/android_pubkey.o \
core/libcutils/socket_inaddr_any_server_unix.o \
core/libcutils/socket_local_client_unix.o \
core/libcutils/socket_local_server_unix.o \
core/libcutils/socket_loopback_client_unix.o \
core/libcutils/socket_loopback_server_unix.o \
core/libcutils/socket_network_client_unix.o \
core/libcutils/sockets.o \
core/libcutils/threads.o \
core/liblog/config_write.o \
core/liblog/fake_log_device.o \
core/liblog/fake_writer.o \
core/liblog/log_event_list.o \
core/liblog/logger_lock.o \
core/liblog/logger_name.o \
core/liblog/logger_write.o
$(patsubst %.S, %.o, $(patsubst %.c, %.o, $(addprefix boringssl/, $(shell awk ' \
/^ name: "libcrypto_sources",$$/ { flag += 1; next } \
/^ linux_x86_64: {$$/ { flag += 2; next } \
/^ *srcs: \[$$/ { flag += 1; next } \
/^ *],$$/ { if (flag >= 3) exit; else flag = 0 } \
flag >= 2 { print gensub(/^ *"(.*)",$$/, "\\1", "g") }' \
boringssl/sources.bp))))
.PHONY: all
all: fastboot adb
.PHONY: clean
clean:
rm -f fastboot $(FASTBOOT_OBJECTS) adb $(ADB_OBJECTS)
rm -rf fastboot $(FASTBOOT_OBJECTS) adb $(ADB_OBJECTS) fake_includes
fastboot: $(FASTBOOT_OBJECTS)
$(LINK.o) $(OUTPUT_OPTION) -Wl,--gc-sections -flto -lstdc++ -lpthread -lz $^
$(LINK.o) $(OUTPUT_OPTION) $^ -Wl,--gc-sections -flto -lstdc++ -lpthread -lz
adb: $(ADB_OBJECTS)
$(LINK.o) $(OUTPUT_OPTION) -Wl,--gc-sections -flto -lstdc++ -lm -lpthread -lcrypto $^
$(LINK.o) $(OUTPUT_OPTION) $^ -Wl,--gc-sections -flto -lstdc++ -lpthread -lm -lusb-1.0
# Shitty hack to create some fake includes to fix some things without directly patching the source.
$(FASTBOOT_OBJECTS) $(ADB_OBJECTS): fake_includes
$(FASTBOOT_OBJECTS) $(ADB_OBJECTS): CFLAGS += -I fake_includes
$(FASTBOOT_OBJECTS) $(ADB_OBJECTS): CXXFLAGS += -I fake_includes -isystem fake_includes/atomic
fake_includes:
mkdir -p $@/gtest $@/atomic
echo "#define FRIEND_TEST(...)" > $@/gtest/gtest_prod.h
ln -s /usr/include/libusb-1.0 $@/libusb
echo "#include <atomic>" >> $@/atomic/stdatomic.h
echo "#define _Atomic(T) atomic<T>" >> $@/atomic/stdatomic.h
echo "using namespace std;" >> $@/atomic/stdatomic.h

107
satellites/extrafiles/android-tools/fix_core.patch

@ -1,107 +0,0 @@
+++ adb/adb_client.h
@@ -25,8 +25,8 @@
// Connect to adb, connect to the named service, and return a valid fd for
// interacting with that service upon success or a negative number on failure.
-int adb_connect(const std::string& service, std::string* _Nonnull error);
-int _adb_connect(const std::string& service, std::string* _Nonnull error);
+int adb_connect(const std::string& service, std::string* error);
+int _adb_connect(const std::string& service, std::string* error);
// Connect to adb, connect to the named service, returns true if the connection
// succeeded AND the service returned OKAY. Outputs any returned error otherwise.
@@ -34,36 +34,36 @@ bool adb_command(const std::string& service);
// Connects to the named adb service and fills 'result' with the response.
// Returns true on success; returns false and fills 'error' on failure.
-bool adb_query(const std::string& service, std::string* _Nonnull result,
- std::string* _Nonnull error);
+bool adb_query(const std::string& service, std::string* result,
+ std::string* error);
// Set the preferred transport to connect to.
-void adb_set_transport(TransportType type, const char* _Nullable serial);
+void adb_set_transport(TransportType type, const char* serial);
// Get the preferred transport to connect to.
-void adb_get_transport(TransportType* _Nullable type, const char* _Nullable* _Nullable serial);
+void adb_get_transport(TransportType* type, const char** serial);
// Set TCP specifics of the transport to use.
void adb_set_tcp_specifics(int server_port);
// Set TCP Hostname of the transport to use.
-void adb_set_tcp_name(const char* _Nullable hostname);
+void adb_set_tcp_name(const char* hostname);
// Send commands to the current emulator instance. Will fail if there is not
// exactly one emulator connected (or if you use -s <serial> with a <serial>
// that does not designate an emulator).
-int adb_send_emulator_command(int argc, const char* _Nonnull* _Nonnull argv,
- const char* _Nullable serial);
+int adb_send_emulator_command(int argc, const char** argv,
+ const char* serial);
// Reads a standard adb status response (OKAY|FAIL) and returns true in the
// event of OKAY, false in the event of FAIL or protocol error.
-bool adb_status(int fd, std::string* _Nonnull error);
+bool adb_status(int fd, std::string* error);
// Create a host command corresponding to selected transport type/serial.
-std::string format_host_command(const char* _Nonnull command, TransportType type,
- const char* _Nullable serial);
+std::string format_host_command(const char* command, TransportType type,
+ const char* serial);
// Get the feature set of the current preferred transport.
-bool adb_get_feature_set(FeatureSet* _Nonnull feature_set, std::string* _Nonnull error);
+bool adb_get_feature_set(FeatureSet* feature_set, std::string* error);
#endif
+++ base/errors_unix.cpp
@@ -17,6 +17,7 @@
#include "android-base/errors.h"
#include <errno.h>
+#include <cstring>
namespace android {
namespace base {
+++ base/file.cpp
@@ -21,7 +21,7 @@
#include <sys/stat.h>
#include <sys/types.h>
-#include <string>
+#include <cstring>
#include "android-base/macros.h" // For TEMP_FAILURE_RETRY on Darwin.
#include "android-base/utf8.h"
+++ base/logging.cpp
@@ -32,7 +32,7 @@
#include <iostream>
#include <limits>
#include <sstream>
-#include <string>
+#include <cstring>
#include <utility>
#include <vector>
+++ fastboot/socket.h
@@ -41,7 +41,6 @@
#include <android-base/macros.h>
#include <cutils/sockets.h>
-#include <gtest/gtest_prod.h>
// Socket interface to be implemented for each platform.
class Socket {
@@ -120,8 +119,6 @@ class Socket {
socket_send_buffers_function_ = &socket_send_buffers;
private:
- FRIEND_TEST(SocketTest, TestTcpSendBuffers);
- FRIEND_TEST(SocketTest, TestUdpSendBuffers);
DISALLOW_COPY_AND_ASSIGN(Socket);
};
Loading…
Cancel
Save