2018-07-17 20:14:01 +02:00
|
|
|
// Copyright (C) 2018 The Android Open Source Project
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2018-08-24 16:59:50 +02:00
|
|
|
// This is required because no Android.bp can include a library defined in an
|
|
|
|
// Android.mk. Eventually should kill libfastboot (defined in Android.mk)
|
2021-02-17 04:02:14 +01:00
|
|
|
package {
|
2022-01-18 22:58:46 +01:00
|
|
|
default_applicable_licenses: [
|
|
|
|
"system_core_fastboot_license",
|
|
|
|
"Android-Apache-2.0",
|
|
|
|
],
|
2021-02-17 04:02:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Added automatically by a large-scale-change that took the approach of
|
|
|
|
// 'apply every license found to every target'. While this makes sure we respect
|
|
|
|
// every license restriction, it may not be entirely correct.
|
|
|
|
//
|
|
|
|
// e.g. GPL in an MIT project might only apply to the contrib/ directory.
|
|
|
|
//
|
|
|
|
// Please consider splitting the single license below into multiple licenses,
|
|
|
|
// taking care not to lose any license_kind information, and overriding the
|
|
|
|
// default license using the 'licenses: [...]' property on targets as needed.
|
|
|
|
//
|
|
|
|
// For unused files, consider creating a 'fileGroup' with "//visibility:private"
|
|
|
|
// to attach the license to, and including a comment whether the files may be
|
|
|
|
// used in the current project.
|
|
|
|
// See: http://go/android-license-faq
|
|
|
|
license {
|
|
|
|
name: "system_core_fastboot_license",
|
|
|
|
visibility: [":__subpackages__"],
|
|
|
|
license_kinds: [
|
|
|
|
"SPDX-license-identifier-BSD",
|
|
|
|
],
|
2022-01-18 22:58:46 +01:00
|
|
|
license_text: ["LICENSE"],
|
2021-02-17 04:02:14 +01:00
|
|
|
}
|
|
|
|
|
2018-06-26 22:38:35 +02:00
|
|
|
cc_library_host_static {
|
|
|
|
name: "libfastboot2",
|
|
|
|
|
|
|
|
//host_supported: true,
|
|
|
|
|
|
|
|
compile_multilib: "first",
|
|
|
|
srcs: [
|
2018-08-29 23:58:02 +02:00
|
|
|
"bootimg_utils.cpp",
|
|
|
|
"fs.cpp",
|
|
|
|
"socket.cpp",
|
|
|
|
"tcp.cpp",
|
|
|
|
"udp.cpp",
|
|
|
|
"util.cpp",
|
2021-02-23 00:00:15 +01:00
|
|
|
"vendor_boot_img_utils.cpp",
|
2018-08-29 23:58:02 +02:00
|
|
|
"fastboot_driver.cpp",
|
2018-06-26 22:38:35 +02:00
|
|
|
],
|
|
|
|
|
|
|
|
static_libs: [
|
2018-08-29 23:58:02 +02:00
|
|
|
"libziparchive",
|
|
|
|
"libsparse",
|
|
|
|
"libutils",
|
|
|
|
"liblog",
|
|
|
|
"libz",
|
|
|
|
"libdiagnose_usb",
|
|
|
|
"libbase",
|
|
|
|
"libcutils",
|
|
|
|
"libgtest",
|
|
|
|
"libgtest_main",
|
|
|
|
"libbase",
|
|
|
|
"libadb_host",
|
2018-11-17 00:53:35 +01:00
|
|
|
"liblp",
|
2018-06-26 22:38:35 +02:00
|
|
|
],
|
|
|
|
|
|
|
|
header_libs: [
|
2021-02-23 00:00:15 +01:00
|
|
|
"avb_headers",
|
2018-08-29 23:58:02 +02:00
|
|
|
"bootimg_headers",
|
2021-02-19 00:15:46 +01:00
|
|
|
"libstorage_literals_headers",
|
2018-06-26 22:38:35 +02:00
|
|
|
],
|
|
|
|
|
|
|
|
export_header_lib_headers: [
|
2018-08-29 23:58:02 +02:00
|
|
|
"bootimg_headers",
|
2018-06-26 22:38:35 +02:00
|
|
|
],
|
|
|
|
|
|
|
|
target: {
|
2018-08-29 23:58:02 +02:00
|
|
|
linux: {
|
|
|
|
srcs: ["usb_linux.cpp"],
|
|
|
|
},
|
|
|
|
|
|
|
|
darwin: {
|
|
|
|
srcs: ["usb_osx.cpp"],
|
|
|
|
|
|
|
|
host_ldlibs: [
|
|
|
|
"-framework CoreFoundation",
|
|
|
|
"-framework IOKit",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
windows: {
|
|
|
|
srcs: ["usb_windows.cpp"],
|
|
|
|
|
|
|
|
host_ldlibs: [
|
|
|
|
"-lws2_32",
|
|
|
|
],
|
|
|
|
},
|
2018-06-26 22:38:35 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
cflags: [
|
2018-08-29 23:58:02 +02:00
|
|
|
"-Wall",
|
|
|
|
"-Wextra",
|
|
|
|
"-Werror",
|
|
|
|
"-Wunreachable-code",
|
2018-06-26 22:38:35 +02:00
|
|
|
],
|
|
|
|
|
|
|
|
export_include_dirs: ["."],
|
|
|
|
|
|
|
|
}
|
2018-07-17 20:14:01 +02:00
|
|
|
|
|
|
|
cc_defaults {
|
|
|
|
name: "fastboot_defaults",
|
|
|
|
|
|
|
|
cflags: [
|
|
|
|
"-Wall",
|
|
|
|
"-Wextra",
|
|
|
|
"-Werror",
|
|
|
|
"-Wvla",
|
2021-03-23 03:21:34 +01:00
|
|
|
"-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION",
|
2022-04-21 05:03:27 +02:00
|
|
|
"-Wthread-safety",
|
2018-07-17 20:14:01 +02:00
|
|
|
],
|
|
|
|
rtti: true,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_binary {
|
|
|
|
name: "fastbootd",
|
|
|
|
defaults: ["fastboot_defaults"],
|
|
|
|
|
|
|
|
recovery: true,
|
|
|
|
|
2021-02-17 22:44:49 +01:00
|
|
|
product_variables: {
|
|
|
|
debuggable: {
|
|
|
|
cppflags: ["-DFB_ENABLE_FETCH"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2018-07-17 20:14:01 +02:00
|
|
|
srcs: [
|
|
|
|
"device/commands.cpp",
|
|
|
|
"device/fastboot_device.cpp",
|
2018-07-25 00:21:20 +02:00
|
|
|
"device/flashing.cpp",
|
2018-07-17 20:14:01 +02:00
|
|
|
"device/main.cpp",
|
2020-03-28 02:09:56 +01:00
|
|
|
"device/usb.cpp",
|
2022-07-13 02:37:54 +02:00
|
|
|
"device/usb_iouring.cpp",
|
2018-07-17 20:14:01 +02:00
|
|
|
"device/usb_client.cpp",
|
2020-04-22 23:25:45 +02:00
|
|
|
"device/tcp_client.cpp",
|
2018-07-20 22:35:50 +02:00
|
|
|
"device/utility.cpp",
|
|
|
|
"device/variables.cpp",
|
2020-04-22 23:25:45 +02:00
|
|
|
"socket.cpp",
|
2018-07-17 20:14:01 +02:00
|
|
|
],
|
|
|
|
|
|
|
|
shared_libs: [
|
2018-07-20 22:35:50 +02:00
|
|
|
"android.hardware.boot@1.0",
|
2019-10-22 01:45:59 +02:00
|
|
|
"android.hardware.boot@1.1",
|
2022-06-21 23:20:54 +02:00
|
|
|
"android.hardware.boot-V1-ndk",
|
|
|
|
"libboot_control_client",
|
2020-09-23 10:28:03 +02:00
|
|
|
"android.hardware.fastboot@1.1",
|
2018-09-28 20:41:22 +02:00
|
|
|
"android.hardware.health@2.0",
|
2021-12-03 03:58:02 +01:00
|
|
|
"android.hardware.health-V1-ndk",
|
2018-08-07 04:13:38 +02:00
|
|
|
"libasyncio",
|
|
|
|
"libbase",
|
2021-12-03 03:58:02 +01:00
|
|
|
"libbinder_ndk",
|
2018-07-17 20:14:01 +02:00
|
|
|
"libbootloader_message",
|
2018-08-07 04:13:38 +02:00
|
|
|
"libcutils",
|
2018-07-31 22:27:37 +02:00
|
|
|
"libext2_uuid",
|
2018-08-07 04:13:38 +02:00
|
|
|
"libext4_utils",
|
|
|
|
"libfs_mgr",
|
2019-01-15 23:38:20 +01:00
|
|
|
"libgsi",
|
2018-07-17 20:14:01 +02:00
|
|
|
"libhidlbase",
|
2018-08-07 04:13:38 +02:00
|
|
|
"liblog",
|
2018-08-09 19:40:00 +02:00
|
|
|
"liblp",
|
2019-11-01 02:02:41 +01:00
|
|
|
"libprotobuf-cpp-lite",
|
2018-08-07 04:13:38 +02:00
|
|
|
"libsparse",
|
2018-07-17 20:14:01 +02:00
|
|
|
"libutils",
|
|
|
|
],
|
|
|
|
|
2018-09-28 20:41:22 +02:00
|
|
|
static_libs: [
|
2021-12-03 03:58:02 +01:00
|
|
|
"android.hardware.health-translate-ndk",
|
2021-04-08 06:43:03 +02:00
|
|
|
"libc++fs",
|
2018-09-28 20:41:22 +02:00
|
|
|
"libhealthhalutils",
|
2021-12-03 03:58:02 +01:00
|
|
|
"libhealthshim",
|
2020-09-22 01:34:25 +02:00
|
|
|
"libsnapshot_cow",
|
2022-04-12 02:29:27 +02:00
|
|
|
"liblz4",
|
2019-11-01 02:02:41 +01:00
|
|
|
"libsnapshot_nobinder",
|
2020-04-16 20:05:16 +02:00
|
|
|
"update_metadata-protos",
|
2022-07-13 02:37:54 +02:00
|
|
|
"liburing",
|
2018-09-28 20:41:22 +02:00
|
|
|
],
|
2022-07-13 02:37:54 +02:00
|
|
|
include_dirs: ["bionic/libc/kernel"],
|
2019-08-30 01:29:22 +02:00
|
|
|
|
|
|
|
header_libs: [
|
2020-05-13 01:21:41 +02:00
|
|
|
"avb_headers",
|
2021-04-21 00:22:02 +02:00
|
|
|
"libgtest_prod_headers",
|
2019-08-30 01:29:22 +02:00
|
|
|
"libsnapshot_headers",
|
2021-02-17 04:37:21 +01:00
|
|
|
"libstorage_literals_headers",
|
|
|
|
],
|
2018-07-17 20:14:01 +02:00
|
|
|
}
|
2018-08-29 23:58:02 +02:00
|
|
|
|
|
|
|
cc_defaults {
|
|
|
|
name: "fastboot_host_defaults",
|
|
|
|
|
|
|
|
use_version_lib: true,
|
|
|
|
|
|
|
|
cflags: [
|
|
|
|
"-Wall",
|
|
|
|
"-Wextra",
|
|
|
|
"-Werror",
|
|
|
|
"-Wunreachable-code",
|
2021-03-23 00:39:13 +01:00
|
|
|
"-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION",
|
2022-04-21 05:03:27 +02:00
|
|
|
"-D_FILE_OFFSET_BITS=64",
|
2018-08-29 23:58:02 +02:00
|
|
|
],
|
|
|
|
|
|
|
|
target: {
|
|
|
|
darwin: {
|
|
|
|
cflags: ["-Wno-unused-parameter"],
|
|
|
|
host_ldlibs: [
|
|
|
|
"-lpthread",
|
|
|
|
"-framework CoreFoundation",
|
|
|
|
"-framework IOKit",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
windows: {
|
|
|
|
enabled: true,
|
|
|
|
|
|
|
|
host_ldlibs: ["-lws2_32"],
|
|
|
|
},
|
2018-11-17 00:53:35 +01:00
|
|
|
not_windows: {
|
|
|
|
static_libs: [
|
|
|
|
"libext4_utils",
|
|
|
|
],
|
|
|
|
},
|
2018-08-29 23:58:02 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
stl: "libc++_static",
|
|
|
|
|
|
|
|
// Don't add anything here, we don't want additional shared dependencies
|
|
|
|
// on the host fastboot tool, and shared libraries that link against libc++
|
|
|
|
// will violate ODR.
|
|
|
|
shared_libs: [],
|
|
|
|
|
2019-09-16 05:23:55 +02:00
|
|
|
header_libs: [
|
|
|
|
"avb_headers",
|
|
|
|
"bootimg_headers",
|
|
|
|
],
|
|
|
|
|
2018-08-29 23:58:02 +02:00
|
|
|
static_libs: [
|
|
|
|
"libziparchive",
|
|
|
|
"libsparse",
|
|
|
|
"libutils",
|
|
|
|
"liblog",
|
2022-04-12 02:29:27 +02:00
|
|
|
"liblz4",
|
2018-08-29 23:58:02 +02:00
|
|
|
"libz",
|
|
|
|
"libdiagnose_usb",
|
|
|
|
"libbase",
|
|
|
|
"libcutils",
|
|
|
|
"libgtest_host",
|
2018-11-17 00:53:35 +01:00
|
|
|
"liblp",
|
|
|
|
"libcrypto",
|
2018-08-29 23:58:02 +02:00
|
|
|
],
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Build host libfastboot.
|
|
|
|
//
|
|
|
|
|
|
|
|
cc_library_host_static {
|
|
|
|
name: "libfastboot",
|
|
|
|
defaults: ["fastboot_host_defaults"],
|
|
|
|
|
|
|
|
srcs: [
|
|
|
|
"bootimg_utils.cpp",
|
|
|
|
"fastboot.cpp",
|
|
|
|
"fs.cpp",
|
|
|
|
"socket.cpp",
|
|
|
|
"tcp.cpp",
|
|
|
|
"udp.cpp",
|
|
|
|
"util.cpp",
|
2021-02-23 00:00:15 +01:00
|
|
|
"vendor_boot_img_utils.cpp",
|
2018-08-29 23:58:02 +02:00
|
|
|
"fastboot_driver.cpp",
|
|
|
|
],
|
|
|
|
|
|
|
|
// Only version the final binaries
|
|
|
|
use_version_lib: false,
|
|
|
|
static_libs: ["libbuildversion"],
|
2021-02-19 00:15:46 +01:00
|
|
|
header_libs: [
|
2021-02-23 00:00:15 +01:00
|
|
|
"avb_headers",
|
2021-02-19 00:15:46 +01:00
|
|
|
"libstorage_literals_headers",
|
|
|
|
],
|
2018-08-29 23:58:02 +02:00
|
|
|
|
|
|
|
generated_headers: ["platform_tools_version"],
|
|
|
|
|
2021-02-20 03:30:29 +01:00
|
|
|
tidy_flags: [
|
|
|
|
// DO NOT add quotes around header-filter flag regex argument,
|
|
|
|
// because build/soong will add quotes around the whole flag.
|
|
|
|
"-header-filter=(system/core/fastboot/|development/host/windows/usb/api/)",
|
|
|
|
],
|
|
|
|
|
2018-08-29 23:58:02 +02:00
|
|
|
target: {
|
|
|
|
windows: {
|
|
|
|
srcs: ["usb_windows.cpp"],
|
|
|
|
|
|
|
|
include_dirs: ["development/host/windows/usb/api"],
|
|
|
|
},
|
|
|
|
darwin: {
|
|
|
|
srcs: ["usb_osx.cpp"],
|
|
|
|
},
|
2020-08-20 11:04:01 +02:00
|
|
|
linux: {
|
2018-08-29 23:58:02 +02:00
|
|
|
srcs: ["usb_linux.cpp"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Build host fastboot / fastboot.exe
|
|
|
|
//
|
|
|
|
|
|
|
|
cc_binary_host {
|
|
|
|
name: "fastboot",
|
|
|
|
defaults: ["fastboot_host_defaults"],
|
|
|
|
|
|
|
|
srcs: ["main.cpp"],
|
|
|
|
static_libs: ["libfastboot"],
|
|
|
|
|
|
|
|
required: [
|
|
|
|
"mke2fs",
|
|
|
|
"make_f2fs",
|
2020-07-18 05:30:41 +02:00
|
|
|
"make_f2fs_casefold",
|
2018-08-29 23:58:02 +02:00
|
|
|
],
|
2018-11-20 04:11:35 +01:00
|
|
|
dist: {
|
|
|
|
targets: [
|
|
|
|
"dist_files",
|
|
|
|
"sdk",
|
2022-10-07 00:12:10 +02:00
|
|
|
"sdk-repo-platform-tools",
|
|
|
|
"sdk_repo",
|
2018-11-20 04:11:35 +01:00
|
|
|
"win_sdk",
|
|
|
|
],
|
|
|
|
},
|
2018-08-29 23:58:02 +02:00
|
|
|
|
|
|
|
target: {
|
|
|
|
not_windows: {
|
|
|
|
required: [
|
|
|
|
"mke2fs.conf",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
windows: {
|
|
|
|
required: ["AdbWinUsbApi"],
|
|
|
|
shared_libs: ["AdbWinApi"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Build host fastboot_test.
|
|
|
|
//
|
|
|
|
|
|
|
|
cc_test_host {
|
|
|
|
name: "fastboot_test",
|
|
|
|
defaults: ["fastboot_host_defaults"],
|
|
|
|
|
|
|
|
srcs: [
|
|
|
|
"fastboot_test.cpp",
|
|
|
|
"socket_mock.cpp",
|
|
|
|
"socket_test.cpp",
|
|
|
|
"tcp_test.cpp",
|
|
|
|
"udp_test.cpp",
|
|
|
|
],
|
|
|
|
|
|
|
|
static_libs: ["libfastboot"],
|
|
|
|
|
|
|
|
target: {
|
|
|
|
windows: {
|
|
|
|
shared_libs: ["AdbWinApi"],
|
|
|
|
},
|
|
|
|
windows_x86_64: {
|
|
|
|
// Avoid trying to build for win64
|
|
|
|
enabled: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2021-02-23 00:00:15 +01:00
|
|
|
|
|
|
|
cc_test_host {
|
|
|
|
name: "fastboot_vendor_boot_img_utils_test",
|
|
|
|
srcs: ["vendor_boot_img_utils_test.cpp"],
|
|
|
|
static_libs: [
|
|
|
|
"libbase",
|
|
|
|
"libc++fs",
|
|
|
|
"libfastboot",
|
|
|
|
"libgmock",
|
|
|
|
"liblog",
|
|
|
|
],
|
|
|
|
header_libs: [
|
|
|
|
"avb_headers",
|
|
|
|
"bootimg_headers",
|
|
|
|
],
|
|
|
|
cflags: [
|
|
|
|
"-Wall",
|
|
|
|
"-Werror",
|
|
|
|
],
|
|
|
|
data: [
|
|
|
|
":fastboot_test_dtb",
|
|
|
|
":fastboot_test_bootconfig",
|
|
|
|
":fastboot_test_vendor_ramdisk_none",
|
|
|
|
":fastboot_test_vendor_ramdisk_platform",
|
|
|
|
":fastboot_test_vendor_ramdisk_replace",
|
|
|
|
":fastboot_test_vendor_boot_v3",
|
|
|
|
":fastboot_test_vendor_boot_v4_without_frag",
|
2022-04-21 05:03:27 +02:00
|
|
|
":fastboot_test_vendor_boot_v4_with_frag",
|
2021-02-23 00:00:15 +01:00
|
|
|
],
|
|
|
|
}
|
2021-09-20 08:30:21 +02:00
|
|
|
|
|
|
|
cc_library_headers {
|
|
|
|
name: "fastboot_headers",
|
|
|
|
host_supported: true,
|
|
|
|
export_include_dirs: ["."],
|
|
|
|
}
|