blob: a9bd3854678f49aad2b855eed25cf4a29aaf4c6a [file] [log] [blame]
//
// Copyright (C) 2017-2020 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.
//
subdirs = [
"test",
"tools",
]
cc_defaults {
name: "avb_defaults",
cflags: [
"-D_FILE_OFFSET_BITS=64",
"-D_POSIX_C_SOURCE=199309L",
"-Wa,--noexecstack",
"-Werror",
"-Wall",
"-Wextra",
"-Wformat=2",
"-Wmissing-prototypes",
"-Wno-psabi",
"-Wno-unused-parameter",
"-Wno-format",
"-ffunction-sections",
"-fstack-protector-strong",
"-g",
"-DAVB_ENABLE_DEBUG",
"-DAVB_COMPILATION",
],
cppflags: [
"-Wnon-virtual-dtor",
"-fno-strict-aliasing",
],
ldflags: [
"-Wl,--gc-sections",
"-rdynamic",
],
target: {
darwin: {
enabled: false,
},
},
}
cc_defaults {
name: "avb_sources",
srcs: [
"libavb/avb_chain_partition_descriptor.c",
"libavb/avb_cmdline.c",
"libavb/avb_crc32.c",
"libavb/avb_crypto.c",
"libavb/avb_descriptor.c",
"libavb/avb_footer.c",
"libavb/avb_hash_descriptor.c",
"libavb/avb_hashtree_descriptor.c",
"libavb/avb_kernel_cmdline_descriptor.c",
"libavb/avb_property_descriptor.c",
"libavb/avb_rsa.c",
"libavb/avb_sha256.c",
"libavb/avb_sha512.c",
"libavb/avb_slot_verify.c",
"libavb/avb_util.c",
"libavb/avb_vbmeta_image.c",
"libavb/avb_version.c",
],
}
python_binary_host {
name: "avbtool",
srcs: ["avbtool.py"],
main: "avbtool.py",
required: ["fec"],
version: {
py2: {
enabled: false,
},
py3: {
enabled: true,
embedded_launcher: true,
},
},
}
python_library_host {
name: "aftl_proto",
srcs: [
"proto/api.proto",
"proto/crypto/sigpb/sigpb.proto",
"proto/crypto/keyspb/keyspb.proto",
"proto/trillian.proto",
],
proto: {
include_dirs: [
"external/protobuf/src",
],
local_include_dirs: [
"proto",
],
canonical_path_from_root: false,
},
version: {
py2: {
enabled: false,
},
py3: {
enabled: true,
},
},
}
python_binary_host {
name: "aftltool",
srcs: [
"aftltool.py",
"avbtool.py",
],
libs: [
"aftl_proto",
],
main: "aftltool.py",
version: {
py2: {
enabled: false,
},
py3: {
enabled: true,
},
},
}
python_test_host {
name: "aftltool_test",
main: "aftltool_test.py",
srcs: [
"aftltool.py",
"aftltool_test.py",
"avbtool.py",
],
libs: [
"aftl_proto",
],
data: [
"test/data/**/*.*",
],
test_suites: ["general-tests"],
version: {
py2: {
enabled: false,
},
py3: {
enabled: true,
},
},
}
// Build libavb - this is a static library that depends
// on only libc and doesn't drag in any other dependencies.
cc_library_static {
name: "libavb",
defaults: [
"avb_defaults",
"avb_sources",
],
host_supported: true,
recovery_available: true,
header_libs: [
"avb_headers",
],
export_header_lib_headers: ["avb_headers"],
target: {
linux: {
srcs: ["libavb/avb_sysdeps_posix.c"],
},
linux_glibc: {
cflags: ["-fno-stack-protector"],
},
},
}
// Build libavb_user for the target - in addition to libavb, it
// includes libavb_ab, libavb_user and also depends on libbase and
// libfs_mgr.
cc_library_static {
name: "libavb_user",
defaults: [
"avb_defaults",
"avb_sources",
],
recovery_available: true,
header_libs: [
"avb_headers",
],
export_header_lib_headers: ["avb_headers"],
shared_libs: ["libbase"],
static_libs: ["libfs_mgr"],
cflags: [
"-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
],
srcs: [
"libavb/avb_sysdeps_posix.c",
"libavb_ab/avb_ab_flow.c",
"libavb_user/avb_ops_user.cpp",
"libavb_user/avb_user_verity.c",
"libavb_user/avb_user_verification.c",
],
}
cc_binary {
name: "avbctl",
defaults: ["avb_defaults"],
static_libs: [
"libavb_user",
"libfs_mgr",
],
shared_libs: ["libbase"],
srcs: ["tools/avbctl/avbctl.cc"],
}
cc_library_host_static {
name: "libavb_ab_host",
defaults: ["avb_defaults"],
header_libs: [
"avb_headers",
],
export_header_lib_headers: ["avb_headers"],
cflags: [
"-fno-stack-protector",
"-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
],
srcs: ["libavb_ab/avb_ab_flow.c"],
}
cc_library_static {
name: "libavb_aftl",
defaults: [
"avb_defaults",
"avb_sources",
],
host_supported: true,
recovery_available: true,
header_libs: ["avb_headers"],
export_header_lib_headers: ["avb_headers"],
cflags: [
"-fno-stack-protector",
],
srcs: [
"libavb_aftl/avb_aftl_util.c",
"libavb_aftl/avb_aftl_validate.c",
"libavb_aftl/avb_aftl_verify.c",
],
}
cc_fuzz {
name: "libavb_aftl_fuzzer",
defaults: ["avb_defaults"],
// The fuzzing entry point is declared and defined in the same file.
// Overwrite the behaviour introduced by avb_defaults.
cflags: [
"-Wno-missing-prototypes",
],
srcs: [
"test/avb_aftl_fuzz.cc",
],
static_libs: [
"libavb",
"libavb_aftl",
],
host_supported: true,
corpus: ["test/corpus/*"],
fuzz_config: {
cc: [
"tweek@google.com",
"jpm@google.com",
],
componentid: 685985,
},
}
cc_library_host_static {
name: "libavb_atx_host",
defaults: ["avb_defaults"],
header_libs: [
"avb_headers",
],
export_header_lib_headers: ["avb_headers"],
cflags: [
"-fno-stack-protector",
],
srcs: ["libavb_atx/avb_atx_validate.c"],
}
cc_library_host_static {
name: "libavb_host_sysdeps",
defaults: ["avb_defaults"],
header_libs: [
"avb_headers",
],
export_header_lib_headers: ["avb_headers"],
srcs: ["libavb/avb_sysdeps_posix.c"],
}
cc_library_host_static {
name: "libavb_things_example",
defaults: ["avb_defaults"],
header_libs: [
"avb_headers",
],
export_header_lib_headers: ["avb_headers"],
srcs: ["examples/things/avb_atx_slot_verify.c"],
}
cc_test_host {
name: "libavb_host_unittest",
defaults: ["avb_defaults"],
required: [
"simg2img",
"img2simg",
"avbtool",
],
data: [
"avbtool",
"test/avbtool_signing_helper_test.py",
"test/avbtool_signing_helper_with_files_test.py",
"test/data/*",
],
test_config: "test/libavb_host_unittest.xml",
test_suites: ["general-tests"],
static_libs: [
"libavb",
"libavb_ab_host",
"libavb_aftl",
"libavb_atx_host",
"libavb_things_example",
"libgmock_host",
"libgtest_host",
],
shared_libs: [
"libbase",
"libchrome",
"libcrypto",
],
cflags: [
"-Wno-missing-prototypes",
"-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
],
srcs: [
"test/avb_ab_flow_unittest.cc",
"test/avb_aftl_util_unittest.cc",
"test/avb_aftl_validate_unittest.cc",
"test/avb_aftl_verify_unittest.cc",
"test/avb_atx_validate_unittest.cc",
"test/avb_atx_slot_verify_unittest.cc",
"test/avb_slot_verify_unittest.cc",
"test/avb_unittest_util.cc",
"test/avb_util_unittest.cc",
"test/avb_vbmeta_image_unittest.cc",
"test/avbtool_unittest.cc",
"test/fake_avb_ops.cc",
"test/avb_sysdeps_posix_testing.cc",
],
}
cc_library_host_static {
name: "libavb_host_user_code_test",
defaults: ["avb_defaults"],
cflags: [
"-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
],
srcs: ["test/user_code_test.cc"],
}
cc_library {
name: "bootctrl.avb",
defaults: ["avb_defaults"],
relative_install_path: "hw",
static_libs: [
"libavb_user",
"libfs_mgr",
],
shared_libs: [
"libbase",
"libcutils",
],
cflags: [
"-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED",
],
srcs: ["boot_control/boot_control_avb.c"],
}
cc_library_headers {
name: "avb_headers",
host_supported: true,
recovery_available: true,
export_include_dirs: ["."],
target: {
windows: {
enabled: true,
},
},
}