update to 29.0.4 [release 29.0.4-1mamba;Sun Oct 27 2019]

This commit is contained in:
Silvan Calarco 2024-01-05 20:24:02 +01:00
parent b4dde22819
commit 791d201119
10 changed files with 752 additions and 8888 deletions

View File

@ -0,0 +1,103 @@
diff --git a/adb/adb.cpp b/adb/adb.cpp
index 098ed38f30..d0b2e87e7c 100644
--- a/adb/adb.cpp
+++ b/adb/adb.cpp
@@ -44,8 +44,6 @@
#include <android-base/parsenetaddress.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
-#include <build/version.h>
-#include <platform_tools_version.h>
#include "adb_auth.h"
#include "adb_io.h"
@@ -66,10 +64,10 @@ std::string adb_version() {
// Don't change the format of this --- it's parsed by ddmlib.
return android::base::StringPrintf(
"Android Debug Bridge version %d.%d.%d\n"
- "Version %s-%s\n"
+ "Version %s\n"
"Installed as %s\n",
ADB_VERSION_MAJOR, ADB_VERSION_MINOR, ADB_SERVER_VERSION,
- PLATFORM_TOOLS_VERSION, android::build::GetBuildNumber().c_str(),
+ PLATFORM_TOOLS_VERSION,
android::base::GetExecutablePath().c_str());
}
diff --git a/adb/client/main.cpp b/adb/client/main.cpp
index 0c5c28f1b3..b6a1281521 100644
--- a/adb/client/main.cpp
+++ b/adb/client/main.cpp
@@ -118,10 +118,6 @@ int adb_server_main(int is_daemon, const std::string& socket_spec, int ack_reply
init_transport_registration();
init_reconnect_handler();
- if (!getenv("ADB_MDNS") || strcmp(getenv("ADB_MDNS"), "0") != 0) {
- init_mdns_transport_discovery();
- }
-
if (!getenv("ADB_USB") || strcmp(getenv("ADB_USB"), "0") != 0) {
usb_init();
} else {
diff --git a/adb/client/usb_libusb.cpp b/adb/client/usb_libusb.cpp
index 53f01a0ce5..b4c3aadc28 100644
--- a/adb/client/usb_libusb.cpp
+++ b/adb/client/usb_libusb.cpp
@@ -30,7 +30,7 @@
#include <thread>
#include <unordered_map>
-#include <libusb/libusb.h>
+#include <libusb-1.0/libusb.h>
#include <android-base/file.h>
#include <android-base/logging.h>
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index 8923f409df..5cadb9649b 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -58,9 +58,7 @@
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
#include <android-base/unique_fd.h>
-#include <build/version.h>
#include <liblp/liblp.h>
-#include <platform_tools_version.h>
#include <sparse/sparse.h>
#include <ziparchive/zip_archive.h>
@@ -1749,7 +1747,7 @@ int FastBootTool::Main(int argc, char* argv[]) {
setvbuf(stdout, nullptr, _IONBF, 0);
setvbuf(stderr, nullptr, _IONBF, 0);
} else if (name == "version") {
- fprintf(stdout, "fastboot version %s-%s\n", PLATFORM_TOOLS_VERSION, android::build::GetBuildNumber().c_str());
+ fprintf(stdout, "fastboot version %s\n", PLATFORM_TOOLS_VERSION);
fprintf(stdout, "Installed as %s\n", android::base::GetExecutablePath().c_str());
return 0;
#if !defined(_WIN32)
diff --git a/fastboot/fs.cpp b/fastboot/fs.cpp
index 8c0aa6bf4e..3ad5b53568 100644
--- a/fastboot/fs.cpp
+++ b/fastboot/fs.cpp
@@ -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();
- 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/libcutils/include/cutils/threads.h b/libcutils/include/cutils/threads.h
index ba4846e33b..f3fccc4895 100644
--- a/libcutils/include/cutils/threads.h
+++ b/libcutils/include/cutils/threads.h
@@ -33,8 +33,6 @@ extern "C" {
// Deprecated: use android::base::GetThreadId instead, which doesn't truncate on Mac/Windows.
//
-extern pid_t gettid();
-
//
// Deprecated: use `_Thread_local` in C or `thread_local` in C++.
//

View File

@ -0,0 +1,66 @@
diff --git a/core/adb/sysdeps.h b/core/adb/sysdeps.h
index 75dcc86..867f3ec 100644
--- a/core/adb/sysdeps.h
+++ b/core/adb/sysdeps.h
@@ -25,6 +25,7 @@
#endif
#include <errno.h>
+#include <sys/syscall.h>
#include <string>
#include <vector>
@@ -831,7 +832,16 @@ static __inline__ int adb_is_absolute_host_path(const char* path) {
static __inline__ unsigned long adb_thread_id()
{
- return (unsigned long)gettid();
+ // TODO: this function should be merged with GetThreadId
+#if defined(__BIONIC__)
+ return gettid();
+#elif defined(__APPLE__)
+ return syscall(SYS_thread_selfid);
+#elif defined(__linux__)
+ return syscall(__NR_gettid);
+#elif defined(_WIN32)
+ return GetCurrentThreadId();
+#endif
}
#endif /* !_WIN32 */
diff --git a/core/base/errors_unix.cpp b/core/base/errors_unix.cpp
index 296995e..48269b6 100644
--- a/core/base/errors_unix.cpp
+++ b/core/base/errors_unix.cpp
@@ -17,6 +17,7 @@
#include "android-base/errors.h"
#include <errno.h>
+#include <string.h>
namespace android {
namespace base {
diff --git a/core/base/file.cpp b/core/base/file.cpp
index da1adba..91a3901 100644
--- a/core/base/file.cpp
+++ b/core/base/file.cpp
@@ -20,6 +20,7 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <string.h>
#include <string>
diff --git a/core/base/logging.cpp b/core/base/logging.cpp
index 1741871..e97c7f1 100644
--- a/core/base/logging.cpp
+++ b/core/base/logging.cpp
@@ -21,6 +21,7 @@
#include "android-base/logging.h"
#include <libgen.h>
+#include <string.h>
// For getprogname(3) or program_invocation_short_name.
#if defined(__ANDROID__) || defined(__APPLE__)

View File

@ -1,67 +0,0 @@
SRCS+= adb.c
SRCS+= adb_client.c
SRCS+= adb_auth_host.c
SRCS+= commandline.c
SRCS+= console.c
SRCS+= file_sync_client.c
SRCS+= fdevent.c
SRCS+= get_my_path_linux.c
SRCS+= services.c
SRCS+= sockets.c
SRCS+= transport.c
SRCS+= transport_local.c
SRCS+= transport_usb.c
SRCS+= usb_linux.c
SRCS+= usb_vendors.c
VPATH+= ../libcutils
SRCS+= socket_inaddr_any_server.c
SRCS+= socket_local_client.c
SRCS+= socket_local_server.c
SRCS+= socket_loopback_client.c
SRCS+= socket_loopback_server.c
SRCS+= socket_network_client.c
SRCS+= load_file.c
VPATH+= ../libzipfile
SRCS+= centraldir.c
SRCS+= zipfile.c
VPATH+= ../libmincrypt
SRCS+= rsa.c
SRCS+= sha256.c
SRCS+= sha.c
SRCS+= p256.c
SRCS+= p256_ec.c
SRCS+= p256_ecdsa.c
CPPFLAGS+= -DADB_HOST=1
CPPFLAGS+= -DHAVE_FORKEXEC=1
CPPFLAGS+= -DHAVE_SYMLINKS
CPPFLAGS+= -DHAVE_TERMIO_H
CPPFLAGS+= -D_GNU_SOURCE
CPPFLAGS+= -D_XOPEN_SOURCE
CPPFLAGS+= -D_FILE_OFFSET_BITS=64
CPPFLAGS+= -DHAVE_OFF64_T
CPPFLAGS+= -I.
CPPFLAGS+= -I../include
CFLAGS+= $(RPM_OPT_FLAGS)
LIBS= -lrt -lpthread -lz -lcrypto
LDFLAGS+= $(RPM_LD_FLAGS)
CC= $(TOOLCHAIN)gcc
LD= $(TOOLCHAIN)gcc
OBJS= $(SRCS:.c=.o)
all: adb
adb: $(OBJS)
$(LD) -o $@ $(LDFLAGS) $(OBJS) $(LIBS)
install: adb
install adb $(DESTDIR)$(BINDIR)
clean:
rm -rf $(OBJS)

View File

@ -1,11 +0,0 @@
all:
$(MAKE) -C adb all
$(MAKE) -C fastboot all
install:
$(MAKE) -C adb install
$(MAKE) -C fastboot install
clean:
$(MAKE) -C adb clean
$(MAKE) -C fastboot clean

View File

@ -1,72 +0,0 @@
SRCS+= protocol.c
SRCS+= engine.c
SRCS+= bootimg.c
SRCS+= fastboot.c
SRCS+= usb_linux.c
SRCS+= util_linux.c
SRCS+= util.c
SRCS+= fs.c
VPATH+= ../libzipfile
SRCS+= centraldir.c
SRCS+= zipfile.c
VPATH+= ../libsparse
SRCS+= backed_block.c
SRCS+= output_file.c
SRCS+= sparse.c
SRCS+= sparse_crc32.c
SRCS+= sparse_err.c
SRCS+= sparse_read.c
VPATH+= ../../extras/ext4_utils
SRCS+= allocate.c
SRCS+= contents.c
SRCS+= ext4_utils.c
SRCS+= extent.c
SRCS+= indirect.c
SRCS+= make_ext4fs.c
SRCS+= sha1.c
SRCS+= uuid.c
SRCS+= wipe.c
SRCS+= crc16.c
SRCS+= ext4_sb.c
VPATH+= ../../extras/f2fs_utils
SRCS+= f2fs_ioutils.c
CPPFLAGS+= -DADB_HOST=1
CPPFLAGS+= -DHAVE_FORKEXEC=1
CPPFLAGS+= -DHAVE_SYMLINKS
CPPFLAGS+= -DHAVE_TERMIO_H
CPPFLAGS+= -D_GNU_SOURCE
CPPFLAGS+= -D_XOPEN_SOURCE
CPPFLAGS+= -D_FILE_OFFSET_BITS=64
CPPFLAGS+= -DHAVE_OFF64_T
CPPFLAGS+= -DHAVE_SYS_UIO_H
CPPFLAGS+= -I.
CPPFLAGS+= -I../include
CPPFLAGS+= -I../libsparse/include
CPPFLAGS+= -I../mkbootimg
CPPFLAGS+= -I../../extras/ext4_utils
CPPFLAGS+= -I../../extras/f2fs_utils
CFLAGS+= $(RPM_OPT_FLAGS) -std=gnu99
LIBS= -lrt -lpthread -lz -lselinux
LDFLAGS+= $(RPM_LD_FLAGS)
CC= $(TOOLCHAIN)gcc
LD= $(TOOLCHAIN)gcc
OBJS= $(SRCS:.c=.o)
all: fastboot
fastboot: $(OBJS)
$(LD) -o $@ $(LDFLAGS) $(OBJS) $(LIBS)
install: fastboot
install fastboot $(DESTDIR)$(BINDIR)
clean:
rm -rf $(OBJS)

View File

@ -1,14 +0,0 @@
# Systemd unit file for adb
[Unit]
Description=Android Debug Bridge (adb) service
[Service]
Type=forking
ExecStart=/usr/bin/adb start-server
ExecStop=/usr/bin/adb kill-server
PrivateTmp=yes
Environment=HOME=/var/lib/adb
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,90 @@
## Bash completion for the Android SDK tools.
##
## Copyright (c) 2009 Matt Brubeck
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
## in the Software without restriction, including without limitation the rights
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
## copies of the Software, and to permit persons to whom the Software is
## furnished to do so, subject to the following conditions:
##
## The above copyright notice and this permission notice shall be included in
## all copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
## THE SOFTWARE.
function _fastboot()
{
local cur prev opts cmds c subcommand device_selected
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="-w -s -p -c -i -b -n"
cmds="update flashall flash erase getvar boot devices \
reboot reboot-bootloader oem continue"
subcommand=""
partition_list="boot recovery system userdata bootloader radio"
device_selected=""
# Look for the subcommand.
c=1
while [ $c -lt $COMP_CWORD ]; do
word="${COMP_WORDS[c]}"
if [ "$word" = "-s" ]; then
device_selected=true
fi
for cmd in $cmds; do
if [ "$cmd" = "$word" ]; then
subcommand="$word"
fi
done
c=$((++c))
done
case "${subcommand}" in
'')
case "${prev}" in
-s)
# Use 'fastboot devices' to list serial numbers.
COMPREPLY=( $(compgen -W "$(fastboot devices|cut -f1)" -- ${cur} ) )
return 0
;;
esac
case "${cur}" in
-*)
COMPREPLY=( $(compgen -W "$opts" -- ${cur}) )
return 0
;;
esac
if [ -z "$device_selected" ]; then
local num_devices=$(( $(fastboot devices 2>/dev/null|wc -l) ))
if [ "$num_devices" -gt "1" ]; then
# With multiple devices, you must choose a device first.
COMPREPLY=( $(compgen -W "-s" -- ${cur}) )
return 0
fi
fi
COMPREPLY=( $(compgen -W "${cmds}" -- ${cur}) )
return 0
;;
flash)
# partition name
COMPREPLY=( $(compgen -W "${partition_list}" -- ${cur}) )
return 0
;;
erase)
# partition name
COMPREPLY=( $(compgen -W "${partition_list}" -- ${cur}) )
return 0
;;
esac
}
complete -o default -F _fastboot fastboot

View File

@ -0,0 +1,412 @@
#!/usr/bin/ruby
# Android build system is complicated and does not allow to build
# separate parts easily.
# This script tries to mimic Android build rules.
def expand(dir, files)
files.map { |f| File.join(dir, f) }
end
# Compiles sources to *.o files.
# Returns array of output *.o filenames
def compile(sources, cflags)
outputs = []
for s in sources
ext = File.extname(s)
case ext
when ".c"
cc = "cc"
lang_flags = "-std=gnu11 $CFLAGS $CPPFLAGS"
when ".cpp", ".cc"
cc = "cxx"
lang_flags = "-std=gnu++2a $CXXFLAGS $CPPFLAGS"
else
raise "Unknown extension #{ext}"
end
output = s + ".o"
outputs << output
puts "build #{output}: #{cc} #{s}\n cflags = #{lang_flags} #{cflags}"
end
return outputs
end
# dir - directory where ninja file is located
# lib - static library path relative to dir
def subninja(dir, lib)
puts "subninja #{dir}build.ninja"
return lib.each { |l| dir + l }
end
# Links object files
def link(output, objects, ldflags)
puts "build #{output}: link #{objects.join(" ")}\n ldflags = #{ldflags} $LDFLAGS"
end
puts "# This set of commands generated by generate_build.rb script\n\n"
puts "CC = #{ENV["CC"] || "clang"}"
puts "CXX = #{ENV["CXX"] || "clang++"}\n\n"
puts "CFLAGS = #{ENV["CFLAGS"]}"
puts "CXXFLAGS = #{ENV["CXXFLAGS"]}"
puts "LDFLAGS = #{ENV["LDFLAGS"]}"
puts "PLATFORM_TOOLS_VERSION = #{ENV["PLATFORM_TOOLS_VERSION"]}\n\n"
puts "" "
rule cc
command = $CC $cflags -c $in -o $out
rule cxx
command = $CXX $cflags -c $in -o $out
rule link
command = $CXX $ldflags $LDFLAGS $in -o $out
" ""
adbdfiles = %w(
adb.cpp
adb_io.cpp
adb_listeners.cpp
adb_trace.cpp
adb_utils.cpp
sockets.cpp
transport.cpp
transport_local.cpp
transport_usb.cpp
fdevent/fdevent.cpp
fdevent/fdevent_poll.cpp
shell_service_protocol.cpp
)
libadbd = compile(expand("core/adb", adbdfiles), '-DPLATFORM_TOOLS_VERSION="\"$PLATFORM_TOOLS_VERSION\"" -DADB_HOST=1 -Icore/include -Icore/base/include -Icore/adb -Icore/libcrypto_utils/include -Iboringssl/include -Icore/diagnose_usb/include')
adbfiles = %w(
socket_spec.cpp
services.cpp
sysdeps_unix.cpp
sysdeps/errno.cpp
client/main.cpp
client/adb_client.cpp
client/auth.cpp
client/commandline.cpp
client/usb_dispatch.cpp
client/usb_linux.cpp
client/usb_libusb.cpp
client/bugreport.cpp
client/file_sync_client.cpp
client/line_printer.cpp
client/adb_install.cpp
client/console.cpp
sysdeps/posix/network.cpp
)
libadb = compile(expand("core/adb", adbfiles), "-D_GNU_SOURCE -DADB_HOST=1 -Icore/include -Icore/base/include -Icore/adb -Icore/libcrypto_utils/include -Iboringssl/include")
basefiles = %w(
file.cpp
logging.cpp
threads.cpp
mapped_file.cpp
parsenetaddress.cpp
stringprintf.cpp
strings.cpp
errors_unix.cpp
test_utils.cpp
chrono_utils.cpp
)
libbase = compile(expand("core/base", basefiles), "-DADB_HOST=1 -Icore/base/include -Icore/include")
logfiles = %w(
log_event_write.cpp
fake_log_device.cpp
log_event_list.cpp
logger_write.cpp
config_write.cpp
config_read.cpp
logger_lock.cpp
fake_writer.cpp
logger_name.cpp
stderr_write.cpp
logprint.cpp
)
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.cpp
socket_local_client_unix.cpp
socket_network_client_unix.cpp
socket_local_server_unix.cpp
sockets_unix.cpp
socket_inaddr_any_server_unix.cpp
sockets.cpp
android_get_control_file.cpp
threads.cpp
fs_config.cpp
canned_fs_config.cpp
)
libcutils = compile(expand("core/libcutils", cutilsfiles), "-D_GNU_SOURCE -Icore/libcutils/include -Icore/include -Icore/base/include")
diagnoseusbfiles = %w(
diagnose_usb.cpp
)
libdiagnoseusb = compile(expand("core/diagnose_usb", diagnoseusbfiles), "-Icore/include -Icore/base/include -Icore/diagnose_usb/include")
libcryptofiles = %w(
android_pubkey.c
)
libcrypto = compile(expand("core/libcrypto_utils", libcryptofiles), "-Icore/libcrypto_utils/include -Iboringssl/include")
# TODO: make subninja working
#boringssl = subninja('boringssl/build/', ['crypto/libcrypto.a'])
boringssl = ["boringssl/build/crypto/libcrypto.a"]
link("adb", libbase + liblog + libcutils + libadbd + libadb + libdiagnoseusb + libcrypto + boringssl, "-lpthread -lusb-1.0")
fastbootfiles = %w(
bootimg_utils.cpp
fastboot.cpp
util.cpp
fs.cpp
usb_linux.cpp
socket.cpp
tcp.cpp
udp.cpp
main.cpp
fastboot_driver.cpp
)
libfastboot = compile(expand("core/fastboot", fastbootfiles), '-DPLATFORM_TOOLS_VERSION="\"$PLATFORM_TOOLS_VERSION\"" -D_GNU_SOURCE -D_XOPEN_SOURCE=700 -DUSE_F2FS -Icore/base/include -Icore/include -Icore/adb -Icore/libsparse/include -Imkbootimg/include/bootimg -Iextras/ext4_utils/include -Iextras/f2fs_utils -Icore/libziparchive/include -Icore/fs_mgr/liblp/include -Icore/diagnose_usb/include')
fsmgrfiles = %w(
liblp/reader.cpp
liblp/writer.cpp
liblp/utility.cpp
liblp/partition_opener.cpp
liblp/images.cpp
)
libfsmgr = compile(expand("core/fs_mgr", fsmgrfiles), '-Icore/fs_mgr/liblp/include -Icore/base/include -Iextras/ext4_utils/include -Icore/libsparse/include')
sparsefiles = %w(
backed_block.cpp
output_file.cpp
sparse.cpp
sparse_crc32.cpp
sparse_err.cpp
sparse_read.cpp
)
libsparse = compile(expand("core/libsparse", sparsefiles), "-Icore/libsparse/include -Icore/base/include")
f2fsfiles = %w(
)
f2fs = compile(expand("extras/f2fs_utils", f2fsfiles), "-DHAVE_LINUX_TYPES_H -If2fs-tools/include -Icore/liblog/include")
zipfiles = %w(
zip_archive.cc
)
libzip = compile(expand("core/libziparchive", zipfiles), "-Icore/base/include -Icore/include -Icore/libziparchive/include")
utilfiles = %w(
FileMap.cpp
)
libutil = compile(expand("core/libutils", utilfiles), "-Icore/include")
ext4files = %w(
ext4_utils.cpp
wipe.cpp
ext4_sb.cpp
)
libext4 = compile(expand("extras/ext4_utils", ext4files), "-D_GNU_SOURCE -Icore/libsparse/include -Icore/include -Iselinux/libselinux/include -Iextras/ext4_utils/include -Icore/base/include")
selinuxfiles = %w(
callbacks.c
check_context.c
freecon.c
init.c
label.c
label_file.c
label_support.c
setrans_client.c
regex.c
matchpathcon.c
selinux_config.c
label_backends_android.c
canonicalize_context.c
lsetfilecon.c
policyvers.c
lgetfilecon.c
load_policy.c
seusers.c
sha1.c
booleans.c
disable.c
enabled.c
getenforce.c
setenforce.c
)
libselinux = compile(expand("selinux/libselinux/src", selinuxfiles), "-DAUDITD_LOG_TAG=1003 -D_GNU_SOURCE -DHOST -DUSE_PCRE2 -DNO_PERSISTENTLY_STORED_PATTERNS -DDISABLE_SETRANS -DDISABLE_BOOL -DNO_MEDIA_BACKEND -DNO_X_BACKEND -DNO_DB_BACKEND -DPCRE2_CODE_UNIT_WIDTH=8 -Iselinux/libselinux/include -Iselinux/libsepol/include")
libsepolfiles = %w(
policydb_public.c
genbools.c
debug.c
policydb.c
conditional.c
services.c
ebitmap.c
util.c
assertion.c
avtab.c
hashtab.c
sidtab.c
context.c
genusers.c
context_record.c
mls.c
avrule_block.c
symtab.c
policydb_convert.c
write.c
constraint.c
expand.c
hierarchy.c
kernel_to_common.c
)
libsepol = compile(expand("selinux/libsepol/src", libsepolfiles), "-Iselinux/libsepol/include -Iselinux/libsepol/src")
link("fastboot", libfsmgr + libsparse + libzip + libcutils + liblog + libutil + libbase + libext4 + f2fs + libselinux + libsepol + libfastboot + libdiagnoseusb + boringssl, "-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/hashmap.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/sha512.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/clear.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 -Ie2fsprogs/lib/ext2fs -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/base_fs.c
contrib/android/fsmap.c
contrib/android/block_list.c
contrib/android/perms.c
)
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")
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")

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
%define _boringssl_commit %(curl https://android.googlesource.com/platform/external/boringssl/+/refs/tags/platform-tools-%{version}/BORINGSSL_REVISION?format=TEXT | base64 -d)
Name: android-tools
Version: 5.1.1_r37
Version: 29.0.4
Release: 1mamba
Summary: Android platform tools
Group: System/Tools
@ -7,21 +8,27 @@ Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://source.android.com
Source: https://android.googlesource.com/platform/system/core.git/android-%{version}/core-%{version}.tar.bz2
Source6: https://android.googlesource.com/platform/system/extras.git/android-%{version}/extras-%{version}.tar.bz2
# Following files come from: http://pkgs.fedoraproject.org/cgit/android-tools.git/plain/
Source1: %{name}-rules
Source2: %{name}-Makefile-core
Source3: %{name}-Makefile-adb
Source4: %{name}-Makefile-fastboot
Source5: android-tools-adb.service
#Source5: %{name}-autoupdate
Source0: https://android.googlesource.com/platform/system/core.git/platform-tools-%{version}/core-%{version}.tar.bz2
Source1: https://android.googlesource.com/platform/system/extras.git/platform-tools-%{version}/extras-%{version}.tar.bz2
Source2: https://android.googlesource.com/platform/system/tools/mkbootimg.git/platform-tools-%{version}/mkbootimg-%{version}.tar.bz2
Source3: https://android.googlesource.com/platform/external/selinux.git/platform-tools-%{version}/selinux-%{version}.tar.bz2
Source4: https://android.googlesource.com/platform/external/f2fs-tools.git/platform-tools-%{version}/f2fs-tools-%{version}.tar.bz2
Source5: https://android.googlesource.com/platform/external/e2fsprogs.git/platform-tools-%{version}/e2fsprogs-%{version}.tar.bz2
Source6: https://android.googlesource.com/platform/external/avb.git/platform-tools-%{version}/avb-%{version}.tar.bz2
Source7: https://boringssl.googlesource.com/boringssl.git/master@%{_boringssl_commit}/boringssl-%{version}.tar.bz2
# From arch linux
Source20: android-tools-generate_build.rb
Source21: android-tools-bash_completion.fastboot
Patch0: android-tools-5.0.2_r1-remove-selinux-header.patch
Patch1: android-tools-7.1.1_r13-fix-build.patch
Patch2: android-tools-29.0.4-build-core.patch
License: Apache License 2.0, BSD
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libopenssl-devel
BuildRequires: libselinux-devel
BuildRequires: libgcc
BuildRequires: libpcre2-devel
BuildRequires: libstdc++6-devel
BuildRequires: libusb-devel
BuildRequires: libz-devel
## AUTOBUILDREQ-END
BuildRequires: libf2fs-devel
@ -48,82 +55,94 @@ Group: System/Kernel and Hardware
mkbootims is a command line tool useful for creating kernel bootable images for the Android boot loader.
This package also includes mkbootfs.
%debug_package
%prep
%setup -q -c -a6
#-a7
%setup -q -c -a1 -a2 -a3 -a4 -a5 -a6 -a7
#% setup -q -c -D -T
#:<< _EOF
mv core-%{version} core
mv extras-%{version} extras
mv mkbootimg-%{version} mkbootimg
mv selinux-%{version} selinux
mv f2fs-tools-%{version} f2fs-tools
mv e2fsprogs-%{version} e2fsprogs
mv avb-%{version} avb
mv boringssl-%{version} boringssl
cd extras
%patch0 -p1
cd core
%patch2 -p1
cd ..
#_EOF
cd ../core
#mv android-tools-external-libselinux-%{version} libselinux
cp -p %{S:2} Makefile
cp -p %{S:3} adb/Makefile
cp -p %{S:4} fastboot/Makefile
cp -p %{S:20} generate_build.rb
%ifnarch x86_64
# Does not build on 32 bit
sed -i "s|libfastboot = |#libfastboot =|" generate_build.rb
sed -i "s|libfsmgr = |#libfsmgr =|" generate_build.rb
sed -i "s|link(\"fastboot|#link\(\"fastboot|" generate_build.rb
%endif
chmod +x generate_build.rb
PLATFORM_TOOLS_VERSION="%{version}-%{release}" LDFLAGS='-Wl,-z,relro,-z,now' ./generate_build.rb > build.ninja
%build
cd core
%make -j1 TOOLCHAIN=%{_target_platform}-
cd boringssl
%cmake -dbuild \
-DBUILD_SHARED_LIBS:BOOL=OFF \
-GNinja
(cd libmincrypt
%{_host}-gcc -c *.c -I../include
%{_host}-ar rcs libmincrypt.a *.o)
ninja crypto/libcrypto.a
cd ../..
(cd mkbootimg
%{_host}-gcc mkbootimg.c -o mkbootimg -I../include ../libmincrypt/libmincrypt.a)
(cd cpio
%{_host}-gcc mkbootfs.c -o mkbootfs -I../include)
ninja
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
cd core
install -D -m0755 adb/adb \
%{buildroot}%{_bindir}/adb
install -D -m0755 fastboot/fastboot \
%{buildroot}%{_bindir}/fastboot
install -D -m0755 mkbootimg/mkbootimg \
%{buildroot}%{_bindir}/mkbootimg
install -D -m0755 cpio/mkbootfs \
%{buildroot}%{_bindir}/mkbootfs
install -D -m0644 %{S:1} \
%{buildroot}/lib/udev/rules.d/51-android.rules
install -D -m0644 %{S:5} \
%{buildroot}%{_unitdir}/adb.service
for f in adb mke2fs.android e2fsdroid ext2simg; do
install -D -m0755 ${f} %{buildroot}%{_bindir}/${f}
done
%ifarch x86_64
install -D -m0755 fastboot %{buildroot}%{_bindir}/fastboot
%endif
install -D -m0755 avb/avbtool %{buildroot}%{_bindir}/avbtool
install -D -m0755 mkbootimg/mkbootimg.py %{buildroot}%{_bindir}/mkbootimg
install -D -m0755 mkbootimg/unpack_bootimg.py %{buildroot}%{_bindir}/unpack_bootimg
install -Dm 644 %{SOURCE21} %{buildroot}%{_datadir}/bash-completion/completions/fastboot
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%post
%systemd_post adb.service
:
%preun
%systemd_preun adb.service
:
%postun
%systemd_postun_with_restart adb.service
:
%files
%defattr(-,root,root)
%{_bindir}/avbtool
%{_bindir}/adb
%{_bindir}/e2fsdroid
%{_bindir}/ext2simg
%ifarch x86_64
%{_bindir}/fastboot
/lib/udev/rules.d/51-android.rules
%{_unitdir}/adb.service
%doc core/adb/*.TXT core/adb/NOTICE core/adb/*.txt
%endif
%{_bindir}/mke2fs.android
%{_bindir}/unpack_bootimg
%{_datadir}/bash-completion/completions/fastboot
%doc avb/LICENSE
%files -n mkbootimg
%defattr(-,root,root)
%{_bindir}/mkbootimg
%{_bindir}/mkbootfs
%changelog
* Sun Oct 27 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 29.0.4-1mamba
- update to 29.0.4
* Sat Jun 17 2017 Automatic Build System <autodist@mambasoft.it> 7.1.2_r6-1mamba
- automatic version update by autodist
* Fri Jan 13 2017 Silvan Calarco <silvan.calarco@mambasoft.it> 7.1.1_r13-1mamba
- update to 7.1.1_r13
* Mon Jul 04 2016 Silvan Calarco <silvan.calarco@mambasoft.it> 5.1.1_r37-1mamba
- update to 5.1.1_r37
- add permissions 0666 in udev rules